]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/dhcp/dhcp-lpf-ib.patch
aarch64: Fix rootfile for Python
[ipfire-2.x.git] / src / patches / dhcp / dhcp-lpf-ib.patch
CommitLineData
c1e9ba67
MF
1diff -up dhcp-4.3.1b1/client/dhclient.c.bmgpWV dhcp-4.3.1b1/client/dhclient.c
2--- dhcp-4.3.1b1/client/dhclient.c.bmgpWV 2014-07-10 17:50:26.922402550 +0200
3+++ dhcp-4.3.1b1/client/dhclient.c 2014-07-10 17:53:43.629623477 +0200
4@@ -114,6 +114,8 @@ static int check_domain_name_list(const
78ab9b04
MT
5 static int check_option_values(struct universe *universe, unsigned int opt,
6 const char *ptr, size_t len);
7
8+static void setup_ib_interface(struct interface_info *ip);
9+
c1e9ba67 10 #ifndef UNIT_TEST
78ab9b04
MT
11 int
12 main(int argc, char **argv) {
c1e9ba67 13@@ -937,6 +939,13 @@ main(int argc, char **argv) {
78ab9b04
MT
14 }
15 srandom(seed + cur_time + (unsigned)getpid());
16
17+ /* Setup specific Infiniband options */
18+ for (ip = interfaces; ip; ip = ip->next) {
19+ if (ip->client &&
20+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
21+ setup_ib_interface(ip);
22+ }
23+ }
c1e9ba67
MF
24
25 /*
26 * Establish a default DUID. We always do so for v6 and
27@@ -1230,6 +1239,29 @@ int find_subnet (struct subnet **sp,
78ab9b04
MT
28 return 0;
29 }
30
31+static void setup_ib_interface(struct interface_info *ip)
32+{
33+ struct group *g;
34+
35+ /* Set the broadcast flag */
36+ ip->client->config->bootp_broadcast_always = 1;
37+
38+ /*
39+ * Find out if a dhcp-client-identifier option was specified either
40+ * in the config file or on the command line
41+ */
42+ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) {
43+ if ((g->statements != NULL) &&
44+ (strcmp(g->statements->data.option->option->name,
45+ "dhcp-client-identifier") == 0)) {
46+ return;
47+ }
48+ }
49+
50+ /* No client ID specified */
51+ log_fatal("dhcp-client-identifier must be specified for InfiniBand");
52+}
53+
54 /* Individual States:
55 *
56 * Each routine is called from the dhclient_state_machine() in one of
c1e9ba67
MF
57diff -up dhcp-4.3.1b1/common/bpf.c.bmgpWV dhcp-4.3.1b1/common/bpf.c
58--- dhcp-4.3.1b1/common/bpf.c.bmgpWV 2014-07-10 17:48:03.797424616 +0200
59+++ dhcp-4.3.1b1/common/bpf.c 2014-07-10 17:52:57.705272295 +0200
60@@ -199,11 +199,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
78ab9b04
MT
61 BPF_STMT(BPF_RET+BPF_K, 0),
62 };
63
64+/* Packet filter program for DHCP over Infiniband.
65+ *
66+ * XXX
67+ * Changes to the filter program may require changes to the constant offsets
68+ * used in lpf_gen_filter_setup to patch the port in the BPF program!
69+ * XXX
70+ */
71+struct bpf_insn dhcp_ib_bpf_filter [] = {
72+ /* Packet filter for Infiniband */
73+ /* Make sure it's a UDP packet... */
74+ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9),
75+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6),
76+
77+ /* Make sure this isn't a fragment... */
78+ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6),
79+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0),
80+
81+ /* Get the IP header length... */
82+ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0),
83+
84+ /* Make sure it's to the right port... */
85+ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2),
86+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1),
87+
88+ /* If we passed all the tests, ask for the whole packet. */
89+ BPF_STMT(BPF_RET + BPF_K, (u_int)-1),
90+
91+ /* Otherwise, drop it. */
92+ BPF_STMT(BPF_RET + BPF_K, 0),
93+};
94+
95 #if defined (DEC_FDDI)
96 struct bpf_insn *bpf_fddi_filter;
97 #endif
98
99 int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn);
100+int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn);
101+
102 #if defined (HAVE_TR_SUPPORT)
103 struct bpf_insn dhcp_bpf_tr_filter [] = {
104 /* accept all token ring packets due to variable length header */
c1e9ba67
MF
105diff -up dhcp-4.3.1b1/common/lpf.c.bmgpWV dhcp-4.3.1b1/common/lpf.c
106--- dhcp-4.3.1b1/common/lpf.c.bmgpWV 2014-07-10 17:48:03.797424616 +0200
107+++ dhcp-4.3.1b1/common/lpf.c 2014-07-10 17:52:57.706272281 +0200
108@@ -46,6 +46,17 @@
109 #if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR)
110 #include <sys/ioctl.h>
78ab9b04
MT
111 #include <net/if.h>
112+#include <ifaddrs.h>
c1e9ba67 113+
78ab9b04
MT
114+/* Default broadcast address for IPoIB */
115+static unsigned char default_ib_bcast_addr[20] = {
116+ 0x00, 0xff, 0xff, 0xff,
117+ 0xff, 0x12, 0x40, 0x1b,
118+ 0x00, 0x00, 0x00, 0x00,
119+ 0x00, 0x00, 0x00, 0x00,
120+ 0xff, 0xff, 0xff, 0xff
121+};
122+
c1e9ba67
MF
123 #endif
124
125 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
126@@ -92,10 +103,21 @@ int if_register_lpf (info)
78ab9b04
MT
127 struct sockaddr common;
128 } sa;
129 struct ifreq ifr;
130+ int type;
131+ int protocol;
132
133 /* Make an LPF socket. */
134- if ((sock = socket(PF_PACKET, SOCK_RAW,
135- htons((short)ETH_P_ALL))) < 0) {
136+ get_hw_addr(info);
137+
138+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
139+ type = SOCK_DGRAM;
140+ protocol = ETHERTYPE_IP;
141+ } else {
142+ type = SOCK_RAW;
143+ protocol = ETH_P_ALL;
144+ }
145+
146+ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) {
147 if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
148 errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
149 errno == EAFNOSUPPORT || errno == EINVAL) {
c1e9ba67 150@@ -118,6 +140,7 @@ int if_register_lpf (info)
78ab9b04
MT
151 /* Bind to the interface name */
152 memset (&sa, 0, sizeof sa);
153 sa.ll.sll_family = AF_PACKET;
154+ sa.ll.sll_protocol = htons(protocol);
155 sa.ll.sll_ifindex = ifr.ifr_ifindex;
156 if (bind (sock, &sa.common, sizeof sa)) {
157 if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
c1e9ba67 158@@ -133,8 +156,6 @@ int if_register_lpf (info)
78ab9b04
MT
159 log_fatal ("Bind socket to interface: %m");
160 }
161
162- get_hw_addr(info->name, &info->hw_address);
163-
164 return sock;
165 }
166 #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */
c1e9ba67 167@@ -189,6 +210,8 @@ void if_deregister_send (info)
78ab9b04
MT
168 in bpf includes... */
169 extern struct sock_filter dhcp_bpf_filter [];
170 extern int dhcp_bpf_filter_len;
171+extern struct sock_filter dhcp_ib_bpf_filter [];
172+extern int dhcp_ib_bpf_filter_len;
173
174 #if defined (HAVE_TR_SUPPORT)
175 extern struct sock_filter dhcp_bpf_tr_filter [];
c1e9ba67 176@@ -206,11 +229,13 @@ void if_register_receive (info)
78ab9b04
MT
177 /* Open a LPF device and hang it on this interface... */
178 info -> rfdesc = if_register_lpf (info);
179
180- val = 1;
181- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
182- sizeof val) < 0) {
183- if (errno != ENOPROTOOPT)
184- log_fatal ("Failed to set auxiliary packet data: %m");
185+ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) {
186+ val = 1;
187+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA,
188+ &val, sizeof val) < 0) {
189+ if (errno != ENOPROTOOPT)
190+ log_fatal ("Failed to set auxiliary packet data: %m");
191+ }
192 }
193
194 #if defined (HAVE_TR_SUPPORT)
c1e9ba67 195@@ -256,15 +281,28 @@ static void lpf_gen_filter_setup (info)
78ab9b04
MT
196
197 memset(&p, 0, sizeof(p));
198
199- /* Set up the bpf filter program structure. This is defined in
200- bpf.c */
201- p.len = dhcp_bpf_filter_len;
202- p.filter = dhcp_bpf_filter;
203-
204- /* Patch the server port into the LPF program...
205- XXX changes to filter program may require changes
206- to the insn number(s) used below! XXX */
207- dhcp_bpf_filter [8].k = ntohs ((short)local_port);
208+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
209+ /* Set up the bpf filter program structure. */
210+ p.len = dhcp_ib_bpf_filter_len;
211+ p.filter = dhcp_ib_bpf_filter;
212+
213+ /* Patch the server port into the LPF program...
214+ XXX
215+ changes to filter program may require changes
216+ to the insn number(s) used below!
217+ XXX */
218+ dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port);
219+ } else {
220+ /* Set up the bpf filter program structure.
221+ This is defined in bpf.c */
222+ p.len = dhcp_bpf_filter_len;
223+ p.filter = dhcp_bpf_filter;
224+
225+ /* Patch the server port into the LPF program...
226+ XXX changes to filter program may require changes
227+ to the insn number(s) used below! XXX */
228+ dhcp_bpf_filter [8].k = ntohs ((short)local_port);
229+ }
230
231 if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p,
232 sizeof p) < 0) {
c1e9ba67 233@@ -321,6 +359,54 @@ static void lpf_tr_filter_setup (info)
78ab9b04
MT
234 #endif /* USE_LPF_RECEIVE */
235
236 #ifdef USE_LPF_SEND
237+ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto)
238+ struct interface_info *interface;
239+ struct packet *packet;
240+ struct dhcp_packet *raw;
241+ size_t len;
242+ struct in_addr from;
243+ struct sockaddr_in *to;
244+ struct hardware *hto;
245+{
246+ unsigned ibufp = 0;
247+ double ih [1536 / sizeof (double)];
248+ unsigned char *buf = (unsigned char *)ih;
249+ ssize_t result;
250+
251+ union sockunion {
252+ struct sockaddr sa;
253+ struct sockaddr_ll sll;
254+ struct sockaddr_storage ss;
255+ } su;
256+
257+ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr,
258+ to->sin_addr.s_addr, to->sin_port,
259+ (unsigned char *)raw, len);
260+ memcpy (buf + ibufp, raw, len);
261+
262+ memset(&su, 0, sizeof(su));
263+ su.sll.sll_family = AF_PACKET;
264+ su.sll.sll_protocol = htons(ETHERTYPE_IP);
265+
266+ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) {
267+ errno = ENOENT;
268+ log_error ("send_packet_ib: %m - failed to get if index");
269+ return -1;
270+ }
271+
272+ su.sll.sll_hatype = htons(HTYPE_INFINIBAND);
273+ su.sll.sll_halen = sizeof(interface->bcast_addr);
274+ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20);
275+
276+ result = sendto(interface->wfdesc, buf, ibufp + len, 0,
277+ &su.sa, sizeof(su));
278+
279+ if (result < 0)
280+ log_error ("send_packet_ib: %m");
281+
282+ return result;
283+}
284+
285 ssize_t send_packet (interface, packet, raw, len, from, to, hto)
286 struct interface_info *interface;
287 struct packet *packet;
c1e9ba67 288@@ -341,6 +427,11 @@ ssize_t send_packet (interface, packet,
78ab9b04
MT
289 return send_fallback (interface, packet, raw,
290 len, from, to, hto);
291
292+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
293+ return send_packet_ib(interface, packet, raw, len, from,
294+ to, hto);
295+ }
296+
297 if (hto == NULL && interface->anycast_mac_addr.hlen)
298 hto = &interface->anycast_mac_addr;
299
c1e9ba67 300@@ -362,6 +453,42 @@ ssize_t send_packet (interface, packet,
78ab9b04
MT
301 #endif /* USE_LPF_SEND */
302
303 #ifdef USE_LPF_RECEIVE
304+ssize_t receive_packet_ib (interface, buf, len, from, hfrom)
305+ struct interface_info *interface;
306+ unsigned char *buf;
307+ size_t len;
308+ struct sockaddr_in *from;
309+ struct hardware *hfrom;
310+{
311+ int length = 0;
312+ int offset = 0;
313+ unsigned char ibuf [1536];
314+ unsigned bufix = 0;
315+ unsigned paylen;
316+
317+ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
318+
319+ if (length <= 0)
320+ return length;
321+
322+ offset = decode_udp_ip_header(interface, ibuf, bufix, from,
323+ (unsigned)length, &paylen, 0);
324+
325+ if (offset < 0)
326+ return 0;
327+
328+ bufix += offset;
329+ length -= offset;
330+
331+ if (length < paylen)
332+ log_fatal("Internal inconsistency at %s:%d.", MDL);
333+
334+ /* Copy out the data in the packet... */
335+ memcpy(buf, &ibuf[bufix], paylen);
336+
337+ return (ssize_t)paylen;
338+}
339+
340 ssize_t receive_packet (interface, buf, len, from, hfrom)
341 struct interface_info *interface;
342 unsigned char *buf;
c1e9ba67 343@@ -388,6 +515,10 @@ ssize_t receive_packet (interface, buf,
78ab9b04
MT
344 };
345 struct cmsghdr *cmsg;
346
347+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
348+ return receive_packet_ib(interface, buf, len, from, hfrom);
349+ }
350+
351 length = recvmsg (interface -> rfdesc, &msg, 0);
352 if (length <= 0)
353 return length;
c1e9ba67
MF
354@@ -469,11 +600,33 @@ void maybe_setup_fallback ()
355 #endif
78ab9b04 356
c1e9ba67
MF
357 #if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR)
358-void
78ab9b04 359-get_hw_addr(const char *name, struct hardware *hw) {
c1e9ba67
MF
360+struct sockaddr_ll *
361+get_ll (struct ifaddrs *ifaddrs, struct ifaddrs **ifa, char *name)
78ab9b04 362+{
c1e9ba67
MF
363+ for (*ifa = ifaddrs; *ifa != NULL; *ifa = (*ifa)->ifa_next) {
364+ if ((*ifa)->ifa_addr == NULL)
78ab9b04
MT
365+ continue;
366+
c1e9ba67 367+ if ((*ifa)->ifa_addr->sa_family != AF_PACKET)
78ab9b04
MT
368+ continue;
369+
c1e9ba67 370+ if ((*ifa)->ifa_flags & IFF_LOOPBACK)
78ab9b04
MT
371+ continue;
372+
c1e9ba67
MF
373+ if (strcmp((*ifa)->ifa_name, name) == 0)
374+ return (struct sockaddr_ll *)(void *)(*ifa)->ifa_addr;
375+ }
376+ *ifa = NULL;
377+ return NULL;
378+}
379+
380+struct sockaddr_ll *
381+ioctl_get_ll(char *name)
382+{
383 int sock;
384 struct ifreq tmp;
385- struct sockaddr *sa;
386+ struct sockaddr *sa = NULL;
387+ struct sockaddr_ll *sll = NULL;
78ab9b04 388
c1e9ba67
MF
389 if (strlen(name) >= sizeof(tmp.ifr_name)) {
390 log_fatal("Device name too long: \"%s\"", name);
391@@ -487,16 +640,62 @@ get_hw_addr(const char *name, struct har
392 memset(&tmp, 0, sizeof(tmp));
393 strcpy(tmp.ifr_name, name);
394 if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) {
78ab9b04 395- log_fatal("Error getting hardware address for \"%s\": %m",
c1e9ba67
MF
396+ log_fatal("Error getting hardware address for \"%s\": %m",
397 name);
78ab9b04 398 }
c1e9ba67 399+ close(sock);
78ab9b04 400
c1e9ba67 401 sa = &tmp.ifr_hwaddr;
78ab9b04 402- switch (sa->sa_family) {
c1e9ba67
MF
403+ // needs to be freed outside this function
404+ sll = dmalloc (sizeof (struct sockaddr_ll), MDL);
405+ if (!sll)
406+ log_fatal("Unable to allocate memory for link layer address");
407+ memcpy(&sll->sll_hatype, &sa->sa_family, sizeof (sll->sll_hatype));
408+ memcpy(sll->sll_addr, sa->sa_data, sizeof (sll->sll_addr));
409+ switch (sll->sll_hatype) {
410+ case ARPHRD_INFINIBAND:
411+ /* ioctl limits hardware addresses to 8 bytes */
412+ sll->sll_halen = 8;
413+ break;
414+ default:
415+ break;
416+ }
417+ return sll;
418+}
419+
420+void
421+get_hw_addr(struct interface_info *info)
422+{
423+ struct hardware *hw = &info->hw_address;
424+ char *name = info->name;
425+ struct ifaddrs *ifaddrs = NULL;
426+ struct ifaddrs *ifa = NULL;
427+ struct sockaddr_ll *sll = NULL;
428+ int sll_allocated = 0;
429+ char *dup = NULL;
430+ char *colon = NULL;
431+
432+ if (getifaddrs(&ifaddrs) == -1)
433+ log_fatal("Failed to get interfaces");
434+
435+ if ((sll = get_ll(ifaddrs, &ifa, name)) == NULL) {
436+ /*
437+ * We were unable to get link-layer address for name.
438+ * Fall back to ioctl(SIOCGIFHWADDR).
439+ */
440+ sll = ioctl_get_ll(name);
441+ if (sll != NULL)
442+ sll_allocated = 1;
443+ else
444+ // shouldn't happen
445+ log_fatal("Unexpected internal error");
446+ }
447+
78ab9b04
MT
448+ switch (sll->sll_hatype) {
449 case ARPHRD_ETHER:
450 hw->hlen = 7;
451 hw->hbuf[0] = HTYPE_ETHER;
452- memcpy(&hw->hbuf[1], sa->sa_data, 6);
453+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
454 break;
455 case ARPHRD_IEEE802:
456 #ifdef ARPHRD_IEEE802_TR
c1e9ba67 457@@ -504,18 +703,48 @@ get_hw_addr(const char *name, struct har
78ab9b04
MT
458 #endif /* ARPHRD_IEEE802_TR */
459 hw->hlen = 7;
460 hw->hbuf[0] = HTYPE_IEEE802;
461- memcpy(&hw->hbuf[1], sa->sa_data, 6);
462+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
463 break;
464 case ARPHRD_FDDI:
c1e9ba67 465 hw->hlen = 7;
78ab9b04 466 hw->hbuf[0] = HTYPE_FDDI;
c1e9ba67
MF
467- memcpy(&hw->hbuf[1], sa->sa_data, 6);
468+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
78ab9b04
MT
469+ break;
470+ case ARPHRD_INFINIBAND:
c1e9ba67
MF
471+ dup = strdup(name);
472+ /* Aliased infiniband interface is special case where
473+ * neither get_ll() nor ioctl_get_ll() get's correct hw
474+ * address, so we have to truncate the :0 and run
475+ * get_ll() again for the rest.
476+ */
477+ if ((colon = strchr(dup, ':')) != NULL) {
478+ *colon = '\0';
479+ if ((sll = get_ll(ifaddrs, &ifa, dup)) == NULL)
480+ log_fatal("Error getting hardware address for \"%s\": %m", name);
481+ }
482+ free (dup);
78ab9b04
MT
483+ /* For Infiniband, save the broadcast address and store
484+ * the port GUID into the hardware address.
485+ */
c1e9ba67 486+ if (ifa && (ifa->ifa_flags & IFF_BROADCAST)) {
78ab9b04
MT
487+ struct sockaddr_ll *bll;
488+
489+ bll = (struct sockaddr_ll *)ifa->ifa_broadaddr;
490+ memcpy(&info->bcast_addr, bll->sll_addr, 20);
491+ } else {
492+ memcpy(&info->bcast_addr, default_ib_bcast_addr,
493+ 20);
494+ }
495+
496+ hw->hlen = 1;
497+ hw->hbuf[0] = HTYPE_INFINIBAND;
c1e9ba67 498+ memcpy(&hw->hbuf[1], &sll->sll_addr[sll->sll_halen - 8], 8);
78ab9b04
MT
499 break;
500 #if defined(ARPHRD_PPP)
501 case ARPHRD_PPP:
502 if (local_family != AF_INET6)
503- log_fatal("Unsupported device type %d for \"%s\"",
504- sa->sa_family, name);
c1e9ba67
MF
505+ log_fatal("local_family != AF_INET6 for \"%s\"",
506+ name);
78ab9b04
MT
507 hw->hlen = 0;
508 hw->hbuf[0] = HTYPE_RESERVED;
509 /* 0xdeadbeef should never occur on the wire,
c1e9ba67 510@@ -528,10 +757,13 @@ get_hw_addr(const char *name, struct har
78ab9b04
MT
511 break;
512 #endif
513 default:
c1e9ba67 514- log_fatal("Unsupported device type %ld for \"%s\"",
78ab9b04 515- (long int)sa->sa_family, name);
c1e9ba67
MF
516+ freeifaddrs(ifaddrs);
517+ log_fatal("Unsupported device type %hu for \"%s\"",
518+ sll->sll_hatype, name);
78ab9b04
MT
519 }
520
521- close(sock);
c1e9ba67
MF
522+ if (sll_allocated)
523+ dfree(sll, MDL);
78ab9b04
MT
524+ freeifaddrs(ifaddrs);
525 }
526 #endif
c1e9ba67
MF
527diff -up dhcp-4.3.1b1/common/socket.c.bmgpWV dhcp-4.3.1b1/common/socket.c
528--- dhcp-4.3.1b1/common/socket.c.bmgpWV 2014-07-02 19:58:38.000000000 +0200
529+++ dhcp-4.3.1b1/common/socket.c 2014-07-10 17:52:57.706272281 +0200
530@@ -322,7 +322,7 @@ void if_register_send (info)
531 info->wfdesc = if_register_socket(info, AF_INET, 0, NULL);
78ab9b04
MT
532 /* If this is a normal IPv4 address, get the hardware address. */
533 if (strcmp(info->name, "fallback") != 0)
534- get_hw_addr(info->name, &info->hw_address);
535+ get_hw_addr(info);
536 #if defined (USE_SOCKET_FALLBACK)
537 /* Fallback only registers for send, but may need to receive as
538 well. */
c1e9ba67 539@@ -385,7 +385,7 @@ void if_register_receive (info)
78ab9b04
MT
540 #endif /* IP_PKTINFO... */
541 /* If this is a normal IPv4 address, get the hardware address. */
542 if (strcmp(info->name, "fallback") != 0)
543- get_hw_addr(info->name, &info->hw_address);
544+ get_hw_addr(info);
545
546 if (!quiet_interface_discovery)
547 log_info ("Listening on Socket/%s%s%s",
c1e9ba67 548@@ -499,7 +499,7 @@ if_register6(struct interface_info *info
78ab9b04
MT
549 if (req_multi)
550 if_register_multicast(info);
551
552- get_hw_addr(info->name, &info->hw_address);
553+ get_hw_addr(info);
554
555 if (!quiet_interface_discovery) {
556 if (info->shared_network != NULL) {
c1e9ba67
MF
557@@ -555,7 +555,7 @@ if_register_linklocal6(struct interface_
558 info->rfdesc = sock;
559 info->wfdesc = sock;
560
561- get_hw_addr(info->name, &info->hw_address);
562+ get_hw_addr(info);
563
564 if (!quiet_interface_discovery) {
565 if (info->shared_network != NULL) {
566diff -up dhcp-4.3.1b1/includes/dhcpd.h.bmgpWV dhcp-4.3.1b1/includes/dhcpd.h
567--- dhcp-4.3.1b1/includes/dhcpd.h.bmgpWV 2014-07-10 17:50:26.923402536 +0200
568+++ dhcp-4.3.1b1/includes/dhcpd.h 2014-07-10 17:52:57.707272266 +0200
569@@ -1248,6 +1248,7 @@ struct interface_info {
78ab9b04
MT
570 struct shared_network *shared_network;
571 /* Networks connected to this interface. */
572 struct hardware hw_address; /* Its physical address. */
573+ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */
574 struct in_addr *addresses; /* Addresses associated with this
575 * interface.
576 */
c1e9ba67 577@@ -2439,7 +2440,7 @@ void print_dns_status (int, struct dhcp_
78ab9b04
MT
578 #endif
579 const char *print_time(TIME);
580
581-void get_hw_addr(const char *name, struct hardware *hw);
582+void get_hw_addr(struct interface_info *info);
583
584 /* socket.c */
585 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \