The deleted patches do not apply any more, all other patches are updated to apply.
Fixes: #11363
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- dhcp/dhcp.nm | 4 +- dhcp/patches/0003-dhcp-errwarn-message.patch | 2 +- dhcp/patches/0004-dhcp-dhclient-options.patch | 140 ++----- .../0006-dhcp-dhclient-decline-backoff.patch | 4 +- dhcp/patches/0015-dhcp-capability.patch | 10 +- dhcp/patches/0021-dhcp-IPoIB-log-id.patch | 33 +- dhcp/patches/0025-dhcp-getifaddrs.patch | 429 --------------------- dhcp/patches/0027-dhcp-interval.patch | 25 -- 8 files changed, 64 insertions(+), 583 deletions(-) delete mode 100644 dhcp/patches/0025-dhcp-getifaddrs.patch delete mode 100644 dhcp/patches/0027-dhcp-interval.patch
diff --git a/dhcp/dhcp.nm b/dhcp/dhcp.nm index eafb0b0..cdc0673 100644 --- a/dhcp/dhcp.nm +++ b/dhcp/dhcp.nm @@ -4,7 +4,7 @@ ###############################################################################
name = dhcp -version = 4.3.5b1 +version = 4.3.6 release = 1
groups = Networking/Daemons @@ -20,7 +20,7 @@ description easier to administer a large network. end
-source_dl = ftp://ftp.isc.org/isc/dhcp/%{version}/ +source_dl = https://ftp.isc.org/isc/dhcp/%%7Bversion%7D/
build requires diff --git a/dhcp/patches/0003-dhcp-errwarn-message.patch b/dhcp/patches/0003-dhcp-errwarn-message.patch index f42d1e9..18f77cf 100644 --- a/dhcp/patches/0003-dhcp-errwarn-message.patch +++ b/dhcp/patches/0003-dhcp-errwarn-message.patch @@ -51,7 +51,7 @@ diff -up dhcp-4.3.5/omapip/errwarn.c.errwarn dhcp-4.3.5/omapip/errwarn.c - log_error ("than a configuration issue please read the section on submitting"); - log_error ("bugs on either our web page at www.isc.org or in the README file"); - log_error ("before submitting a bug. These pages explain the proper"); -- log_error ("process and the information we find helpful for debugging.."); +- log_error ("process and the information we find helpful for debugging."); + log_error ("This version of ISC DHCP is based on the release available"); + log_error ("on ftp.isc.org. Features have been added and other changes"); + log_error ("have been made to the base software release in order to make"); diff --git a/dhcp/patches/0004-dhcp-dhclient-options.patch b/dhcp/patches/0004-dhcp-dhclient-options.patch index 8f0dfe9..806ac63 100644 --- a/dhcp/patches/0004-dhcp-dhclient-options.patch +++ b/dhcp/patches/0004-dhcp-dhclient-options.patch @@ -1,6 +1,7 @@ -diff -up dhcp-4.3.4/client/clparse.c.options dhcp-4.3.4/client/clparse.c ---- dhcp-4.3.4/client/clparse.c.options 2016-03-22 14:16:51.000000000 +0100 -+++ dhcp-4.3.4/client/clparse.c 2016-04-29 12:06:13.485470579 +0200 +diff --git a/client/clparse.c b/client/clparse.c +index 03190c3..2033427 100644 +--- a/client/clparse.c ++++ b/client/clparse.c @@ -189,6 +189,7 @@ isc_result_t read_client_conf () /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) */ @@ -19,7 +20,7 @@ diff -up dhcp-4.3.4/client/clparse.c.options dhcp-4.3.4/client/clparse.c
void parse_client_statement (cfile, ip, config) struct parse *cfile; -@@ -817,6 +819,12 @@ void parse_client_statement (cfile, ip, +@@ -817,6 +819,12 @@ void parse_client_statement (cfile, ip, config) parse_lease_id_format(cfile); break;
@@ -32,10 +33,11 @@ diff -up dhcp-4.3.4/client/clparse.c.options dhcp-4.3.4/client/clparse.c
default: lose = 0; -diff -up dhcp-4.3.4/client/dhclient.8.options dhcp-4.3.4/client/dhclient.8 ---- dhcp-4.3.4/client/dhclient.8.options 2016-03-22 14:16:51.000000000 +0100 -+++ dhcp-4.3.4/client/dhclient.8 2016-04-29 11:59:50.446590077 +0200 -@@ -134,6 +134,33 @@ dhclient - Dynamic Host Configuration Pr +diff --git a/client/dhclient.8 b/client/dhclient.8 +index 24f8f12..aa2238d 100644 +--- a/client/dhclient.8 ++++ b/client/dhclient.8 +@@ -134,6 +134,33 @@ dhclient - Dynamic Host Configuration Protocol Client .B -w ] [ @@ -66,82 +68,13 @@ diff -up dhcp-4.3.4/client/dhclient.8.options dhcp-4.3.4/client/dhclient.8 +.I timeout +] +[ - .B -v + .B --dad-wait-time + .I seconds ] - [ -@@ -289,6 +316,69 @@ not to exit when it doesn't find any suc - program can then be used to notify the client when a network interface - has been added or removed, so that the client can attempt to configure an IP - address on that interface. -+ -+.TP -+.BI -B -+Set the BOOTP broadcast flag in request packets so servers will always -+broadcast replies. -+ -+.TP -+.BI -C\ <dhcp-client-identifier> -+Specify the dhcp-client-identifier option to send to the DHCP server. -+ -+.TP -+.BI -H\ <host-name> -+Specify the host-name option to send to the DHCP server. The host-name -+string only contains the client's hostname prefix, to which the server will -+append the ddns-domainname or domain-name options, if any, to derive the -+fully qualified domain name of the client. The -+.B -H -+option cannot be used with the -+.B -F -+option. -+ -+.TP -+.BI -F\ <fqdn.fqdn> -+Specify the fqdn.fqdn option to send to the DHCP server. This option cannot -+be used with the -+.B -H -+option. The fqdn.fqdn option must specify the complete domain name of the -+client host, which the server may use for dynamic DNS updates. -+ -+.TP -+.BI -V\ <vendor-class-identifier> -+Specify the vendor-class-identifier option to send to the DHCP server. -+ -+.TP -+.BI --request-options\ <option>[,<option>...] -+Specify the list of options the client is to request from the server. The -+option list must be a single string consisting of option names separated -+by at least one command and optional space characters. The default option -+list is: -+ -+.BR -+ subnet-mask, broadcast-address, time-offset, routers, -+.BR -+ domain-search, domain-name, domain-name-servers, host-name, -+.BR -+ nis-domain, nis-servers, ntp-servers, interface-mtu -+ -+.TP -+.B --request-options -+option does not append options to the default request, it overrides the -+default request list. Keep this in mind if you want to request an -+additional option besides the default request list. You will have to -+specify all option names for the -+.B --request-options -+parameter. -+ -+.TP -+.BI --timeout\ <timeout> -+Specify the time after which -+.B dhclient -+will decide that no DHCP servers can be contacted when no responses have been -+received. -+ - .TP - .BI -n - Do not configure any interfaces. This is most likely to be useful in -diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c ---- dhcp-4.3.4/client/dhclient.c.options 2016-03-22 14:16:51.000000000 +0100 -+++ dhcp-4.3.4/client/dhclient.c 2016-04-29 12:12:14.182364093 +0200 +diff --git a/client/dhclient.c b/client/dhclient.c +index dcf3f1a..270a960 100644 +--- a/client/dhclient.c ++++ b/client/dhclient.c @@ -40,6 +40,12 @@ #include <isc/file.h> #include <dns/result.h> @@ -155,7 +88,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c TIME default_lease_time = 43200; /* 12 hours... */ TIME max_lease_time = 86400; /* 24 hours... */
-@@ -100,6 +106,10 @@ char *mockup_relay = NULL; +@@ -101,6 +107,10 @@ char *mockup_relay = NULL;
char *progname = NULL;
@@ -166,7 +99,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c void run_stateless(int exit_mode, u_int16_t port);
static isc_result_t write_duid(struct data_string *duid); -@@ -177,7 +187,11 @@ usage(const char *sfmt, const char *sarg +@@ -179,7 +189,11 @@ usage(const char *sfmt, const char *sarg) " [-s server-addr] [-cf config-file]\n" " [-df duid-file] [-lf lease-file]\n" " [-pf pid-file] [--no-pid] [-e VAR=val]\n" @@ -179,7 +112,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c isc_file_basename(progname)); }
-@@ -214,6 +228,16 @@ main(int argc, char **argv) { +@@ -216,6 +230,16 @@ main(int argc, char **argv) { progname = argv[0]; #endif
@@ -196,7 +129,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c /* Initialize client globals. */ memset(&default_duid, 0, sizeof(default_duid));
-@@ -431,6 +455,88 @@ main(int argc, char **argv) { +@@ -442,6 +466,88 @@ main(int argc, char **argv) { strlen(PACKAGE_VERSION))); IGNORE_RET(write(STDERR_FILENO, "\n", 1)); exit(0); @@ -285,7 +218,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c } else if (argv[i][0] == '-') { usage("Unknown command: %s", argv[i]); } else if (interfaces_requested < 0) { -@@ -630,6 +736,156 @@ main(int argc, char **argv) { +@@ -641,6 +747,156 @@ main(int argc, char **argv) { /* Parse the dhclient.conf file. */ read_client_conf();
@@ -442,7 +375,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c /* Parse the lease database. */ read_client_leases();
-@@ -3067,7 +3323,8 @@ void make_discover (client, lease) +@@ -3092,7 +3348,8 @@ void make_discover (client, lease) client -> packet.xid = random (); client -> packet.secs = 0; /* filled in by send_discover. */
@@ -452,7 +385,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c client -> packet.flags = 0; else client -> packet.flags = htons (BOOTP_BROADCAST); -@@ -3152,7 +3409,9 @@ void make_request (client, lease) +@@ -3177,7 +3434,9 @@ void make_request (client, lease) } else { memset (&client -> packet.ciaddr, 0, sizeof client -> packet.ciaddr); @@ -463,7 +396,7 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c client -> packet.flags = 0; else client -> packet.flags = htons (BOOTP_BROADCAST); -@@ -3215,7 +3474,8 @@ void make_decline (client, lease) +@@ -3240,7 +3499,8 @@ void make_decline (client, lease) client -> packet.hops = 0; client -> packet.xid = client -> xid; client -> packet.secs = 0; /* Filled in by send_request. */ @@ -473,10 +406,11 @@ diff -up dhcp-4.3.4/client/dhclient.c.options dhcp-4.3.4/client/dhclient.c client -> packet.flags = 0; else client -> packet.flags = htons (BOOTP_BROADCAST); -diff -up dhcp-4.3.4/common/conflex.c.options dhcp-4.3.4/common/conflex.c ---- dhcp-4.3.4/common/conflex.c.options 2016-04-29 11:59:50.448590077 +0200 -+++ dhcp-4.3.4/common/conflex.c 2016-04-29 12:13:23.637342420 +0200 -@@ -832,6 +832,8 @@ intern(char *atom, enum dhcp_token dfv) +diff --git a/common/conflex.c b/common/conflex.c +index fe994ac..bdb4a52 100644 +--- a/common/conflex.c ++++ b/common/conflex.c +@@ -832,6 +832,8 @@ intern(char *atom, enum dhcp_token dfv) { if (!strcasecmp(atom+1, "ig-endian")) { return TOKEN_BIG_ENDIAN; } @@ -485,10 +419,11 @@ diff -up dhcp-4.3.4/common/conflex.c.options dhcp-4.3.4/common/conflex.c break; case 'c': if (!strcasecmp(atom + 1, "ase")) -diff -up dhcp-4.3.4/includes/dhcpd.h.options dhcp-4.3.4/includes/dhcpd.h ---- dhcp-4.3.4/includes/dhcpd.h.options 2016-04-29 11:59:50.448590077 +0200 -+++ dhcp-4.3.4/includes/dhcpd.h 2016-04-29 12:14:05.361329401 +0200 -@@ -1246,6 +1246,9 @@ struct client_config { +diff --git a/includes/dhcpd.h b/includes/dhcpd.h +index eab09a6..cfdac23 100644 +--- a/includes/dhcpd.h ++++ b/includes/dhcpd.h +@@ -1251,6 +1251,9 @@ struct client_config {
int lease_id_format; /* format for IDs in lease file, TOKEN_OCTAL or TOKEN_HEX */ @@ -498,9 +433,10 @@ diff -up dhcp-4.3.4/includes/dhcpd.h.options dhcp-4.3.4/includes/dhcpd.h };
/* Per-interface state used in the dhcp client... */ -diff -up dhcp-4.3.4/includes/dhctoken.h.options dhcp-4.3.4/includes/dhctoken.h ---- dhcp-4.3.4/includes/dhctoken.h.options 2016-04-29 11:59:50.449590076 +0200 -+++ dhcp-4.3.4/includes/dhctoken.h 2016-04-29 12:15:03.073300846 +0200 +diff --git a/includes/dhctoken.h b/includes/dhctoken.h +index 15bbd1c..b312e7a 100644 +--- a/includes/dhctoken.h ++++ b/includes/dhctoken.h @@ -373,7 +373,8 @@ enum dhcp_token { TOKEN_BIG_ENDIAN = 675, LEASE_ID_FORMAT = 676, diff --git a/dhcp/patches/0006-dhcp-dhclient-decline-backoff.patch b/dhcp/patches/0006-dhcp-dhclient-decline-backoff.patch index 645f931..1fc1c12 100644 --- a/dhcp/patches/0006-dhcp-dhclient-decline-backoff.patch +++ b/dhcp/patches/0006-dhcp-dhclient-decline-backoff.patch @@ -32,8 +32,8 @@ diff -up dhcp-4.3.4/client/dhclient.c.backoff dhcp-4.3.4/client/dhclient.c }
/* -@@ -1734,6 +1745,7 @@ void bind_lease (client) - "try (declined). Exiting."); +@@ -1734,5 +1745,6 @@ void bind_lease (client) +#endif exit(2); } else { + client -> state = S_DECLINED; diff --git a/dhcp/patches/0015-dhcp-capability.patch b/dhcp/patches/0015-dhcp-capability.patch index 4572c34..b689f7d 100644 --- a/dhcp/patches/0015-dhcp-capability.patch +++ b/dhcp/patches/0015-dhcp-capability.patch @@ -11,9 +11,9 @@ diff -up dhcp-4.3.4/client/dhclient.8.capability dhcp-4.3.4/client/dhclient.8 .B -B ] [ -@@ -318,6 +321,32 @@ has been added or removed, so that the c +@@ -318,6 +321,32 @@ program can then be used to notify the c + has been added or removed, so that the client can attempt to configure an IP address on that interface. - .TP +.BI -nc +Do not drop capabilities. @@ -41,9 +41,9 @@ diff -up dhcp-4.3.4/client/dhclient.8.capability dhcp-4.3.4/client/dhclient.8 +was not compiled with libcap-ng support. + +.TP - .BI -B - Set the BOOTP broadcast flag in request packets so servers will always - broadcast replies. + .BI -n + Do not configure any interfaces. This is most likely to be useful in + combination with the diff -up dhcp-4.3.4/client/dhclient.c.capability dhcp-4.3.4/client/dhclient.c --- dhcp-4.3.4/client/dhclient.c.capability 2016-04-29 12:19:40.691129307 +0200 +++ dhcp-4.3.4/client/dhclient.c 2016-04-29 12:21:07.620091930 +0200 diff --git a/dhcp/patches/0021-dhcp-IPoIB-log-id.patch b/dhcp/patches/0021-dhcp-IPoIB-log-id.patch index 97e9dd5..e0369bb 100644 --- a/dhcp/patches/0021-dhcp-IPoIB-log-id.patch +++ b/dhcp/patches/0021-dhcp-IPoIB-log-id.patch @@ -1,9 +1,8 @@ -diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c ---- dhcp-4.3.4/server/dhcp.c.IPoIB-log-id 2016-04-29 12:52:14.285061620 +0200 -+++ dhcp-4.3.4/server/dhcp.c 2016-04-29 12:53:59.535088020 +0200 -@@ -85,6 +85,42 @@ const int dhcp_type_name_max = ((sizeof - # define send_packet trace_packet_send - #endif +--- a/server/dhcp.c 2017-07-14 15:32:14.611104590 +0200 ++++ b/server/dhcp.c 2017-07-14 15:34:17.508858018 +0200 +@@ -87,6 +87,42 @@ + + static TIME leaseTimeCheck(TIME calculated, TIME alternate);
+char *print_client_identifier_from_packet (packet) + struct packet *packet; @@ -44,7 +43,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c void dhcp (struct packet *packet) { int ms_nulltp = 0; -@@ -127,9 +163,7 @@ dhcp (struct packet *packet) { +@@ -129,9 +165,7 @@
log_info("%s from %s via %s: %s", s, (packet->raw->htype @@ -55,7 +54,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c : "<no identifier>"), packet->raw->giaddr.s_addr ? inet_ntoa(packet->raw->giaddr) -@@ -326,9 +360,7 @@ void dhcpdiscover (packet, ms_nulltp) +@@ -328,9 +362,7 @@ #endif snprintf (msgbuf, sizeof msgbuf, "DHCPDISCOVER from %s %s%s%svia %s", (packet -> raw -> htype @@ -66,7 +65,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c : (lease ? print_hex_1(lease->uid_len, lease->uid, 60) : "<no identifier>")), -@@ -540,9 +572,7 @@ void dhcprequest (packet, ms_nulltp, ip_ +@@ -542,9 +574,7 @@ "DHCPREQUEST for %s%s from %s %s%s%svia %s", piaddr (cip), smbuf, (packet -> raw -> htype @@ -77,7 +76,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c : (lease ? print_hex_1(lease->uid_len, lease->uid, 60) : "<no identifier>")), -@@ -783,9 +813,7 @@ void dhcprelease (packet, ms_nulltp) +@@ -785,9 +815,7 @@ if ((oc = lookup_option (&dhcp_universe, packet -> options, DHO_DHCP_REQUESTED_ADDRESS))) { log_info ("DHCPRELEASE from %s specified requested-address.", @@ -88,7 +87,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c }
oc = lookup_option (&dhcp_universe, packet -> options, -@@ -877,9 +905,7 @@ void dhcprelease (packet, ms_nulltp) +@@ -879,9 +907,7 @@ "DHCPRELEASE of %s from %s %s%s%svia %s (%sfound)", cstr, (packet -> raw -> htype @@ -99,7 +98,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c : (lease ? print_hex_1(lease->uid_len, lease->uid, 60) : "<no identifier>")), -@@ -984,9 +1010,7 @@ void dhcpdecline (packet, ms_nulltp) +@@ -986,9 +1012,7 @@ "DHCPDECLINE of %s from %s %s%s%svia %s", piaddr (cip), (packet -> raw -> htype @@ -110,7 +109,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c : (lease ? print_hex_1(lease->uid_len, lease->uid, 60) : "<no identifier>")), -@@ -1683,8 +1707,7 @@ void dhcpinform (packet, ms_nulltp) +@@ -1707,8 +1731,7 @@ /* Report what we're sending. */ snprintf(msgbuf, sizeof msgbuf, "DHCPACK to %s (%s) via", piaddr(cip), (packet->raw->htype && packet->raw->hlen) ? @@ -120,7 +119,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c "<no client hardware address>"); log_info("%s %s", msgbuf, gip.len ? piaddr(gip) : packet->interface->name); -@@ -1862,9 +1885,7 @@ void nak_lease (packet, cip, network_gro +@@ -1886,9 +1909,7 @@ #endif log_info ("DHCPNAK on %s to %s via %s", piaddr (*cip), @@ -131,7 +130,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c packet -> raw -> giaddr.s_addr ? inet_ntoa (packet -> raw -> giaddr) : packet -> interface -> name); -@@ -3859,7 +3880,7 @@ void dhcp_reply (lease) +@@ -3897,7 +3918,7 @@ ? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER") : "BOOTREPLY"), piaddr (lease -> ip_addr), @@ -140,7 +139,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c ? print_hw_addr (lease -> hardware_addr.hbuf [0], lease -> hardware_addr.hlen - 1, &lease -> hardware_addr.hbuf [1]) -@@ -4408,10 +4429,7 @@ int find_lease (struct lease **lp, +@@ -4450,10 +4471,7 @@ if (uid_lease) { if (uid_lease->binding_state == FTS_ACTIVE) { log_error ("client %s has duplicate%s on %s", @@ -152,7 +151,7 @@ diff -up dhcp-4.3.4/server/dhcp.c.IPoIB-log-id dhcp-4.3.4/server/dhcp.c " leases", (ip_lease -> subnet -> shared_network -> name)); -@@ -4578,9 +4596,7 @@ int find_lease (struct lease **lp, +@@ -4620,9 +4638,7 @@ log_error("uid lease %s for client %s is duplicate " "on %s", piaddr(uid_lease->ip_addr), diff --git a/dhcp/patches/0025-dhcp-getifaddrs.patch b/dhcp/patches/0025-dhcp-getifaddrs.patch deleted file mode 100644 index 586c3b0..0000000 --- a/dhcp/patches/0025-dhcp-getifaddrs.patch +++ /dev/null @@ -1,429 +0,0 @@ -diff -up dhcp-4.3.5b1/common/discover.c.getifaddrs dhcp-4.3.5b1/common/discover.c ---- dhcp-4.3.5b1/common/discover.c.getifaddrs 2016-09-12 17:10:39.585374741 +0200 -+++ dhcp-4.3.5b1/common/discover.c 2016-09-12 17:15:56.160628636 +0200 -@@ -373,392 +373,13 @@ end_iface_scan(struct iface_conf_list *i - ifaces->sock = -1; - } - --#elif __linux /* !HAVE_SIOCGLIFCONF */ --/* -- * Linux support -- * ------------- -- * -- * In Linux, we use the /proc pseudo-filesystem to get information -- * about interfaces, along with selected ioctl() calls. -- * -- * Linux low level access is documented in the netdevice man page. -- */ -- --/* -- * Structure holding state about the scan. -- */ --struct iface_conf_list { -- int sock; /* file descriptor used to get information */ -- FILE *fp; /* input from /proc/net/dev */ --#ifdef DHCPv6 -- FILE *fp6; /* input from /proc/net/if_inet6 */ --#endif --}; -- --/* -- * Structure used to return information about a specific interface. -- */ --struct iface_info { -- char name[IFNAMSIZ]; /* name of the interface, e.g. "eth0" */ -- struct sockaddr_storage addr; /* address information */ -- isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ --}; -- --/* -- * Start a scan of interfaces. -- * -- * The iface_conf_list structure maintains state for this process. -- */ --int --begin_iface_scan(struct iface_conf_list *ifaces) { -- char buf[IF_LINE_LENGTH]; -- int len; -- int i; -- -- ifaces->fp = fopen("/proc/net/dev", "r"); -- if (ifaces->fp == NULL) { -- log_error("Error opening '/proc/net/dev' to list interfaces"); -- return 0; -- } -- -- /* -- * The first 2 lines are header information, so read and ignore them. -- */ -- for (i=0; i<2; i++) { -- if (fgets(buf, sizeof(buf), ifaces->fp) == NULL) { -- log_error("Error reading headers from '/proc/net/dev'"); -- fclose(ifaces->fp); -- ifaces->fp = NULL; -- return 0; -- } -- len = strlen(buf); -- if ((len <= 0) || (buf[len-1] != '\n')) { -- log_error("Bad header line in '/proc/net/dev'"); -- fclose(ifaces->fp); -- ifaces->fp = NULL; -- return 0; -- } -- } -- -- ifaces->sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -- if (ifaces->sock < 0) { -- log_error("Error creating socket to list interfaces; %m"); -- fclose(ifaces->fp); -- ifaces->fp = NULL; -- return 0; -- } -- --#ifdef DHCPv6 -- if (local_family == AF_INET6) { -- ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); -- if (ifaces->fp6 == NULL) { -- log_error("Error opening '/proc/net/if_inet6' to " -- "list IPv6 interfaces; %m"); -- close(ifaces->sock); -- ifaces->sock = -1; -- fclose(ifaces->fp); -- ifaces->fp = NULL; -- return 0; -- } -- } --#endif -- -- return 1; --} -- --/* -- * Read our IPv4 interfaces from /proc/net/dev. -- * -- * The file looks something like this: -- * -- * Inter-| Receive ... -- * face |bytes packets errs drop fifo frame ... -- * lo: 1580562 4207 0 0 0 0 ... -- * eth0: 0 0 0 0 0 0 ... -- * eth1:1801552440 37895 0 14 0 ... -- * -- * We only care about the interface name, which is at the start of -- * each line. -- * -- * We use an ioctl() to get the address and flags for each interface. -- */ --static int --next_iface4(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { -- char buf[IF_LINE_LENGTH]; -- int len; -- char *p; -- char *name; -- struct ifreq tmp; -- -- /* -- * Loop exits when we find an interface that has an address, or -- * when we run out of interfaces. -- */ -- for (;;) { -- do { -- /* -- * Read the next line in the file. -- */ -- if (fgets(buf, sizeof(buf), ifaces->fp) == NULL) { -- if (ferror(ifaces->fp)) { -- *err = 1; -- log_error("Error reading interface " -- "information"); -- } else { -- *err = 0; -- } -- return 0; -- } -- -- /* -- * Make sure the line is a nice, -- * newline-terminated line. -- */ -- len = strlen(buf); -- if ((len <= 0) || (buf[len-1] != '\n')) { -- log_error("Bad line reading interface " -- "information"); -- *err = 1; -- return 0; -- } -- -- /* -- * Figure out our name. -- */ -- p = strrchr(buf, ':'); -- if (p == NULL) { -- log_error("Bad line reading interface " -- "information (no colon)"); -- *err = 1; -- return 0; -- } -- *p = '\0'; -- name = buf; -- while (isspace(*name)) { -- name++; -- } -- -- /* -- * Copy our name into our interface structure. -- */ -- len = p - name; -- if (len >= sizeof(info->name)) { -- *err = 1; -- log_error("Interface name '%s' too long", name); -- return 0; -- } -- strncpy(info->name, name, sizeof(info->name) - 1); -- --#ifdef ALIAS_NAMED_PERMUTED -- /* interface aliases look like "eth0:1" or "wlan1:3" */ -- s = strchr(info->name, ':'); -- if (s != NULL) { -- *s = '\0'; -- } --#endif -- --#ifdef SKIP_DUMMY_INTERFACES -- } while (strncmp(info->name, "dummy", 5) == 0); --#else -- } while (0); --#endif -- -- memset(&tmp, 0, sizeof(tmp)); -- strncpy(tmp.ifr_name, name, sizeof(tmp.ifr_name) - 1); -- if (ioctl(ifaces->sock, SIOCGIFADDR, &tmp) < 0) { -- if (errno == EADDRNOTAVAIL) { -- continue; -- } -- log_error("Error getting interface address " -- "for '%s'; %m", name); -- *err = 1; -- return 0; -- } -- memcpy(&info->addr, &tmp.ifr_addr, sizeof(tmp.ifr_addr)); -- -- memset(&tmp, 0, sizeof(tmp)); -- strncpy(tmp.ifr_name, name, sizeof(tmp.ifr_name) - 1); -- if (ioctl(ifaces->sock, SIOCGIFFLAGS, &tmp) < 0) { -- log_error("Error getting interface flags for '%s'; %m", -- name); -- *err = 1; -- return 0; -- } -- info->flags = tmp.ifr_flags; -- -- *err = 0; -- return 1; -- } --} -- --#ifdef DHCPv6 --/* -- * Read our IPv6 interfaces from /proc/net/if_inet6. -- * -- * The file looks something like this: -- * -- * fe80000000000000025056fffec00008 05 40 20 80 vmnet8 -- * 00000000000000000000000000000001 01 80 10 80 lo -- * fe80000000000000025056fffec00001 06 40 20 80 vmnet1 -- * 200108881936000202166ffffe497d9b 03 40 00 00 eth1 -- * fe8000000000000002166ffffe497d9b 03 40 20 80 eth1 -- * -- * We get IPv6 address from the start, the interface name from the end, -- * and ioctl() to get flags. -- */ --static int --next_iface6(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { -- char buf[IF_LINE_LENGTH]; -- int len; -- char *p; -- char *name; -- int i; -- struct sockaddr_in6 addr; -- struct ifreq tmp; -- -- do { -- /* -- * Read the next line in the file. -- */ -- if (fgets(buf, sizeof(buf), ifaces->fp6) == NULL) { -- if (ferror(ifaces->fp6)) { -- *err = 1; -- log_error("Error reading IPv6 " -- "interface information"); -- } else { -- *err = 0; -- } -- return 0; -- } -- -- /* -- * Make sure the line is a nice, newline-terminated line. -- */ -- len = strlen(buf); -- if ((len <= 0) || (buf[len-1] != '\n')) { -- log_error("Bad line reading IPv6 " -- "interface information"); -- *err = 1; -- return 0; -- } -- -- /* -- * Figure out our name. -- */ -- buf[--len] = '\0'; -- p = strrchr(buf, ' '); -- if (p == NULL) { -- log_error("Bad line reading IPv6 interface " -- "information (no space)"); -- *err = 1; -- return 0; -- } -- name = p+1; -- -- /* -- * Copy our name into our interface structure. -- */ -- len = strlen(name); -- if (len >= sizeof(info->name)) { -- *err = 1; -- log_error("IPv6 interface name '%s' too long", name); -- return 0; -- } -- strncpy(info->name, name, sizeof(info->name) - 1); -- --#ifdef SKIP_DUMMY_INTERFACES -- } while (strncmp(info->name, "dummy", 5) == 0); --#else -- } while (0); --#endif -- -- /* -- * Double-check we start with the IPv6 address. -- */ -- for (i=0; i<32; i++) { -- if (!isxdigit(buf[i]) || isupper(buf[i])) { -- *err = 1; -- log_error("Bad line reading IPv6 interface address " -- "for '%s'", name); -- return 0; -- } -- } -- -- /* -- * Load our socket structure. -- */ -- memset(&addr, 0, sizeof(addr)); -- addr.sin6_family = AF_INET6; -- for (i=0; i<16; i++) { -- unsigned char byte; -- static const char hex[] = "0123456789abcdef"; -- byte = ((index(hex, buf[i * 2]) - hex) << 4) | -- (index(hex, buf[i * 2 + 1]) - hex); -- addr.sin6_addr.s6_addr[i] = byte; -- } -- memcpy(&info->addr, &addr, sizeof(addr)); -- -- /* -- * Get our flags. -- */ -- memset(&tmp, 0, sizeof(tmp)); -- strncpy(tmp.ifr_name, name, sizeof(tmp.ifr_name) - 1); -- if (ioctl(ifaces->sock, SIOCGIFFLAGS, &tmp) < 0) { -- log_error("Error getting interface flags for '%s'; %m", name); -- *err = 1; -- return 0; -- } -- info->flags = tmp.ifr_flags; -- -- *err = 0; -- return 1; --} --#endif /* DHCPv6 */ -- --/* -- * Retrieve the next interface. -- * -- * Returns information in the info structure. -- * Sets err to 1 if there is an error, otherwise 0. -- */ --int --next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { -- memset(info, 0, sizeof(struct iface_info)); -- if (next_iface4(info, err, ifaces)) { -- return 1; -- } --#ifdef DHCPv6 -- if (!(*err)) { -- if (local_family == AF_INET6) -- return next_iface6(info, err, ifaces); -- } --#endif -- return 0; --} -- --/* -- * End scan of interfaces. -- */ --void --end_iface_scan(struct iface_conf_list *ifaces) { -- fclose(ifaces->fp); -- ifaces->fp = NULL; -- close(ifaces->sock); -- ifaces->sock = -1; --#ifdef DHCPv6 -- if (local_family == AF_INET6) { -- fclose(ifaces->fp6); -- ifaces->fp6 = NULL; -- } --#endif --} - #else - - /* - * BSD support - * ----------- - * -- * FreeBSD, NetBSD, OpenBSD, and OS X all have the getifaddrs() -+ * FreeBSD, NetBSD, OpenBSD, OS X and Linux all have the getifaddrs() - * function. - * - * The getifaddrs() man page describes the use. -@@ -806,6 +427,8 @@ begin_iface_scan(struct iface_conf_list - */ - int - next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { -+ size_t sa_len = 0; -+ - if (ifaces->next == NULL) { - *err = 0; - return 0; -@@ -818,8 +441,20 @@ next_iface(struct iface_info *info, int - } - memset(info, 0, sizeof(struct iface_info)); - strncpy(info->name, ifaces->next->ifa_name, sizeof(info->name) - 1); -- memcpy(&info->addr, ifaces->next->ifa_addr, -- ifaces->next->ifa_addr->sa_len); -+ -+ memset(&info->addr, 0 , sizeof(info->addr)); -+ -+ if (ifaces->next->ifa_addr != NULL) { -+#ifdef HAVE_SA_LEN -+ sa_len = ifaces->next->ifa_addr->sa_len; -+#else -+ if (ifaces->next->ifa_addr->sa_family == AF_INET) -+ sa_len = sizeof(struct sockaddr_in); -+ else if (ifaces->next->ifa_addr->sa_family == AF_INET6) -+ sa_len = sizeof(struct sockaddr_in6); -+#endif -+ memcpy(&info->addr, ifaces->next->ifa_addr, sa_len); -+ } - info->flags = ifaces->next->ifa_flags; - ifaces->next = ifaces->next->ifa_next; - *err = 0; diff --git a/dhcp/patches/0027-dhcp-interval.patch b/dhcp/patches/0027-dhcp-interval.patch deleted file mode 100644 index 8fff47c..0000000 --- a/dhcp/patches/0027-dhcp-interval.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -up dhcp-4.3.0a1/common/dispatch.c.interval dhcp-4.3.0a1/common/dispatch.c ---- dhcp-4.3.0a1/common/dispatch.c.interval 2013-12-20 13:51:14.385260622 +0100 -+++ dhcp-4.3.0a1/common/dispatch.c 2013-12-20 13:51:14.493259116 +0100 -@@ -343,7 +343,20 @@ void add_timeout (when, where, what, ref - q->next = timeouts; - timeouts = q; - -- isc_interval_set(&interval, sec & DHCP_SEC_MAX, usec * 1000); -+ /* isc_time_nowplusinterval() is not safe with 64-bit time_t and will -+ * return an error for sufficiently large intervals. We have to limit -+ * the interval to INT_MAX or less to ensure the interval doesn't -+ * overflow 32 bits, since the returned isc_time_t fields are -+ * 32-bit unsigned ints. -+ * -+ * HACK: The 9 is a magic number of seconds, since some time may have -+ * gone by since the last call to gettimeofday() and the one in -+ * isc_time_nowplusinterval(). -+ */ -+ if (sec > TIME_MAX) -+ sec = TIME_MAX - 9; -+ -+ isc_interval_set(&interval, sec, usec * 1000); - status = isc_time_nowplusinterval(&expires, &interval); - if (status != ISC_R_SUCCESS) { - /*