Browse Source

isc-dhcp: bump version to latest and fix build issues

Version bumped to 4.3.5.  Separated out compile/install steps since
compiling with $DESTDIR yields bogus results. Removed rfc-3527 patch
as something similar (better) is now upstream (well, more complete
error checking anyway). Change relay scripts from '-l ifname' to
'-U ifname' to correspond to upstream changes.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
lilik-openwrt-22.03
Philip Prindeville 8 years ago
parent
commit
ac531a9c54
4 changed files with 16 additions and 106 deletions
  1. +14
    -4
      net/isc-dhcp/Makefile
  2. +1
    -1
      net/isc-dhcp/files/dhcrelay4.init
  3. +1
    -1
      net/isc-dhcp/files/dhcrelay6.init
  4. +0
    -100
      net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch

+ 14
- 4
net/isc-dhcp/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=isc-dhcp
UPSTREAM_NAME:=dhcp
PKG_VERSION:=4.3.3
PKG_VERSION:=4.3.5
PKG_RELEASE:=1
PKG_LICENSE:=BSD-3-Clause
@ -17,8 +17,11 @@ PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Antony Antony <antony@phenome.org>
PKG_SOURCE:=$(UPSTREAM_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/$(PKG_VERSION)
PKG_MD5SUM:=c5577b09c9017cdd319a11ff6364268e
PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/$(PKG_VERSION) \
http://ftp.funet.fi/pub/mirrors/ftp.isc.org/isc/dhcp/$(PKG_VERSION) \
http://ftp.iij.ad.jp/pub/network/isc/dhcp/$(PKG_VERSION)
PKG_MD5SUM:=2b5e5b2fa31c2e27e487039d86f83d3f
PKG_HASH:=eb95936bf15d2393c55dd505bc527d1d4408289cec5a9fa8abb99f7577e7f954
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
@ -170,6 +173,13 @@ ifeq ($(BUILD_VARIANT),ipv6)
endif
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
BUILD_CC="$(HOSTCC_NOCACHE)" \
CROSS_CC="$(TARGET_CC)" \
host_alias="$(GNU_TARGET_NAME)" \
target_alias="$(GNU_TARGET_NAME)" \
build_alias="$(GNU_HOST_NAME)" \
all
$(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" \
BUILD_CC="$(HOSTCC_NOCACHE)" \
@ -177,7 +187,7 @@ define Build/Compile
host_alias="$(GNU_TARGET_NAME)" \
target_alias="$(GNU_TARGET_NAME)" \
build_alias="$(GNU_HOST_NAME)" \
all install-exec
install-exec
endef
define Package/isc-dhcp-relay-$(BUILD_VARIANT)/install


+ 1
- 1
net/isc-dhcp/files/dhcrelay4.init View File

@ -30,7 +30,7 @@ start() {
local link_selection
config_get link_selection ipv4 link_selection
if network_get_device ifname "$link_selection"; then
append args "-l $ifname"
append args "-U $ifname"
fi
# relay mode


+ 1
- 1
net/isc-dhcp/files/dhcrelay6.init View File

@ -28,7 +28,7 @@ start() {
if [ -n "$relay_lowers" ]; then
local relay_lower
for relay_lower in $relay_lowers; do
append relay_lower_args "-l $relay_lower"
append relay_lower_args "-U $relay_lower"
done
fi


+ 0
- 100
net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch View File

@ -1,100 +0,0 @@
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -60,6 +60,7 @@
int client_packet_errors = 0; /* Errors sending packets to clients. */
int add_agent_options = 0; /* If nonzero, add relay agent options. */
+int add_rfc3527_suboption = 0; /* If nonzero, add RFC3527 link selection sub-option. */
int agent_option_errors = 0; /* Number of packets forwarded without
agent options because there was no room. */
@@ -99,6 +100,8 @@
struct sockaddr_in to;
} *servers;
+struct interface_info *uplink;
+
#ifdef DHCPv6
struct stream_list {
struct stream_list *next;
@@ -147,6 +150,7 @@
" [-pf <pid-file>] [--no-pid]\n"\
" [-m append|replace|forward|discard]\n" \
" [-i interface0 [ ... -i interfaceN]\n" \
+" [-l interface]\n" \
" server0 [ ... serverN]\n\n" \
" dhcrelay -6 [-d] [-q] [-I] [-c <hops>] [-p <port>]\n" \
" [-pf <pid-file>] [--no-pid]\n" \
@@ -161,6 +165,7 @@
" [-pf <pid-file>] [--no-pid]\n" \
" [-m append|replace|forward|discard]\n" \
" [-i interface0 [ ... -i interfaceN]\n" \
+" [-l interface]\n" \
" server0 [ ... serverN]\n\n"
#endif
@@ -325,6 +330,20 @@
agent_relay_mode = discard;
} else
usage();
+ } else if (!strcmp (argv [i], "-l")) {
+ add_agent_options = 1;
+ add_rfc3527_suboption = 1;
+ if (++i == argc)
+ usage();
+
+ status = interface_allocate(&uplink, MDL);
+ if (status != ISC_R_SUCCESS)
+ log_fatal("%s: interface_allocate: %s",
+ argv[i],
+ isc_result_totext(status));
+ strcpy(uplink->name, argv[i]);
+ interface_snorf(uplink, INTERFACE_REQUESTED);
+ //interface_dereference(&uplink, MDL);
} else if (!strcmp(argv[i], "-D")) {
#ifdef DHCPv6
if (local_family_set && (local_family == AF_INET6)) {
@@ -711,12 +730,17 @@
ip->addresses[0])))
return;
+ /* RFC3527: Replace giaddr address by uplink address. The original
+ * giaddr will be used in the link selection sub-option */
+ if (add_rfc3527_suboption)
+ packet->giaddr = uplink->addresses[0];
+
/* If giaddr is not already set, Set it so the server can
figure out what net it's from and so that we can later
forward the response to the correct net. If it's already
set, the response will be sent directly to the relay agent
that set giaddr, so we won't see it. */
- if (!packet->giaddr.s_addr)
+ else if (!packet->giaddr.s_addr)
packet->giaddr = ip->addresses[0];
if (packet->hops < max_hop_count)
packet->hops = packet->hops + 1;
@@ -1090,6 +1114,9 @@
optlen += ip->remote_id_len + 2; /* RAI_REMOTE_ID + len */
}
+ if (add_rfc3527_suboption)
+ optlen += 6;
+
/* We do not support relay option fragmenting(multiple options to
* support an option data exceeding 255 bytes).
*/
@@ -1121,6 +1148,14 @@
memcpy(sp, ip->remote_id, ip->remote_id_len);
sp += ip->remote_id_len;
}
+
+ if (add_rfc3527_suboption) {
+ *sp++ = RAI_LINK_SELECT;
+ *sp++ = 4u;
+ memcpy(sp, &giaddr.s_addr, 4);
+ sp += 4;
+ log_debug ("RFC3527 link selection sub-option added: %s", inet_ntoa(giaddr));
+ }
} else {
++agent_option_errors;
log_error("No room in packet (used %d of %d) "

Loading…
Cancel
Save