]> git.ipfire.org Git - thirdparty/dhcp.git/blobdiff - common/ctrace.c
DHCPv6 branch merged to HEAD.
[thirdparty/dhcp.git] / common / ctrace.c
index 8bcb96741e2a41a926f6b634cac773775d004bc3..39dfdce49fa8e71ef7adfe6812f99bd986d2a8b7 100644 (file)
@@ -32,7 +32,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: ctrace.c,v 1.6 2006/08/09 14:57:47 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: ctrace.c,v 1.7 2007/05/08 23:05:20 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -46,8 +46,9 @@ void trace_interface_register (trace_type_t *ttype, struct interface_info *ip)
                memset (&tipkt, 0, sizeof tipkt);
                memcpy (&tipkt.hw_address,
                        &ip -> hw_address, sizeof ip -> hw_address);
-               memcpy (&tipkt.primary_address,
-                       &ip -> primary_address, sizeof ip -> primary_address);
+               if (ip->address_count)
+                       memcpy(&tipkt.primary_address,
+                              ip->addresses, sizeof(*ip->addresses));
                memcpy (tipkt.name, ip -> name, sizeof ip -> name);
                tipkt.index = htonl (ip -> index);
 
@@ -87,8 +88,12 @@ void trace_interface_input (trace_type_t *ttype, unsigned len, char *buf)
 
        memcpy (&ip -> hw_address, &tipkt -> hw_address,
                sizeof ip -> hw_address);
-       memcpy (&ip -> primary_address, &tipkt -> primary_address,
-               sizeof ip -> primary_address);
+       /* XXX: Without the full addresses state it's not quite a full
+        * trace.
+        */
+       ip->address_count = ip->address_max = 1;
+       ip->addresses = dmalloc(sizeof(*ip->addresses), MDL);
+       memcpy(ip->addresses, &tipkt->primary_address, sizeof(*ip->addresses));
        memcpy (ip -> name, tipkt -> name, sizeof ip -> name);
        ip -> index = ntohl (tipkt -> index);
 
@@ -102,7 +107,7 @@ void trace_interface_input (trace_type_t *ttype, unsigned len, char *buf)
        ip -> ifp -> ifr_addr.sa_len = sizeof (struct sockaddr_in);
 #endif
        sin = (struct sockaddr_in *)&ip -> ifp -> ifr_addr;
-       sin -> sin_addr = ip -> primary_address;
+       sin->sin_addr = ip->addresses[0];
 
        addr.len = 4;
        memcpy (addr.iabuf, &sin -> sin_addr.s_addr, addr.len);