7caf8ab
diff -up dhcp-4.3.0/common/lpf.c.IPoIB-log-id dhcp-4.3.0/common/lpf.c
7caf8ab
--- dhcp-4.3.0/common/lpf.c.IPoIB-log-id	2014-02-18 15:52:12.292569480 +0100
7caf8ab
+++ dhcp-4.3.0/common/lpf.c	2014-02-18 15:52:12.297569411 +0100
7caf8ab
@@ -164,6 +164,8 @@ int if_register_lpf (info)
7caf8ab
 void if_register_send (info)
7caf8ab
 	struct interface_info *info;
7caf8ab
 {
7caf8ab
+	int hlen;
7caf8ab
+
7caf8ab
 	/* If we're using the lpf API for sending and receiving,
7caf8ab
 	   we don't need to register this interface twice. */
7caf8ab
 #ifndef USE_LPF_RECEIVE
7caf8ab
@@ -171,11 +173,15 @@ void if_register_send (info)
7caf8ab
 #else
7caf8ab
 	info -> wfdesc = info -> rfdesc;
7caf8ab
 #endif
7caf8ab
+	if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND)
7caf8ab
+		hlen = 9;
7caf8ab
+	else
7caf8ab
+		hlen = info -> hw_address.hlen;
7caf8ab
 	if (!quiet_interface_discovery)
