From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arne Fitzenreiter To: ipfire-scm@lists.ipfire.org Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. 3a924196805eb3a0a93006b316583609d7e8148b Date: Tue, 05 Nov 2024 08:14:58 +0000 Message-ID: <4XjLjZ62Zgz2xTf@people01.haj.ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6942196901438602075==" List-Id: --===============6942196901438602075== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 2.x development tree". The branch, next has been updated via 3a924196805eb3a0a93006b316583609d7e8148b (commit) via e595fa11768287b239d049346b6370a0fa23fd3e (commit) via 131bcfa999179f58b8d44d871b299747607286be (commit) via a81eefa265610d4129961979182bf8a8bb6230f9 (commit) via 17a9ad2f52e908c82929a5907f9e436b552c2ef0 (commit) via 74849f68c9bdc827452957a67e30bbd462494a3d (commit) via c6282b001bd2723f554e77f51f224adce5be4156 (commit) from 7350feee58b0e190c9a07b1b65580e730053878e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3a924196805eb3a0a93006b316583609d7e8148b Author: Arne Fitzenreiter Date: Tue Nov 5 09:13:56 2024 +0100 core190: ship unbound-dhcp-leases-bridge =20 Signed-off-by: Arne Fitzenreiter commit e595fa11768287b239d049346b6370a0fa23fd3e Author: Michael Tremer Date: Mon Oct 21 16:38:49 2024 +0000 unbound-dhcp-leases-bridge: Fix expiry check on leases =20 Signed-off-by: Michael Tremer Signed-off-by: Arne Fitzenreiter commit 131bcfa999179f58b8d44d871b299747607286be Author: Michael Tremer Date: Mon Oct 21 16:38:48 2024 +0000 unbound-dhcp-leases-bridge: Don't overwrite static leases =20 When we import all static leases, their remark will be used as hostname (because WTF?) and might be overwritten if the device is not sending any or even the same hostname. =20 This patch avoids that static leases will be modified. =20 Signed-off-by: Michael Tremer Reviewed-by: Bernhard Bitsch Signed-off-by: Arne Fitzenreiter commit a81eefa265610d4129961979182bf8a8bb6230f9 Author: Michael Tremer Date: Mon Oct 21 16:38:47 2024 +0000 unbound-dhcp-leases-bridge: Fix typo =20 Signed-off-by: Michael Tremer Reviewed-by: Bernhard Bitsch Signed-off-by: Arne Fitzenreiter commit 17a9ad2f52e908c82929a5907f9e436b552c2ef0 Author: Michael Tremer Date: Mon Oct 21 16:38:46 2024 +0000 unbound-dhcp-leases-bridge: Don't export expired leases to Unbound =20 Signed-off-by: Michael Tremer Reviewed-by: Bernhard Bitsch Signed-off-by: Arne Fitzenreiter commit 74849f68c9bdc827452957a67e30bbd462494a3d Author: Arne Fitzenreiter Date: Tue Nov 5 09:10:01 2024 +0100 core190: ship dhcp client changes =20 Signed-off-by: Arne Fitzenreiter commit c6282b001bd2723f554e77f51f224adce5be4156 Author: Michael Tremer Date: Wed Oct 16 10:47:17 2024 +0000 networking: Allow changing DHCP Option Rapid Commit =20 This option needs to be configurable since some (braindead) ISPs have started running broken DHCP servers to be bug-compatible with cheap broken plastic routers. =20 By default we keep this option enabled, but it can now be turned off whenever needed. =20 Suggested-by: Adolf Belka Signed-off-by: Michael Tremer Tested-by: Adolf Belka Signed-off-by: Arne Fitzenreiter ----------------------------------------------------------------------- Summary of changes: config/dhcpc/dhcpcd.conf | 5 ---- config/rootfiles/core/190/filelists/files | 4 +++ config/unbound/unbound-dhcp-leases-bridge | 18 ++++++++---- src/initscripts/networking/red | 13 ++++++++- src/setup/netstuff.c | 47 +++++++++++++++++++++++++----= -- 5 files changed, 66 insertions(+), 21 deletions(-) Difference in files: diff --git a/config/dhcpc/dhcpcd.conf b/config/dhcpc/dhcpcd.conf index 062e3c975b..b46c85caba 100644 --- a/config/dhcpc/dhcpcd.conf +++ b/config/dhcpc/dhcpcd.conf @@ -37,11 +37,6 @@ option host_name # Most distributions have NTP support. option ntp_servers =20 -# Rapid commit support. -# Safe to enable by default because it requires the equivalent option set -# on the server to actually work. -option rapid_commit - # A ServerID is required by RFC2131. require dhcp_server_identifier =20 diff --git a/config/rootfiles/core/190/filelists/files b/config/rootfiles/cor= e/190/filelists/files index 4b65efd1d7..f25c5f8577 100644 --- a/config/rootfiles/core/190/filelists/files +++ b/config/rootfiles/core/190/filelists/files @@ -11,6 +11,7 @@ etc/rc.d/init.d/cleanfs etc/rc.d/init.d/collectd etc/rc.d/init.d/firewall etc/rc.d/init.d/networking/functions.network +etc/rc.d/init.d/networking/red etc/rc.d/init.d/squid etc/rc.d/init.d/suricata lib/udev/network-hotplug-bridges @@ -25,6 +26,9 @@ usr/lib/firewall/rules.pl usr/lib/perl5/5.36.0/xxxMACHINExxx-linux-thread-multi/Compress/Raw/Zlib.pm usr/local/bin/openvpnctrl usr/local/bin/sshctrl +usr/sbin/unbound-dhcp-leases-bridge +usr/sbin/setup var/ipfire/backup/include +var/ipfire/dhcpc/dhcpcd.conf var/ipfire/graphs.pl var/ipfire/network-functions.pl diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbou= nd-dhcp-leases-bridge index 986fae2d24..4a6f9587f8 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -216,6 +216,11 @@ class UnboundDHCPLeasesBridge(object): # Find the old lease old_lease =3D self._find_lease(address) =20 + # Don't update fixed leases as they might clear the hostname + if old_lease and old_lease.fixed: + log.debug("Won't update fixed lease %s" % old_lease) + return + # Create a new lease lease =3D Lease(address, { "client-hostname" : name, @@ -276,12 +281,12 @@ class UnboundDHCPLeasesBridge(object): if lease.has_expired(): log.debug(" Expired") =20 - self.unbound.update_dhcp_leases(self.leases) + self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expir= ed()]) =20 def _add_lease(self, lease): - # Skip leases without an FQDN + # Skip leases without a FQDN if not lease.fqdn: - log.debug("Skipping lease without an FQDN: %s" % lease) + log.debug("Skipping lease without a FQDN: %s" % lease) return =20 # Skip any leases that also are a static host @@ -581,19 +586,20 @@ class FixLeases(object): "client-hostname" : hostname, "starts" : now.strftime("%w %Y/%m/%d %H:%M:%S"), "ends" : "never", - }) + }, fixed=3DTrue) leases.append(l) =20 return leases =20 =20 class Lease(object): - def __init__(self, ipaddr, properties): + def __init__(self, ipaddr, properties, fixed=3DFalse): if not isinstance(ipaddr, ipaddress.IPv4Address): ipaddr =3D ipaddress.IPv4Address(ipaddr) =20 self.ipaddr =3D ipaddr self._properties =3D properties + self.fixed =3D fixed =20 def __repr__(self): return "<%s for %s (%s)>" % (self.__class__.__name__, self.ipaddr, self.ho= stname) @@ -711,7 +717,7 @@ class Lease(object): if not self.time_ends: return self.time_starts > datetime.datetime.utcnow() =20 - return self.time_starts > datetime.datetime.utcnow() > self.time_ends + return not self.time_starts < datetime.datetime.utcnow() < self.time_ends =20 @property def rrset(self): diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red index 34ee8cc581..72b9bf0cf3 100644 --- a/src/initscripts/networking/red +++ b/src/initscripts/networking/red @@ -171,9 +171,20 @@ case "${1}" in # To determine this we check if a wpa_supplicant is running. pid=3D"$(pidof wpa_supplicant)" =20 + DHCPCD_ARGS=3D() + + # Enable Rapid Commit (enabled by default) + case "${RED_DHCP_RAPID_COMMIT}" in + ""|yes|true|on) + DHCPCD_ARGS+=3D( "--option" "rapid_commit" ) + ;; + esac + + echo dhcpcd_start "${DEVICE}" "${DHCPCD_ARGS[@]}" + if [ -z "${pid}" ]; then # No wpa_supplicant is running. So it's save to start dhcpcd. - dhcpcd_start "${DEVICE}" + dhcpcd_start "${DEVICE}" "${DHCPCD_ARGS[@]}" fi =20 elif [ "$TYPE" =3D=3D "PPPOE" ]; then diff --git a/src/setup/netstuff.c b/src/setup/netstuff.c index 60e27242ff..602ef97f5f 100644 --- a/src/setup/netstuff.c +++ b/src/setup/netstuff.c @@ -37,6 +37,7 @@ newtComponent dhcptyperadio; newtComponent pppoetyperadio; newtComponent dhcphostnameentry; newtComponent dhcpforcemtuentry; +newtComponent dhcprapidcommitentry; =20 /* acceptable character filter for IP and netmaks entry boxes */ static int ip_input_filter(newtComponent entry, void * data, int ch, int cur= sor) @@ -64,6 +65,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int ty= peflag, newtComponent gatewaylabel; newtComponent dhcphostnamelabel; newtComponent dhcpforcemtulabel; + newtComponent dhcprapidcommitlabel; newtComponent ok, cancel;=09 char message[1000]; char temp[STRING_SIZE]; @@ -73,6 +75,8 @@ int changeaddress(struct keyvalue *kv, char *colour, int ty= peflag, char typefield[STRING_SIZE]; char dhcphostnamefield[STRING_SIZE]; char dhcpforcemtufield[STRING_SIZE]; + char dhcprapidcommitfield[STRING_SIZE]; + char enablerapidcommit; int error; int result =3D 0; char type[STRING_SIZE]; @@ -88,9 +92,10 @@ int changeaddress(struct keyvalue *kv, char *colour, int t= ypeflag, sprintf(typefield, "%s_TYPE", colour); sprintf(dhcphostnamefield, "%s_DHCP_HOSTNAME", colour); sprintf(dhcpforcemtufield, "%s_DHCP_FORCE_MTU", colour); + sprintf(dhcprapidcommitfield, "%s_DHCP_RAPID_COMMIT", colour); =09 sprintf(message, _("Interface - %s"), colour); - newtCenteredWindow(44, (typeflag ? 19 : 12), message); + newtCenteredWindow(44, (typeflag ? 20 : 12), message); =09 networkform =3D newtForm(NULL, NULL, 0); =20 @@ -102,6 +107,15 @@ int changeaddress(struct keyvalue *kv, char *colour, int= typeflag, * of the window down two rows to make room. */ if (typeflag) { + *temp =3D '\0'; + + // Find RapidCommit setting + findkey(kv, dhcprapidcommitfield, temp); + if (strcmp(temp, "yes") =3D=3D 0 || strcmp(temp, "true") =3D=3D 0 || strcm= p(temp, "on") =3D=3D 0 || strcmp(temp, "") =3D=3D 0) + enablerapidcommit =3D '*'; + else + enablerapidcommit =3D ' '; + strcpy(temp, "STATIC"); findkey(kv, typefield, temp); if (strcmp(temp, "STATIC") =3D=3D 0) startstatictype =3D 1; if (strcmp(temp, "DHCP") =3D=3D 0) startdhcptype =3D 1; @@ -119,28 +133,35 @@ int changeaddress(struct keyvalue *kv, char *colour, in= t typeflag, newtTextboxSetText(dhcphostnamelabel, _("DHCP Hostname:")); dhcpforcemtulabel =3D newtTextbox(2, 9, 18, 1, 0); newtTextboxSetText(dhcpforcemtulabel, _("Force DHCP MTU:")); + dhcprapidcommitlabel =3D newtTextbox(2, 10, 18, 1, 0); + newtTextboxSetText(dhcprapidcommitlabel, _("Rapid Commit:")); strcpy(temp, defaultdhcphostname); findkey(kv, dhcphostnamefield, temp); dhcphostnameentry =3D newtEntry(20, 8, temp, 20, &dhcphostnameresult, 0); strcpy(temp, ""); findkey(kv, dhcpforcemtufield, temp); dhcpforcemtuentry =3D newtEntry(20, 9, temp, 20, &dhcpforcemturesult, 0); + dhcprapidcommitentry =3D newtCheckbox(20, 10, "", enablerapidcommit, " *",= &enablerapidcommit); + newtComponentAddCallback(dhcprapidcommitentry, networkdialogcallbacktype, = NULL); newtFormAddComponent(networkform, dhcphostnamelabel); newtFormAddComponent(networkform, dhcphostnameentry); newtFormAddComponent(networkform, dhcpforcemtulabel); newtFormAddComponent(networkform, dhcpforcemtuentry); + newtFormAddComponent(networkform, dhcprapidcommitlabel); + newtFormAddComponent(networkform, dhcprapidcommitentry); if (startdhcptype =3D=3D 0) { newtEntrySetFlags(dhcphostnameentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); newtEntrySetFlags(dhcpforcemtuentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); + newtCheckboxSetFlags(dhcprapidcommitentry, NEWT_FLAG_DISABLED, NEWT_FLAG= S_SET); } } /* Address */ - addresslabel =3D newtTextbox(2, (typeflag ? 11 : 4) + 0, 18, 1, 0); + addresslabel =3D newtTextbox(2, (typeflag ? 12 : 4) + 0, 18, 1, 0); newtTextboxSetText(addresslabel, _("IP address:")); strcpy(temp, ""); findkey(kv, addressfield, temp); - addressentry =3D newtEntry(20, (typeflag ? 11 : 4) + 0, temp, 20, &addressr= esult, 0); + addressentry =3D newtEntry(20, (typeflag ? 12 : 4) + 0, temp, 20, &addressr= esult, 0); newtEntrySetFilter(addressentry, ip_input_filter, NULL); if (typeflag =3D=3D 1 && startstatictype =3D=3D 0) newtEntrySetFlags(addressentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); @@ -148,10 +169,10 @@ int changeaddress(struct keyvalue *kv, char *colour, in= t typeflag, newtFormAddComponent(networkform, addressentry); =09 /* Netmask */ - netmasklabel =3D newtTextbox(2, (typeflag ? 11 : 4) + 1, 18, 1, 0); + netmasklabel =3D newtTextbox(2, (typeflag ? 12 : 4) + 1, 18, 1, 0); newtTextboxSetText(netmasklabel, _("Network mask:")); strcpy(temp, "255.255.255.0"); findkey(kv, netmaskfield, temp); - netmaskentry =3D newtEntry(20, (typeflag ? 11 : 4) + 1, temp, 20, &netmaskr= esult, 0); + netmaskentry =3D newtEntry(20, (typeflag ? 12 : 4) + 1, temp, 20, &netmaskr= esult, 0); newtEntrySetFilter(netmaskentry, ip_input_filter, NULL); if (typeflag =3D=3D 1 && startstatictype =3D=3D 0)=20 newtEntrySetFlags(netmaskentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); @@ -162,11 +183,11 @@ int changeaddress(struct keyvalue *kv, char *colour, in= t typeflag, if (typeflag) { /* Gateway */ - gatewaylabel =3D newtTextbox(2, (typeflag ? 11 : 4) + 2, 18, 1, 0); + gatewaylabel =3D newtTextbox(2, (typeflag ? 12 : 4) + 2, 18, 1, 0); newtTextboxSetText(gatewaylabel, _("Gateway:")); strcpy(temp, ""); findkey(kv, gatewayfield, temp); - gatewayentry =3D newtEntry(20, (typeflag ? 11 : 4) + 2, temp, 20, &gateway= result, 0); + gatewayentry =3D newtEntry(20, (typeflag ? 12 : 4) + 2, temp, 20, &gateway= result, 0); newtEntrySetFilter(gatewayentry, ip_input_filter, NULL); if (typeflag =3D=3D 1 && startstatictype =3D=3D 0) newtEntrySetFlags(gatewayentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); @@ -175,8 +196,8 @@ int changeaddress(struct keyvalue *kv, char *colour, int = typeflag, } =20 /* Buttons. */ - ok =3D newtButton(8, (typeflag ? 15 : 7), _("OK")); - cancel =3D newtButton(26, (typeflag ? 15 : 7), _("Cancel")); + ok =3D newtButton(8, (typeflag ? 16 : 7), _("OK")); + cancel =3D newtButton(26, (typeflag ? 16 : 7), _("Cancel")); =20 newtFormAddComponents(networkform, ok, cancel, NULL); =20 @@ -237,6 +258,12 @@ int changeaddress(struct keyvalue *kv, char *colour, int= typeflag, { replacekeyvalue(kv, dhcphostnamefield, dhcphostnameresult); replacekeyvalue(kv, dhcpforcemtufield, dhcpforcemturesult); + + if (enablerapidcommit =3D=3D '*') + replacekeyvalue(kv, dhcprapidcommitfield, "on"); + else + replacekeyvalue(kv, dhcprapidcommitfield, "off"); + if (strcmp(type, "STATIC") !=3D 0) { replacekeyvalue(kv, addressfield, "0.0.0.0"); @@ -352,11 +379,13 @@ void networkdialogcallbacktype(newtComponent cm, void *= data) { newtEntrySetFlags(dhcphostnameentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_RESET); newtEntrySetFlags(dhcpforcemtuentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_RESET); + newtCheckboxSetFlags(dhcprapidcommitentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_= RESET); } else { newtEntrySetFlags(dhcphostnameentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); = =09 newtEntrySetFlags(dhcpforcemtuentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET); = =09 + newtCheckboxSetFlags(dhcprapidcommitentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_= SET); } newtRefresh(); newtDrawForm(networkform); hooks/post-receive -- IPFire 2.x development tree --===============6942196901438602075==--