packages/fff: Add package fff-web-l3config
With this package the layer3 configuration can make and change in the webui. All function from configure-layer3 can use with the buttons. This patch can only be applied after: fff-layer3: Add script to load vlan defaults fff-layer3: Make it easier to keep the settings in testmode Signed-off-by: Christian Dresel <freifunk@dresel.systems>
This commit is contained in:
parent
7e552761f6
commit
973a5a298f
|
@ -19,6 +19,7 @@ define Package/fff-layer3
|
|||
+fff-layer3-config \
|
||||
+fff-network \
|
||||
+fff-ra \
|
||||
+fff-web-l3config \
|
||||
+fff-wireguard \
|
||||
+arptables \
|
||||
+bmon \
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-web-l3config
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fff-web-l3config
|
||||
SECTION:=base
|
||||
CATEGORY:=Freifunk
|
||||
TITLE:=Freifunk-Franken layer3 config webui
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:= \
|
||||
+fff-layer3-config \
|
||||
+fff-web-ui
|
||||
endef
|
||||
|
||||
define Package/fff-web-l3config/description
|
||||
Configure a layer3 router via a web UI
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# nothing
|
||||
endef
|
||||
|
||||
define Package/fff-web-l3config/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fff-web-l3config))
|
|
@ -0,0 +1 @@
|
|||
l3settings,Layer 3
|
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/haserl
|
||||
|
||||
<%in /www/include/header %>
|
||||
<%in /www/include/helpers %>
|
||||
<% show_msg %>
|
||||
|
||||
<fieldset style="min-height: 7em;" class="smallinput">
|
||||
<legend>Status</legend>
|
||||
<table><tr><td>
|
||||
<textarea name="status" rows="7" cols="100" readonly>
|
||||
<%
|
||||
# write
|
||||
if [ "$REQUEST_METHOD" = "POST" ] && [ -n "${POST_writeconfig}" ] ; then
|
||||
echo "${POST_l3config}" > /etc/config/gateway
|
||||
echo "Konfiguration wurde gespeichert. Bitte nun Konfiguration schreiben"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_loadconfig}" ] ; then
|
||||
yes | configure-layer3 -c
|
||||
fi
|
||||
|
||||
if [ -n "${POST_testconfig}" ] ; then
|
||||
configure-layer3 -t &
|
||||
# we need a sleep, because configure-layer3 -t need some time
|
||||
sleep 1;
|
||||
echo "Konfigurationstest läuft, bitte innerhalb von 200 Sekunden abbrechen ansonsten wird die Konfiguration zurück gesetzt"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_testconfigcancel}" ] ; then
|
||||
configure-layer3 -k 1>&2
|
||||
echo "Testmodus abgebrochen, Konfiguration bleibt gespeichert. Zum endgültigen Übernehmen auf 'Konfiguration Übernehmen' klicken"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_applyconfig}" ] ; then
|
||||
configure-layer3 -a
|
||||
echo "Konfiguration wurde komplett gespeichert und ist nun rebootfest"
|
||||
fi
|
||||
|
||||
if [ -f /tmp/configure-layer3-pid ] ; then
|
||||
echo "Testmodus aktiv"
|
||||
fi
|
||||
|
||||
if [ -n "${POST_loadvlandefault}" ] ; then
|
||||
yes | loadvlandefault 1>&2
|
||||
echo "VLAN Defaults wurden geladen"
|
||||
fi
|
||||
%>
|
||||
</textarea>
|
||||
<p>
|
||||
<form method="post"><input type="submit" name="loadconfig" value="Router konfigurieren" style="margin-top: 5px; margin-left: 3px;" />
|
||||
<%
|
||||
if [ -f /tmp/configure-layer3-pid ] ; then
|
||||
echo "<input type=\"submit\" name=\"testconfigcancel\" value=\"Test beenden\" style=\"margin-top: 5px; margin-left: 3px;\" />"
|
||||
else
|
||||
echo "<input type=\"submit\" name=\"testconfig\" value=\"Konfiguration testen\" style=\"margin-top: 5px; margin-left: 3px;\" />"
|
||||
fi
|
||||
%>
|
||||
<input type="submit" name="applyconfig" value="Konfiguration übernehmen" style="margin-top: 5px; margin-left: 3px;" /></form>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
* Erstelle zuerst unten eine Konfiguration und speichere diese ab</br>
|
||||
* Klicke danach auf 'Router konfigurieren' um diese Konfiguration in die Routereinstellungen zu schreiben</br>
|
||||
* Danach kannst du mit Konfiguration testen, die Konfiguration testen. Sollte alles funktionieren musst du diesen Test mit Test beenden beenden ansonsten werden nach 200 Sekunden die Einstellungen zurüruck gesetzt. Sollte die Konfiguration fehlerhaft sein, warte einfach 200 Sekunden und du kommst auf den alten Weg wieder auf das Gerät. Ein manueller Neustart setzt auch die komplette Konfiguriation züruck</br>
|
||||
* Wenn die Einstellungen funktionieren klicke auf Konfiguration übernehmen, erst dann ist die Konfiguration auch rebootfest.</br>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<%
|
||||
# read
|
||||
l3config=$(cat /etc/config/gateway)
|
||||
%>
|
||||
|
||||
<form method="post">
|
||||
<table style="width: 100%;">
|
||||
<tr><td>
|
||||
<fieldset style="min-height: 13em;">
|
||||
<legend>Konfigurationsdatei</legend>
|
||||
<textarea name="l3config" rows="25" cols="100"><% echo "$l3config" %></textarea>
|
||||
</fieldset>
|
||||
<p><input type="submit" name="writeconfig" value="Konfigurationdatei speichern" style="margin-top: 5px; margin-left: 3px;" />
|
||||
<input type="submit" onclick="return confirm('Achtung: Es werden alle VLAN Einstellungen zurück gesetzt und die Standarteinstellungen gelanden. Willst du dies wirklich?')" name="loadvlandefault" value="VLAN default laden" style="margin-top: 5px; margin-left: 3px;" /></p>
|
||||
</td><td>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
<%in /www/include/footer %>
|
Loading…
Reference in New Issue