7caf8ab
 		log_info ("Sending on   LPF/%s/%s%s%s",
7caf8ab
 		      info -> name,
7caf8ab
 		      print_hw_addr (info -> hw_address.hbuf [0],
7caf8ab
-				     info -> hw_address.hlen - 1,
7caf8ab
+				     hlen - 1,
7caf8ab
 				     &info -> hw_address.hbuf [1]),
7caf8ab
 		      (info -> shared_network ? "/" : ""),
7caf8ab
 		      (info -> shared_network ?
7caf8ab
@@ -185,6 +191,10 @@ void if_register_send (info)
7caf8ab
 void if_deregister_send (info)
7caf8ab
 	struct interface_info *info;
7caf8ab
 {
7caf8ab
+	int hlen = info -> hw_address.hlen;
7caf8ab
+	if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND)
7caf8ab
+		hlen = 9;
7caf8ab
+
7caf8ab
 	/* don't need to close twice if we are using lpf for sending and
7caf8ab
 	   receiving */
7caf8ab
 #ifndef USE_LPF_RECEIVE
7caf8ab
@@ -197,7 +207,7 @@ void if_deregister_send (info)
7caf8ab
 		log_info ("Disabling output on LPF/%s/%s%s%s",
7caf8ab
 		      info -> name,
7caf8ab
 		      print_hw_addr (info -> hw_address.hbuf [0],
7caf8ab
-				     info -> hw_address.hlen - 1,
7caf8ab
+				     hlen - 1,
7caf8ab
 				     &info -> hw_address.hbuf [1]),
7caf8ab
 		      (info -> shared_network ? "/" : ""),
7caf8ab
 		      (info -> shared_network ?
7caf8ab
@@ -224,7 +234,7 @@ static void lpf_gen_filter_setup (struct
7caf8ab
 void if_register_receive (info)
7caf8ab
 	struct interface_info *info;
7caf8ab
 {
7caf8ab
-	int val;
7caf8ab
+	int val, hlen;
7caf8ab
 
7caf8ab
 	/* Open a LPF device and hang it on this interface... */
7caf8ab
 	info -> rfdesc = if_register_lpf (info);
7caf8ab
@@ -236,7 +246,9 @@ void if_register_receive (info)
7caf8ab
 			if (errno != ENOPROTOOPT)
7caf8ab
 				log_fatal ("Failed to set auxiliary packet data: %m");
7caf8ab
 		}
7caf8ab
-	}
7caf8ab
+		hlen = info -> hw_address.hlen;
7caf8ab
+	} else
7caf8ab
+		hlen = 9;
7caf8ab
 
7caf8ab
 #if defined (HAVE_TR_SUPPORT)
7caf8ab
 	if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
7caf8ab
@@ -249,7 +261,7 @@ void if_register_receive (info)
7caf8ab
 		log_info ("Listening on LPF/%s/%s%s%s",
7caf8ab
 			  info -> name,
7caf8ab
 			  print_hw_addr (info -> hw_address.hbuf [0],
7caf8ab
-					 info -> hw_address.hlen - 1,
7caf8ab
+					 hlen - 1,
7caf8ab
 					 &info -> hw_address.hbuf [1]),
7caf8ab
 			  (info -> shared_network ? "/" : ""),
7caf8ab
 			  (info -> shared_network ?
7caf8ab
@@ -259,6 +271,10 @@ void if_register_receive (info)
7caf8ab
 void if_deregister_receive (info)
7caf8ab
 	struct interface_info *info;
7caf8ab
 {
7caf8ab
+	int hlen = info -> hw_address.hlen;
7caf8ab
+	if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND)
7caf8ab
+		hlen = 9;
7caf8ab
+
7caf8ab
 	/* for LPF this is simple, packet filters are removed when sockets
7caf8ab
 	   are closed */
7caf8ab
 	close (info -> rfdesc);
7caf8ab
@@ -267,7 +283,7 @@ void if_deregister_receive (info)
7caf8ab
 		log_info ("Disabling input on LPF/%s/%s%s%s",
7caf8ab
 			  info -> name,
7caf8ab
 			  print_hw_addr (info -> hw_address.hbuf [0],
7caf8ab
-					 info -> hw_address.hlen - 1,
7caf8ab
+					 hlen - 1,
7caf8ab
 					 &info -> hw_address.hbuf [1]),
7caf8ab
 			  (info -> shared_network ? "/" : ""),
7caf8ab
 			  (info -> shared_network ?
7caf8ab
diff -up dhcp-4.3.0/server/dhcp.c.IPoIB-log-id dhcp-4.3.0/server/dhcp.c
7caf8ab
--- dhcp-4.3.0/server/dhcp.c.IPoIB-log-id	2014-02-18 15:52:12.204570695 +0100
7caf8ab
+++ dhcp-4.3.0/server/dhcp.c	2014-02-18 15:52:12.299569383 +0100
7caf8ab
@@ -74,6 +74,42 @@ const int dhcp_type_name_max = ((sizeof
7caf8ab
 # define send_packet trace_packet_send
7caf8ab
 #endif
7caf8ab
 
7caf8ab
+char *print_client_identifier_from_packet (packet)
7caf8ab
+	struct packet *packet;
7caf8ab
+{
7caf8ab
+	struct option_cache *oc;
7caf8ab
+	struct data_string client_identifier;
7caf8ab
+	char *ci;
7caf8ab
+
7caf8ab
+	memset (&client_identifier, 0, sizeof client_identifier);
7caf8ab
+
7caf8ab
+	oc = lookup_option (&dhcp_universe, packet -> options,
7caf8ab
+			DHO_DHCP_CLIENT_IDENTIFIER);
7caf8ab
+	if (oc &&
7caf8ab
+	    evaluate_option_cache (&client_identifier,
7caf8ab
+				    packet, (struct lease *)0,
7caf8ab
+				    (struct client_state *)0,
7caf8ab
+				    packet -> options,
7caf8ab
+				    (struct option_state *)0,
7caf8ab
+				    &global_scope, oc, MDL)) {
7caf8ab
+		ci = print_hw_addr (HTYPE_INFINIBAND, client_identifier.len, client_identifier.data);
7caf8ab
+		data_string_forget (&client_identifier, MDL);
7caf8ab
+		return ci;
7caf8ab
+	} else
7caf8ab
+		return "\"no client id\"";
7caf8ab
+}
7caf8ab
+
7caf8ab
+char *print_hw_addr_or_client_id (packet)
7caf8ab
+	struct packet *packet;
7caf8ab
+{
7caf8ab
+	if (packet -> raw -> htype == HTYPE_INFINIBAND)
7caf8ab
+		return print_client_identifier_from_packet (packet);
7caf8ab
+	else
7caf8ab
+		return print_hw_addr (packet -> raw -> htype,
7caf8ab
+				      packet -> raw -> hlen,
7caf8ab
+				      packet -> raw -> chaddr);
7caf8ab
+}
7caf8ab
+
7caf8ab
 void
7caf8ab
 dhcp (struct packet *packet) {
7caf8ab
 	int ms_nulltp = 0;
7caf8ab
@@ -102,9 +138,7 @@ dhcp (struct packet *packet) {
7caf8ab
 		
7caf8ab
 		log_info("%s from %s via %s: %s", s,
7caf8ab
 			 (packet->raw->htype
7caf8ab
-			  ? print_hw_addr(packet->raw->htype,
7caf8ab
-					  packet->raw->hlen,
7caf8ab
-					  packet->raw->chaddr)
7caf8ab
+			  ? print_hw_addr_or_client_id(packet)
7caf8ab
 			  : "<no identifier>"),
7caf8ab
 			 packet->raw->giaddr.s_addr
7caf8ab
 			 ? inet_ntoa(packet->raw->giaddr)
7caf8ab
@@ -286,9 +320,7 @@ void dhcpdiscover (packet, ms_nulltp)
7caf8ab
 	 */
7caf8ab
 	snprintf (msgbuf, sizeof msgbuf, "DHCPDISCOVER from %s %s%s%svia %s",
7caf8ab
 		 (packet -> raw -> htype
7caf8ab
-		  ? print_hw_addr (packet -> raw -> htype,
7caf8ab
-				   packet -> raw -> hlen,
7caf8ab
-				   packet -> raw -> chaddr)
7caf8ab
+		  ? print_hw_addr_or_client_id (packet)
7caf8ab
 		  : (lease
7caf8ab
 		     ? print_hex_1(lease->uid_len, lease->uid, 60)
7caf8ab
 		     : "<no identifier>")),
7caf8ab
@@ -478,9 +510,7 @@ void dhcprequest (packet, ms_nulltp, ip_
7caf8ab
 		 "DHCPREQUEST for %s%s from %s %s%s%svia %s",
7caf8ab
 		 piaddr (cip), smbuf,
7caf8ab
 		 (packet -> raw -> htype
7caf8ab
-		  ? print_hw_addr (packet -> raw -> htype,
7caf8ab
-				   packet -> raw -> hlen,
7caf8ab
-				   packet -> raw -> chaddr)
7caf8ab
+		  ? print_hw_addr_or_client_id(packet)
7caf8ab
 		  : (lease
7caf8ab
 		     ? print_hex_1(lease->uid_len, lease->uid, 60)
7caf8ab
 		     : "<no identifier>")),
7caf8ab
@@ -719,9 +749,7 @@ void dhcprelease (packet, ms_nulltp)
7caf8ab
 	if ((oc = lookup_option (&dhcp_universe, packet -> options,
7caf8ab
 				 DHO_DHCP_REQUESTED_ADDRESS))) {
7caf8ab
 		log_info ("DHCPRELEASE from %s specified requested-address.",
7caf8ab
-		      print_hw_addr (packet -> raw -> htype,
7caf8ab
-				     packet -> raw -> hlen,
7caf8ab
-				     packet -> raw -> chaddr));
7caf8ab
+		      print_hw_addr_or_client_id(packet));
7caf8ab
 	}
7caf8ab
 
7caf8ab
 	oc = lookup_option (&dhcp_universe, packet -> options,
7caf8ab
@@ -795,9 +823,7 @@ void dhcprelease (packet, ms_nulltp)
7caf8ab
 		 "DHCPRELEASE of %s from %s %s%s%svia %s (%sfound)",
7caf8ab
 		 cstr,
7caf8ab
 		 (packet -> raw -> htype
7caf8ab
-		  ? print_hw_addr (packet -> raw -> htype,
7caf8ab
-				   packet -> raw -> hlen,
7caf8ab
-				   packet -> raw -> chaddr)
7caf8ab
+		  ? print_hw_addr_or_client_id(packet)
7caf8ab
 		  : (lease
7caf8ab
 		     ? print_hex_1(lease->uid_len, lease->uid, 60)
7caf8ab
 		     : "<no identifier>")),
7caf8ab
@@ -886,9 +912,7 @@ void dhcpdecline (packet, ms_nulltp)
7caf8ab
 		 "DHCPDECLINE of %s from %s %s%s%svia %s",
7caf8ab
 		 piaddr (cip),
7caf8ab
 		 (packet -> raw -> htype
7caf8ab
-		  ? print_hw_addr (packet -> raw -> htype,
7caf8ab
-				   packet -> raw -> hlen,
7caf8ab
-				   packet -> raw -> chaddr)
7caf8ab
+		  ? print_hw_addr_or_client_id(packet)
7caf8ab
 		  : (lease
7caf8ab
 		     ? print_hex_1(lease->uid_len, lease->uid, 60)
7caf8ab
 		     : "<no identifier>")),
7caf8ab
@@ -1541,8 +1565,7 @@ void dhcpinform (packet, ms_nulltp)
7caf8ab
 	/* Report what we're sending. */
7caf8ab
 	snprintf(msgbuf, sizeof msgbuf, "DHCPACK to %s (%s) via", piaddr(cip),
7caf8ab
 		 (packet->raw->htype && packet->raw->hlen) ?
7caf8ab
-			print_hw_addr(packet->raw->htype, packet->raw->hlen,
7caf8ab
-				      packet->raw->chaddr) :
7caf8ab
+			print_hw_addr_or_client_id(packet) :
7caf8ab
 			"<no client hardware address>");
7caf8ab
 	log_info("%s %s", msgbuf, gip.len ? piaddr(gip) :
7caf8ab
 					    packet->interface->name);
7caf8ab
@@ -1682,9 +1705,7 @@ void nak_lease (packet, cip)
7caf8ab
 	/* Report what we're sending... */
7caf8ab
 	log_info ("DHCPNAK on %s to %s via %s",
7caf8ab
 	      piaddr (*cip),
7caf8ab
-	      print_hw_addr (packet -> raw -> htype,
7caf8ab
-			     packet -> raw -> hlen,
7caf8ab
-			     packet -> raw -> chaddr),
7caf8ab
+	      print_hw_addr_or_client_id(packet),
7caf8ab
 	      packet -> raw -> giaddr.s_addr
7caf8ab
 	      ? inet_ntoa (packet -> raw -> giaddr)
7caf8ab
 	      : packet -> interface -> name);
7caf8ab
@@ -3468,7 +3489,7 @@ void dhcp_reply (lease)
7caf8ab
 		   ? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER")
7caf8ab
 		   : "BOOTREPLY"),
7caf8ab
 		  piaddr (lease -> ip_addr),
7caf8ab
-		  (lease -> hardware_addr.hlen
7caf8ab
+		  (lease -> hardware_addr.hlen > 1
7caf8ab
 		   ? print_hw_addr (lease -> hardware_addr.hbuf [0],
7caf8ab
 				    lease -> hardware_addr.hlen - 1,
7caf8ab
 				    &lease -> hardware_addr.hbuf [1])
7caf8ab
@@ -4022,10 +4043,7 @@ int find_lease (struct lease **lp,
7caf8ab
 			if (uid_lease) {
7caf8ab
 			    if (uid_lease->binding_state == FTS_ACTIVE) {
7caf8ab
 				log_error ("client %s has duplicate%s on %s",
7caf8ab
-					   (print_hw_addr
7caf8ab
-					    (packet -> raw -> htype,
7caf8ab
-					     packet -> raw -> hlen,
7caf8ab
-					     packet -> raw -> chaddr)),
7caf8ab
+					   (print_hw_addr_or_client_id(packet)),
7caf8ab
 					   " leases",
7caf8ab
 					   (ip_lease -> subnet ->
7caf8ab
 					    shared_network -> name));
7caf8ab
@@ -4192,9 +4210,7 @@ int find_lease (struct lease **lp,
7caf8ab
 			log_error("uid lease %s for client %s is duplicate "
7caf8ab
 				  "on %s",
7caf8ab
 				  piaddr(uid_lease->ip_addr),
7caf8ab
-				  print_hw_addr(packet->raw->htype,
7caf8ab
-						packet->raw->hlen,
7caf8ab
-						packet->raw->chaddr),
7caf8ab
+				  print_hw_addr_or_client_id(packet),
7caf8ab
 				  uid_lease->subnet->shared_network->name);
7caf8ab
 
7caf8ab
 			if (!packet -> raw -> ciaddr.s_addr &&