|
|
c360e8 |
diff -up dhcp-4.2.5/common/lpf.c.IPoIB-log-id dhcp-4.2.5/common/lpf.c
|
|
|
c360e8 |
--- dhcp-4.2.5/common/lpf.c.IPoIB-log-id 2014-09-08 14:50:39.000000000 +0200
|
|
|
c360e8 |
+++ dhcp-4.2.5/common/lpf.c 2014-09-08 14:54:43.935612705 +0200
|
|
|
c360e8 |
@@ -158,6 +158,7 @@ int if_register_lpf (info)
|
|
|
c360e8 |
void if_register_send (info)
|
|
|
c360e8 |
struct interface_info *info;
|
|
|
c360e8 |
{
|
|
|
c360e8 |
+ int hlen;
|
|
|
c360e8 |
/* If we're using the lpf API for sending and receiving,
|
|
|
c360e8 |
we don't need to register this interface twice. */
|
|
|
c360e8 |
#ifndef USE_LPF_RECEIVE
|
|
|
c360e8 |
@@ -165,11 +166,15 @@ void if_register_send (info)
|
|
|
c360e8 |
#else
|
|
|
c360e8 |
info -> wfdesc = info -> rfdesc;
|
|
|
c360e8 |
#endif
|
|
|
c360e8 |
+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND)
|
|
|
c360e8 |
+ hlen = 9;
|
|
|
c360e8 |
+ else
|
|
|
c360e8 |
+ hlen = info -> hw_address.hlen;
|
|
|
c360e8 |
if (!quiet_interface_discovery)
|
|
|
c360e8 |
log_info ("Sending on LPF/%s/%s%s%s",
|
|
|
c360e8 |
info -> name,
|
|
|
c360e8 |
print_hw_addr (info -> hw_address.hbuf [0],
|
|
|
c360e8 |
- info -> hw_address.hlen - 1,
|
|
|
c360e8 |
+ hlen - 1,
|
|
|
c360e8 |
&info -> hw_address.hbuf [1]),
|
|
|
c360e8 |
(info -> shared_network ? "/" : ""),
|
|
|
c360e8 |
(info -> shared_network ?
|
|
|
c360e8 |
@@ -179,6 +184,9 @@ void if_register_send (info)
|
|
|
c360e8 |
void if_deregister_send (info)
|
|
|
c360e8 |
struct interface_info *info;
|
|
|
c360e8 |
{
|
|
|
c360e8 |
+ int hlen = info -> hw_address.hlen;
|
|
|
c360e8 |
+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND)
|
|
|
c360e8 |
+ hlen = 9;
|
|
|
c360e8 |
/* don't need to close twice if we are using lpf for sending and
|
|
|
c360e8 |
receiving */
|
|
|
c360e8 |
#ifndef USE_LPF_RECEIVE
|
|
|
c360e8 |
@@ -191,7 +199,7 @@ void if_deregister_send (info)
|
|
|
c360e8 |
log_info ("Disabling output on LPF/%s/%s%s%s",
|
|
|
c360e8 |
info -> name,
|
|
|
c360e8 |
print_hw_addr (info -> hw_address.hbuf [0],
|
|
|
c360e8 |
- info -> hw_address.hlen - 1,
|
|
|
c360e8 |
+ hlen - 1,
|
|
|
c360e8 |
&info -> hw_address.hbuf [1]),
|
|
|
c360e8 |
(info -> shared_network ? "/" : ""),
|
|
|
c360e8 |
(info -> shared_network ?
|
|
|
c360e8 |
@@ -218,7 +226,7 @@ static void lpf_gen_filter_setup (struct
|
|
|
c360e8 |
void if_register_receive (info)
|
|
|
c360e8 |
struct interface_info *info;
|
|
|
c360e8 |
{
|
|
|
c360e8 |
- int val;
|
|
|
c360e8 |
+ int val, hlen;
|
|
|
c360e8 |
|
|
|
c360e8 |
/* Open a LPF device and hang it on this interface... */
|
|
|
c360e8 |
info -> rfdesc = if_register_lpf (info);
|
|
|
c360e8 |
@@ -230,7 +238,9 @@ void if_register_receive (info)
|
|
|
c360e8 |
if (errno != ENOPROTOOPT)
|
|
|
c360e8 |
log_fatal ("Failed to set auxiliary packet data: %m");
|
|
|
c360e8 |
}
|
|
|
c360e8 |
- }
|
|
|
c360e8 |
+ hlen = info -> hw_address.hlen;
|
|
|
c360e8 |
+ } else
|
|
|
c360e8 |
+ hlen = 9;
|
|
|
c360e8 |
|
|
|
c360e8 |
#if defined (HAVE_TR_SUPPORT)
|
|
|
c360e8 |
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
|
|
|
c360e8 |
@@ -243,7 +253,7 @@ void if_register_receive (info)
|
|
|
c360e8 |
log_info ("Listening on LPF/%s/%s%s%s",
|
|
|
c360e8 |
info -> name,
|
|
|
c360e8 |
print_hw_addr (info -> hw_address.hbuf [0],
|
|
|
c360e8 |
- info -> hw_address.hlen - 1,
|
|
|
c360e8 |
+ hlen - 1,
|
|
|
c360e8 |
&info -> hw_address.hbuf [1]),
|
|
|
c360e8 |
(info -> shared_network ? "/" : ""),
|
|
|
c360e8 |
(info -> shared_network ?
|
|
|
c360e8 |
@@ -253,6 +263,9 @@ void if_register_receive (info)
|
|
|
c360e8 |
void if_deregister_receive (info)
|
|
|
c360e8 |
struct interface_info *info;
|
|
|
c360e8 |
{
|
|
|
c360e8 |
+ int hlen = info -> hw_address.hlen;
|
|
|
c360e8 |
+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND)
|
|
|
c360e8 |
+ hlen = 9;
|
|
|
c360e8 |
/* for LPF this is simple, packet filters are removed when sockets
|
|
|
c360e8 |
are closed */
|
|
|
c360e8 |
close (info -> rfdesc);
|
|
|
c360e8 |
@@ -261,7 +274,7 @@ void if_deregister_receive (info)
|
|
|
c360e8 |
log_info ("Disabling input on LPF/%s/%s%s%s",
|
|
|
c360e8 |
info -> name,
|
|
|
c360e8 |
print_hw_addr (info -> hw_address.hbuf [0],
|
|
|
c360e8 |
- info -> hw_address.hlen - 1,
|
|
|
c360e8 |
+ hlen - 1,
|
|
|
c360e8 |
&info -> hw_address.hbuf [1]),
|
|
|
c360e8 |
(info -> shared_network ? "/" : ""),
|
|
|
c360e8 |
(info -> shared_network ?
|
|
|
c360e8 |
diff -up dhcp-4.2.5/server/dhcp.c.IPoIB-log-id dhcp-4.2.5/server/dhcp.c
|
|
|
c360e8 |
--- dhcp-4.2.5/server/dhcp.c.IPoIB-log-id 2014-09-08 14:50:39.000000000 +0200
|
|
|
c360e8 |
+++ dhcp-4.2.5/server/dhcp.c 2014-09-08 15:06:28.367697349 +0200
|
|
|
c360e8 |
@@ -80,6 +80,42 @@ const int dhcp_type_name_max = ((sizeof
|
|
|
c360e8 |
# define send_packet trace_packet_send
|
|
|
c360e8 |
#endif
|
|
|
c360e8 |
|
|
|
c360e8 |
+char *print_client_identifier_from_packet (packet)
|
|
|
c360e8 |
+ struct packet *packet;
|
|
|
c360e8 |
+{
|
|
|
c360e8 |
+ struct option_cache *oc;
|
|
|
c360e8 |
+ struct data_string client_identifier;
|
|
|
c360e8 |
+ char *ci;
|
|
|
c360e8 |
+
|
|
|
c360e8 |
+ memset (&client_identifier, 0, sizeof client_identifier);
|
|
|
c360e8 |
+
|
|
|
c360e8 |
+ oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
c360e8 |
+ DHO_DHCP_CLIENT_IDENTIFIER);
|
|
|
c360e8 |
+ if (oc &&
|
|
|
c360e8 |
+ evaluate_option_cache (&client_identifier,
|
|
|
c360e8 |
+ packet, (struct lease *)0,
|
|
|
c360e8 |
+ (struct client_state *)0,
|
|
|
c360e8 |
+ packet -> options,
|
|
|
c360e8 |
+ (struct option_state *)0,
|
|
|
c360e8 |
+ &global_scope, oc, MDL)) {
|
|
|
c360e8 |
+ ci = print_hw_addr (HTYPE_INFINIBAND, client_identifier.len, client_identifier.data);
|
|
|
c360e8 |
+ data_string_forget (&client_identifier, MDL);
|
|
|
c360e8 |
+ return ci;
|
|
|
c360e8 |
+ } else
|
|
|
c360e8 |
+ return "\"no client id\"";
|
|
|
c360e8 |
+}
|
|
|
c360e8 |
+
|
|
|
c360e8 |
+char *print_hw_addr_or_client_id (packet)
|
|
|
c360e8 |
+ struct packet *packet;
|
|
|
c360e8 |
+{
|
|
|
c360e8 |
+ if (packet -> raw -> htype == HTYPE_INFINIBAND)
|
|
|
c360e8 |
+ return print_client_identifier_from_packet (packet);
|
|
|
c360e8 |
+ else
|
|
|
c360e8 |
+ return print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
+ packet -> raw -> hlen,
|
|
|
c360e8 |
+ packet -> raw -> chaddr);
|
|
|
c360e8 |
+}
|
|
|
c360e8 |
+
|
|
|
c360e8 |
void
|
|
|
c360e8 |
dhcp (struct packet *packet) {
|
|
|
c360e8 |
int ms_nulltp = 0;
|
|
|
c360e8 |
@@ -108,9 +144,7 @@ dhcp (struct packet *packet) {
|
|
|
c360e8 |
|
|
|
c360e8 |
log_info("%s from %s via %s: %s", s,
|
|
|
c360e8 |
(packet->raw->htype
|
|
|
c360e8 |
- ? print_hw_addr(packet->raw->htype,
|
|
|
c360e8 |
- packet->raw->hlen,
|
|
|
c360e8 |
- packet->raw->chaddr)
|
|
|
c360e8 |
+ ? print_hw_addr_or_client_id (packet)
|
|
|
c360e8 |
: "<no identifier>"),
|
|
|
c360e8 |
packet->raw->giaddr.s_addr
|
|
|
c360e8 |
? inet_ntoa(packet->raw->giaddr)
|
|
|
c360e8 |
@@ -294,9 +328,7 @@ void dhcpdiscover (packet, ms_nulltp)
|
|
|
c360e8 |
*/
|
|
|
c360e8 |
snprintf (msgbuf, sizeof msgbuf, "DHCPDISCOVER from %s %s%s%svia %s",
|
|
|
c360e8 |
(packet -> raw -> htype
|
|
|
c360e8 |
- ? print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr)
|
|
|
c360e8 |
+ ? print_hw_addr_or_client_id (packet)
|
|
|
c360e8 |
: (lease
|
|
|
c360e8 |
? print_hex_1(lease->uid_len, lease->uid, 60)
|
|
|
c360e8 |
: "<no identifier>")),
|
|
|
c360e8 |
@@ -490,9 +522,7 @@ void dhcprequest (packet, ms_nulltp, ip_
|
|
|
c360e8 |
"DHCPREQUEST for %s%s from %s %s%s%svia %s",
|
|
|
c360e8 |
piaddr (cip), smbuf,
|
|
|
c360e8 |
(packet -> raw -> htype
|
|
|
c360e8 |
- ? print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr)
|
|
|
c360e8 |
+ ? print_hw_addr_or_client_id (packet)
|
|
|
c360e8 |
: (lease
|
|
|
c360e8 |
? print_hex_1(lease->uid_len, lease->uid, 60)
|
|
|
c360e8 |
: "<no identifier>")),
|
|
|
c360e8 |
@@ -735,9 +765,7 @@ void dhcprelease (packet, ms_nulltp)
|
|
|
c360e8 |
if ((oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
c360e8 |
DHO_DHCP_REQUESTED_ADDRESS))) {
|
|
|
c360e8 |
log_info ("DHCPRELEASE from %s specified requested-address.",
|
|
|
c360e8 |
- print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr));
|
|
|
c360e8 |
+ print_hw_addr_or_client_id (packet));
|
|
|
c360e8 |
}
|
|
|
c360e8 |
|
|
|
c360e8 |
oc = lookup_option (&dhcp_universe, packet -> options,
|
|
|
c360e8 |
@@ -811,9 +839,7 @@ void dhcprelease (packet, ms_nulltp)
|
|
|
c360e8 |
"DHCPRELEASE of %s from %s %s%s%svia %s (%sfound)",
|
|
|
c360e8 |
cstr,
|
|
|
c360e8 |
(packet -> raw -> htype
|
|
|
c360e8 |
- ? print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr)
|
|
|
c360e8 |
+ ? print_hw_addr_or_client_id (packet)
|
|
|
c360e8 |
: (lease
|
|
|
c360e8 |
? print_hex_1(lease->uid_len, lease->uid, 60)
|
|
|
c360e8 |
: "<no identifier>")),
|
|
|
c360e8 |
@@ -906,9 +932,7 @@ void dhcpdecline (packet, ms_nulltp)
|
|
|
c360e8 |
"DHCPDECLINE of %s from %s %s%s%svia %s",
|
|
|
c360e8 |
piaddr (cip),
|
|
|
c360e8 |
(packet -> raw -> htype
|
|
|
c360e8 |
- ? print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr)
|
|
|
c360e8 |
+ ? print_hw_addr_or_client_id(packet)
|
|
|
c360e8 |
: (lease
|
|
|
c360e8 |
? print_hex_1(lease->uid_len, lease->uid, 60)
|
|
|
c360e8 |
: "<no identifier>")),
|
|
|
c360e8 |
@@ -1348,8 +1372,7 @@ void dhcpinform (packet, ms_nulltp)
|
|
|
c360e8 |
/* Report what we're sending. */
|
|
|
c360e8 |
snprintf(msgbuf, sizeof msgbuf, "DHCPACK to %s (%s) via", piaddr(cip),
|
|
|
c360e8 |
(packet->raw->htype && packet->raw->hlen) ?
|
|
|
c360e8 |
- print_hw_addr(packet->raw->htype, packet->raw->hlen,
|
|
|
c360e8 |
- packet->raw->chaddr) :
|
|
|
c360e8 |
+ print_hw_addr_or_client_id(packet) :
|
|
|
c360e8 |
"<no client hardware address>");
|
|
|
c360e8 |
log_info("%s %s", msgbuf, gip.len ? piaddr(gip) :
|
|
|
c360e8 |
packet->interface->name);
|
|
|
c360e8 |
@@ -1493,9 +1516,7 @@ void nak_lease (packet, cip)
|
|
|
c360e8 |
/* Report what we're sending... */
|
|
|
c360e8 |
log_info ("DHCPNAK on %s to %s via %s",
|
|
|
c360e8 |
piaddr (*cip),
|
|
|
c360e8 |
- print_hw_addr (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr),
|
|
|
c360e8 |
+ print_hw_addr_or_client_id (packet),
|
|
|
c360e8 |
packet -> raw -> giaddr.s_addr
|
|
|
c360e8 |
? inet_ntoa (packet -> raw -> giaddr)
|
|
|
c360e8 |
: packet -> interface -> name);
|
|
|
c360e8 |
@@ -3214,7 +3235,7 @@ void dhcp_reply (lease)
|
|
|
c360e8 |
? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER")
|
|
|
c360e8 |
: "BOOTREPLY"),
|
|
|
c360e8 |
piaddr (lease -> ip_addr),
|
|
|
c360e8 |
- (lease -> hardware_addr.hlen
|
|
|
c360e8 |
+ (lease -> hardware_addr.hlen > 1
|
|
|
c360e8 |
? print_hw_addr (lease -> hardware_addr.hbuf [0],
|
|
|
c360e8 |
lease -> hardware_addr.hlen - 1,
|
|
|
c360e8 |
&lease -> hardware_addr.hbuf [1])
|
|
|
c360e8 |
@@ -3772,10 +3793,7 @@ int find_lease (struct lease **lp,
|
|
|
c360e8 |
if (uid_lease) {
|
|
|
c360e8 |
if (uid_lease->binding_state == FTS_ACTIVE) {
|
|
|
c360e8 |
log_error ("client %s has duplicate%s on %s",
|
|
|
c360e8 |
- (print_hw_addr
|
|
|
c360e8 |
- (packet -> raw -> htype,
|
|
|
c360e8 |
- packet -> raw -> hlen,
|
|
|
c360e8 |
- packet -> raw -> chaddr)),
|
|
|
c360e8 |
+ (print_hw_addr_or_client_id(packet)),
|
|
|
c360e8 |
" leases",
|
|
|
c360e8 |
(ip_lease -> subnet ->
|
|
|
c360e8 |
shared_network -> name));
|
|
|
c360e8 |
@@ -3942,9 +3960,7 @@ int find_lease (struct lease **lp,
|
|
|
c360e8 |
log_error("uid lease %s for client %s is duplicate "
|
|
|
c360e8 |
"on %s",
|
|
|
c360e8 |
piaddr(uid_lease->ip_addr),
|
|
|
c360e8 |
- print_hw_addr(packet->raw->htype,
|
|
|
c360e8 |
- packet->raw->hlen,
|
|
|
c360e8 |
- packet->raw->chaddr),
|
|
|
c360e8 |
+ print_hw_addr_or_client_id(packet),
|
|
|
c360e8 |
uid_lease->subnet->shared_network->name);
|
|
|
c360e8 |
|
|
|
c360e8 |
if (!packet -> raw -> ciaddr.s_addr &&
|