Report information
The Basics
Id:
24245
Status:
resolved
Worked:
10 minutes
Priority:
Medium/Medium
Queue:

People
Owner:
Nobody in particular
Cc:
AdminCc:

BugTracker
Version Fixed:
(no value)
Version Found:
(no value)
Versions Affected:
(no value)
Versions Planned:
(no value)
Priority:
(no value)
Severity:
S2 Normal
CVSS Score:
(no value)
CVE ID:
(no value)
Component:
(no value)
Area:
(no value)

Dates
Created:Sat, 23 Apr 2011 11:39:56 -0400
Updated:Wed, 21 Mar 2018 14:18:14 -0400
Closed:Fri, 08 Jun 2012 18:40:57 -0400



This bug tracker is no longer active.

Please go to our Gitlab to submit issues (both feature requests and bug reports) for active projects maintained by Internet Systems Consortium (ISC).

Due to security and confidentiality requirements, full access is limited to the primary maintainers.

Subject: [PATCH 0/2] Add support for DHCP over IPoIB per IETF RFC 4390
Date: Sat, 23 Apr 2011 11:39:45 -0400
To: dhcp-bugs@isc.org, dhcp-suggest@isc.org
From: Hal Rosenstock <hal@dev.mellanox.co.il>
The following patch series adds Dynamic Host Configuration Protocol (DHCP) over InfiniBand per IETF standard RFC 4390. The two main complexities with this are: 1. IPoIB client hardware address is 20 bytes so it doesn't fit into client hardware address (limited to 16 bytes) so DHCP client identifier is used. 2. The client must set the BROADCAST flag in both DHCPDISCOVER and DHCPREQUEST messages to ensure that the server broadcasts it's reply to the client. Note these changes are for Linux (LPF) and are against the 4.2.1-P1 version of DHCP.
Subject: [PATCH 1/2] Add dhclient option to broadcast always
Date: Sat, 23 Apr 2011 11:39:53 -0400
To: dhcp-bugs@isc.org, dhcp-suggest@isc.org
From: Hal Rosenstock <hal@dev.mellanox.co.il>
DHCP over IPoIB requires the client to always set the BROADCAST flag of DHCPDISCOVER and DHCPREQUEST packets to ensure that server responses are broadcast back to the client so add this is as a supported option. Signed-off-by: Hal Rosenstock <hal@mellanox.com> --- diff -up dhcp-4.2.1-P1/common/conflex.c.option dhcp-4.2.1-P1/common/conflex.c --- dhcp-4.2.1-P1/common/conflex.c.option 2010-12-15 00:07:46.000000000 +0200 +++ dhcp-4.2.1-P1/common/conflex.c 2011-04-23 18:06:57.189226000 +0300 @@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv) return BALANCE; if (!strcasecmp (atom + 1, "ound")) return BOUND; + if (!strcasecmp (atom + 1, "ootp-broadcast-always")) + return BOOTP_BROADCAST_ALWAYS; break; case 'c': if (!strcasecmp(atom + 1, "ase")) diff -up dhcp-4.2.1-P1/includes/dhcpd.h.option dhcp-4.2.1-P1/includes/dhcpd.h --- dhcp-4.2.1-P1/includes/dhcpd.h.option 2010-12-03 22:32:14.000000000 +0200 +++ dhcp-4.2.1-P1/includes/dhcpd.h 2011-04-23 18:07:01.861768000 +0300 @@ -1119,6 +1119,9 @@ struct client_config { int do_forward_update; /* If nonzero, and if we have the information we need, update the A record for the address we get. */ + + int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST + flag in requests */ }; /* Per-interface state used in the dhcp client... */ diff -up dhcp-4.2.1-P1/client/dhclient.c.option dhcp-4.2.1-P1/client/dhclient.c --- dhcp-4.2.1-P1/client/dhclient.c.option 2011-03-24 23:17:07.000000000 +0200 +++ dhcp-4.2.1-P1/client/dhclient.c 2011-04-23 18:07:07.436204000 +0300 @@ -84,6 +84,7 @@ int wanted_ia_na = -1; /* the absolute int wanted_ia_ta = 0; int wanted_ia_pd = 0; char *mockup_relay = NULL; +int bootp_broadcast_always = 0; void run_stateless(int exit_mode); @@ -304,6 +305,8 @@ main(int argc, char **argv) { } else if (!strcmp(argv[i], "--version")) { log_info("isc-dhclient-%s", PACKAGE_VERSION); exit(0); + } else if (!strcmp(argv[i], "-B")) { + bootp_broadcast_always = 1; } else if (argv[i][0] == '-') { usage(); } else if (interfaces_requested < 0) { @@ -2344,7 +2347,8 @@ void make_discover (client, lease) client -> packet.xid = random (); client -> packet.secs = 0; /* filled in by send_discover. */ - if (can_receive_unicast_unconfigured (client -> interface)) + if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always)) + && can_receive_unicast_unconfigured(client->interface)) client -> packet.flags = 0; else client -> packet.flags = htons (BOOTP_BROADCAST); @@ -2428,7 +2432,9 @@ void make_request (client, lease) } else { memset (&client -> packet.ciaddr, 0, sizeof client -> packet.ciaddr); - if (can_receive_unicast_unconfigured (client -> interface)) + if ((!(bootp_broadcast_always || + client ->config->bootp_broadcast_always)) && + can_receive_unicast_unconfigured (client -> interface)) client -> packet.flags = 0; else client -> packet.flags = htons (BOOTP_BROADCAST); @@ -2490,7 +2496,8 @@ void make_decline (client, lease) client -> packet.hops = 0; client -> packet.xid = client -> xid; client -> packet.secs = 0; /* Filled in by send_request. */ - if (can_receive_unicast_unconfigured (client -> interface)) + if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always)) + && can_receive_unicast_unconfigured (client->interface)) client -> packet.flags = 0; else client -> packet.flags = htons (BOOTP_BROADCAST); diff -up dhcp-4.2.1-P1/client/clparse.c.option dhcp-4.2.1-P1/client/clparse.c --- dhcp-4.2.1-P1/client/clparse.c.option 2010-09-14 00:15:19.000000000 +0200 +++ dhcp-4.2.1-P1/client/clparse.c 2011-04-23 18:07:11.930832000 +0300 @@ -136,6 +136,7 @@ isc_result_t read_client_conf () /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) */ top_level_config.requested_lease = 7200; + top_level_config.bootp_broadcast_always = 0; group_allocate (&top_level_config.on_receipt, MDL); if (!top_level_config.on_receipt) @@ -303,7 +304,8 @@ void read_client_leases () interface-declaration | LEASE client-lease-statement | ALIAS client-lease-statement | - KEY key-definition */ + KEY key-definition | + BOOTP_BROADCAST_ALWAYS */ void parse_client_statement (cfile, ip, config) struct parse *cfile; @@ -717,6 +719,12 @@ void parse_client_statement (cfile, ip, parse_reject_statement (cfile, config); return; + case BOOTP_BROADCAST_ALWAYS: + token = next_token(&val, (unsigned*)0, cfile); + config -> bootp_broadcast_always = 1; + parse_semi (cfile); + return; + default: lose = 0; stmt = (struct executable_statement *)0; diff -up dhcp-4.2.1-P1/includes/dhctoken.c.option dhcp-4.2.1-P1/includes/dhctoken.h --- dhcp-4.2.1-P1/includes/dhctoken.h.option 2010-02-17 22:33:55.000000000 +0200 +++ dhcp-4.2.1-P1/includes/dhctoken.h 2011-04-23 18:07:17.252304000 +0300 @@ -357,7 +357,8 @@ enum dhcp_token { CONFLICT_DONE = 660, AUTO_PARTNER_DOWN = 661, GETHOSTNAME = 662, - REWIND = 663 + REWIND = 663, + BOOTP_BROADCAST_ALWAYS = 664 }; #define is_identifier(x) ((x) >= FIRST_TOKEN && \
Subject: [PATCH 2/2] Add DHCP over IPoIB per IETF RFC 4390
Date: Sat, 23 Apr 2011 11:40:07 -0400
To: dhcp-bugs@isc.org, dhcp-suggest@isc.org
From: Hal Rosenstock <hal@dev.mellanox.co.il>
for Linux by adding support to LPF for this. The two main complexities with this are: 1. IPoIB client hardware address is 20 bytes so it doesn't fit into client hardware address (limited to 16 bytes) so DHCP client identifier is used. 2. The client must set the BROADCAST flag in both DHCPDISCOVER and DHCPREQUEST messages to ensure that the server broadcasts it's reply to the client. Signed-off-by: Hal Rosenstock <hal@mellanox.com> --- diff -up dhcp-4.2.1-P1/common/lpf.c.ib dhcp-4.2.1-P1/common/lpf.c --- dhcp-4.2.1-P1/common/lpf.c.ib 2009-07-23 21:52:19.000000000 +0300 +++ dhcp-4.2.1-P1/common/lpf.c 2011-04-22 17:08:47.942829000 +0300 @@ -35,15 +35,26 @@ #include <asm/types.h> #include <linux/filter.h> #include <linux/if_ether.h> +#include <linux/if_packet.h> #include <netinet/in_systm.h> #include "includes/netinet/ip.h" #include "includes/netinet/udp.h" #include "includes/netinet/if_ether.h" #include <net/if.h> +#include <ifaddrs.h> /* Reinitializes the specified interface after an address change. This is not required for packet-filter APIs. */ +/* Default broadcast address for IPoIB */ +static unsigned char default_ib_bcast_addr[20] = { + 0x00, 0xff, 0xff, 0xff, + 0xff, 0x12, 0x40, 0x1b, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff +}; + #ifdef USE_LPF_SEND void if_reinitialize_send (info) struct interface_info *info; @@ -66,11 +77,26 @@ int if_register_lpf (info) struct interface_info *info; { int sock; - struct sockaddr sa; + union { + struct sockaddr_ll ll; + struct sockaddr common; + } sa; + struct ifreq ifr; + int type; + int protocol; /* Make an LPF socket. */ - if ((sock = socket(PF_PACKET, SOCK_PACKET, - htons((short)ETH_P_ALL))) < 0) { + get_hw_addr(info); + + if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { + type = SOCK_DGRAM; + protocol = ETHERTYPE_IP; + } else { + type = SOCK_PACKET; + protocol = ETH_P_ALL; + } + + if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT || errno == EINVAL) { @@ -86,9 +112,21 @@ int if_register_lpf (info) /* Bind to the interface name */ memset (&sa, 0, sizeof sa); - sa.sa_family = AF_PACKET; - strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data); - if (bind (sock, &sa, sizeof sa)) { + if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { + memset (&ifr, 0, sizeof ifr); + strncpy (ifr.ifr_name, (const char *)info -> ifp, + sizeof ifr.ifr_name); + if (ioctl (sock, SIOCGIFINDEX, &ifr)) + log_fatal ("Failed to get interface index: %m"); + + sa.ll.sll_family = AF_PACKET; + sa.ll.sll_ifindex = ifr.ifr_ifindex; + } else { + sa.common.sa_family = AF_PACKET; + strncpy (sa.common.sa_data, (const char *)info -> ifp, + sizeof sa.common.sa_data); + } + if (bind (sock, &sa.common, sizeof sa)) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT || errno == EINVAL) { @@ -102,8 +140,6 @@ int if_register_lpf (info) log_fatal ("Bind socket to interface: %m"); } - get_hw_addr(info->name, &info->hw_address); - return sock; } #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ @@ -158,6 +194,8 @@ void if_deregister_send (info) in bpf includes... */ extern struct sock_filter dhcp_bpf_filter []; extern int dhcp_bpf_filter_len; +extern struct sock_filter dhcp_ib_bpf_filter []; +extern int dhcp_ib_bpf_filter_len; #if defined (HAVE_TR_SUPPORT) extern struct sock_filter dhcp_bpf_tr_filter []; @@ -216,15 +254,28 @@ static void lpf_gen_filter_setup (info) memset(&p, 0, sizeof(p)); - /* Set up the bpf filter program structure. This is defined in - bpf.c */ - p.len = dhcp_bpf_filter_len; - p.filter = dhcp_bpf_filter; - - /* Patch the server port into the LPF program... - XXX changes to filter program may require changes - to the insn number(s) used below! XXX */ - dhcp_bpf_filter [8].k = ntohs ((short)local_port); + if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { + /* Set up the bpf filter program structure. */ + p.len = dhcp_ib_bpf_filter_len; + p.filter = dhcp_ib_bpf_filter; + + /* Patch the server port into the LPF program... + XXX + changes to filter program may require changes + to the insn number(s) used below! + XXX */ + dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port); + } else { + /* Set up the bpf filter program structure. + This is defined in bpf.c */ + p.len = dhcp_bpf_filter_len; + p.filter = dhcp_bpf_filter; + + /* Patch the server port into the LPF program... + XXX changes to filter program may require changes + to the insn number(s) used below! XXX */ + dhcp_bpf_filter [8].k = ntohs ((short)local_port); + } if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, sizeof p) < 0) { @@ -281,6 +332,54 @@ static void lpf_tr_filter_setup (info) #endif /* USE_LPF_RECEIVE */ #ifdef USE_LPF_SEND +ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto) + struct interface_info *interface; + struct packet *packet; + struct dhcp_packet *raw; + size_t len; + struct in_addr from; + struct sockaddr_in *to; + struct hardware *hto; +{ + unsigned ibufp = 0; + double ih [1536 / sizeof (double)]; + unsigned char *buf = (unsigned char *)ih; + ssize_t result; + + union sockunion { + struct sockaddr sa; + struct sockaddr_ll sll; + struct sockaddr_storage ss; + } su; + + assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr, + to->sin_addr.s_addr, to->sin_port, + (unsigned char *)raw, len); + memcpy (buf + ibufp, raw, len); + + memset(&su, 0, sizeof(su)); + su.sll.sll_family = AF_PACKET; + su.sll.sll_protocol = htons(ETHERTYPE_IP); + + if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) { + errno = ENOENT; + log_error ("send_packet_ib: %m - failed to get if index"); + return -1; + } + + su.sll.sll_hatype = htons(HTYPE_INFINIBAND); + su.sll.sll_halen = sizeof(interface->bcast_addr); + memcpy(&su.sll.sll_addr, interface->bcast_addr, 20); + + result = sendto(interface->wfdesc, buf, ibufp + len, 0, + &su.sa, sizeof(su)); + + if (result < 0) + log_error ("send_packet_ib: %m"); + + return result; +} + ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct interface_info *interface; struct packet *packet; @@ -302,6 +401,11 @@ ssize_t send_packet (interface, packet, return send_fallback (interface, packet, raw, len, from, to, hto); + if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { + return send_packet_ib(interface, packet, raw, len, from, + to, hto); + } + if (hto == NULL && interface->anycast_mac_addr.hlen) hto = &interface->anycast_mac_addr; @@ -331,6 +435,44 @@ ssize_t send_packet (interface, packet, #endif /* USE_LPF_SEND */ #ifdef USE_LPF_RECEIVE +ssize_t receive_packet_ib (interface, buf, len, from, hfrom) + struct interface_info *interface; + unsigned char *buf; + size_t len; + struct sockaddr_in *from; + struct hardware *hfrom; +{ + int length = 0; + int offset = 0; + unsigned char ibuf [1536]; + unsigned bufix = 0; + unsigned paylen; + + length = read(interface->rfdesc, ibuf, sizeof(ibuf)); + + if (length <= 0) + return length; + + /* Decode the IP and UDP headers... */ + offset = decode_udp_ip_header(interface, ibuf, bufix, from, + (unsigned)length, &paylen); + + /* If the IP or UDP checksum was bad, skip the packet... */ + if (offset < 0) + return 0; + + bufix += offset; + length -= offset; + + if (length < paylen) + log_fatal("Internal inconsistency at %s:%d.", MDL); + + /* Copy out the data in the packet... */ + memcpy(buf, &ibuf[bufix], paylen); + + return (ssize_t)paylen; +} + ssize_t receive_packet (interface, buf, len, from, hfrom) struct interface_info *interface; unsigned char *buf; @@ -344,6 +486,10 @@ ssize_t receive_packet (interface, buf, unsigned bufix = 0; unsigned paylen; + if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { + return receive_packet_ib(interface, buf, len, from, hfrom); + } + length = read (interface -> rfdesc, ibuf, sizeof ibuf); if (length <= 0) return length; @@ -416,33 +562,41 @@ void maybe_setup_fallback () } void -get_hw_addr(const char *name, struct hardware *hw) { - int sock; - struct ifreq tmp; - struct sockaddr *sa; +get_hw_addr(struct interface_info *info) +{ + struct hardware *hw = &info->hw_address; + char *name = info->name; + struct ifaddrs *ifaddrs; + struct ifaddrs *ifa; + struct sockaddr_ll *sll = NULL; - if (strlen(name) >= sizeof(tmp.ifr_name)) { - log_fatal("Device name too long: \"%s\"", name); - } + if (getifaddrs(&ifaddrs) == -1) + log_fatal("Failed to get interfaces"); + + for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { + + if (ifa->ifa_addr->sa_family != AF_PACKET) + continue; - sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock < 0) { - log_fatal("Can't create socket for \"%s\": %m", name); + if (ifa->ifa_flags & IFF_LOOPBACK) + continue; + + if (strcmp(ifa->ifa_name, name) == 0) { + sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr; + break; + } } - memset(&tmp, 0, sizeof(tmp)); - strcpy(tmp.ifr_name, name); - if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { - log_fatal("Error getting hardware address for \"%s\": %m", - name); + if (sll == NULL) { + freeifaddrs(ifaddrs); + log_fatal("Failed to get HW address for %s\n", name); } - sa = &tmp.ifr_hwaddr; - switch (sa->sa_family) { + switch (sll->sll_hatype) { case ARPHRD_ETHER: hw->hlen = 7; hw->hbuf[0] = HTYPE_ETHER; - memcpy(&hw->hbuf[1], sa->sa_data, 6); + memcpy(&hw->hbuf[1], sll->sll_addr, 6); break; case ARPHRD_IEEE802: #ifdef ARPHRD_IEEE802_TR @@ -450,18 +604,36 @@ get_hw_addr(const char *name, struct har #endif /* ARPHRD_IEEE802_TR */ hw->hlen = 7; hw->hbuf[0] = HTYPE_IEEE802; - memcpy(&hw->hbuf[1], sa->sa_data, 6); + memcpy(&hw->hbuf[1], sll->sll_addr, 6); break; case ARPHRD_FDDI: hw->hlen = 17; hw->hbuf[0] = HTYPE_FDDI; - memcpy(&hw->hbuf[1], sa->sa_data, 16); + memcpy(&hw->hbuf[1], sll->sll_addr, 16); + break; + case ARPHRD_INFINIBAND: + /* For Infiniband, save the broadcast address and store + * the port GUID into the hardware address. + */ + if (ifa->ifa_flags & IFF_BROADCAST) { + struct sockaddr_ll *bll; + + bll = (struct sockaddr_ll *)ifa->ifa_broadaddr; + memcpy(&info->bcast_addr, bll->sll_addr, 20); + } else { + memcpy(&info->bcast_addr, default_ib_bcast_addr, + 20); + } + + hw->hlen = 1; + hw->hbuf[0] = HTYPE_INFINIBAND; break; default: + freeifaddrs(ifaddrs); log_fatal("Unsupported device type %ld for \"%s\"", - (long int)sa->sa_family, name); + (long int)sll->sll_family, name); } - close(sock); + freeifaddrs(ifaddrs); } #endif diff -up dhcp-4.2.1-P1/includes/dhcp.h.ib dhcp-4.2.1-P1/includes/dhcp.h --- dhcp-4.2.1-P1/includes/dhcp.h.ib 2009-11-20 03:49:01.000000000 +0200 +++ dhcp-4.2.1-P1/includes/dhcp.h 2011-04-22 16:03:06.358938000 +0300 @@ -79,6 +79,7 @@ struct dhcp_packet { #define HTYPE_ETHER 1 /* Ethernet 10Mbps */ #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ #define HTYPE_FDDI 8 /* FDDI... */ +#define HTYPE_INFINIBAND 32 /* Infiniband IPoIB */ /* Magic cookie validating dhcp options field (and bootp vendor extensions field). */ diff -up dhcp-4.2.1-P1/client/dhclient.c.ib dhcp-4.2.1-P1/client/dhclient.c --- dhcp-4.2.1-P1/client/dhclient.c.ib 2011-04-22 15:57:54.122640000 +0300 +++ dhcp-4.2.1-P1/client/dhclient.c 2011-04-22 16:03:13.802274000 +0300 @@ -97,6 +97,29 @@ static int check_domain_name_list(const static int check_option_values(struct universe *universe, unsigned int opt, const char *ptr, size_t len); +static void setup_ib_interface(struct interface_info *ip) +{ + struct group *g; + + /* Set the broadcast flag */ + ip->client->config->bootp_broadcast_always = 1; + + /* + * Find out if a dhcp-client-identifier option was specified either + * in the config file or on the command line + */ + for (g = ip->client->config->on_transmission; g != NULL; g = g->next) { + if ((g->statements != NULL) && + (strcmp(g->statements->data.option->option->name, + "dhcp-client-identifier") == 0)) { + return; + } + } + + /* No client ID specified */ + log_fatal("dhcp-client-identifier must be specified for InfiniBand"); +} + int main(int argc, char **argv) { int fd; @@ -555,6 +578,14 @@ main(int argc, char **argv) { } srandom(seed + cur_time + (unsigned)getpid()); + /* Setup specific Infiniband options */ + for (ip = interfaces; ip; ip = ip->next) { + if (ip->client && + (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) { + setup_ib_interface(ip); + } + } + /* Start a configuration state machine for each interface. */ #ifdef DHCPv6 if (local_family == AF_INET6) { diff -up dhcp-4.2.1-P1/common/bpf.c.ib dhcp-4.2.1-P1/common/bpf.c --- dhcp-4.2.1-P1/common/bpf.c.ib 2009-11-20 03:48:59.000000000 +0200 +++ dhcp-4.2.1-P1/common/bpf.c 2011-04-22 16:03:20.095703000 +0300 @@ -116,7 +116,7 @@ int if_register_bpf (info) log_fatal ("Can't attach interface %s to bpf device %s: %m", info -> name, filename); - get_hw_addr(info->name, &info->hw_address); + get_hw_addr(info); return sock; } @@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = { BPF_STMT(BPF_RET+BPF_K, 0), }; +/* Packet filter program for DHCP over Infiniband. + * + * XXX + * Changes to the filter program may require changes to the constant offsets + * used in lpf_gen_filter_setup to patch the port in the BPF program! + * XXX + */ +struct bpf_insn dhcp_ib_bpf_filter [] = { + /* Packet filter for Infiniband */ + /* Make sure it's a UDP packet... */ + BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), + + /* Make sure this isn't a fragment... */ + BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6), + BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), + + /* Get the IP header length... */ + BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0), + + /* Make sure it's to the right port... */ + BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), + + /* If we passed all the tests, ask for the whole packet. */ + BPF_STMT(BPF_RET + BPF_K, (u_int)-1), + + /* Otherwise, drop it. */ + BPF_STMT(BPF_RET + BPF_K, 0), +}; + #if defined (DEC_FDDI) struct bpf_insn *bpf_fddi_filter; #endif int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn); +int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn); + #if defined (HAVE_TR_SUPPORT) struct bpf_insn dhcp_bpf_tr_filter [] = { /* accept all token ring packets due to variable length header */ @@ -552,7 +585,9 @@ void maybe_setup_fallback () } void -get_hw_addr(const char *name, struct hardware *hw) { +get_hw_addr(struct interface_info *info) { + struct hardware *hw = &info->hw_address; + char *name = info->name; struct ifaddrs *ifa; struct ifaddrs *p; struct sockaddr_dl *sa; diff -up dhcp-4.2.1-P1/common/dlpi.c.ib dhcp-4.2.1-P1/common/dlpic.c --- dhcp-4.2.1-P1/common/dlpi.c.ib 2011-02-18 21:16:04.000000000 +0200 +++ dhcp-4.2.1-P1/common/dlpi.c 2011-04-22 16:03:38.535901000 +0300 @@ -1334,7 +1334,9 @@ void maybe_setup_fallback () #endif /* USE_DLPI_SEND */ void -get_hw_addr(const char *name, struct hardware *hw) { +get_hw_addr(struct interface_info *info) { + struct hardware *hw = &info->hw_address; + char *name = info->name; int sock, unit; long buf[DLPI_MAXDLBUF]; union DL_primitives *dlp; diff -up dhcp-4.2.1-P1/common/socket.c.ib dhcp-4.2.1-P1/common/socket.c --- dhcp-4.2.1-P1/common/socket.c.ib 2010-09-10 01:47:58.000000000 +0300 +++ dhcp-4.2.1-P1/common/socket.c 2011-04-22 16:03:25.869139000 +0300 @@ -283,7 +283,7 @@ if_register_socket(struct interface_info /* If this is a normal IPv4 address, get the hardware address. */ if ((local_family == AF_INET) && (strcmp(info->name, "fallback") != 0)) - get_hw_addr(info->name, &info->hw_address); + get_hw_addr(info); return sock; } @@ -429,7 +429,7 @@ if_register6(struct interface_info *info if (req_multi) if_register_multicast(info); - get_hw_addr(info->name, &info->hw_address); + get_hw_addr(info); if (!quiet_interface_discovery) { if (info->shared_network != NULL) { diff -up dhcp-4.2.1-P1/includes/dhcpd.h.ib dhcp-4.2.1-P1/includes/dhcpd.h --- dhcp-4.2.1-P1/includes/dhcpd.h.ib 2011-04-22 15:45:48.941514000 +0300 +++ dhcp-4.2.1-P1/includes/dhcpd.h 2011-04-22 16:03:31.717563000 +0300 @@ -1214,6 +1214,7 @@ struct interface_info { struct shared_network *shared_network; /* Networks connected to this interface. */ struct hardware hw_address; /* Its physical address. */ + u_int8_t bcast_addr[20]; /* Infiniband broadcast address */ struct in_addr *addresses; /* Addresses associated with this * interface. */ @@ -2327,7 +2328,7 @@ void print_dns_status (int, struct dhcp_ #endif const char *print_time(TIME); -void get_hw_addr(const char *name, struct hardware *hw); +void get_hw_addr(struct interface_info *info); /* socket.c */ #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
Hi Hal,

As you may have noticed each time you send mail to our ticket
system it opens a new ticket.  As the 3 tickets for IPoIB should
be handled as a unit I've merged them into a single ticket
24245.  If you want to update the ticket for some reason you
can reply to the automated response (or this response) and
your updates will be attached to the same ticket.

Thank you for the patch and we'll try and review it figure out if and
when it should be included in a release.

Shawn

Subject: Re: [ISC-Bugs #24249] [PATCH 2/2] Add DHCP over IPoIB per IETF RFC 4390
Date: Tue, 19 Jul 2011 11:14:26 -0400
To: dhcp-bugs@isc.org
From: Hal Rosenstock <hal@dev.mellanox.co.il>
Hi, On 4/25/2011 3:13 PM, Shawn Routhier via RT wrote: > Hi Hal, > > As you may have noticed each time you send mail to our ticket > system it opens a new ticket. As the 3 tickets for IPoIB should > be handled as a unit I've merged them into a single ticket > 24245. If you want to update the ticket for some reason you > can reply to the automated response (or this response) and > your updates will be attached to the same ticket. > > Thank you for the patch and we'll try and review it figure out if and > when it should be included in a release. Any update on this item ? If not, any idea when you might get to it ? Thanks! -- Hal > Shawn > >
CC: Hal Rosenstock <hal@mellanox.com>
Subject: [ISC-Bugs #24249] Add DHCP over IPoIB per IETF RFC 4390
Date: Mon, 19 Sep 2011 11:34:59 +0200
To: dhcp-bugs@isc.org
From: Jiri Popelka <jpopelka@redhat.com>
Hello, Hal Rosenstock from Mellanox told me that the patches for IPoIB support were sent to ISC as [ISC-Bugs #24249]. There's a little problem [1] which can be fixed by applying the attached patch on top of the previous patches. With regards, Jiri Popelka, Red Hat, inc. [1] https://bugzilla.redhat.com/show_bug.cgi?id=731990 https://bugzilla.redhat.com/show_bug.cgi?id=736149

Message body is not shown because sender requested not to inline it.

Marking resolved to cover the end of the Solaris work.

Opening a new ticket 29751 for the ongoing Linux
and BSD work.