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