#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"
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);
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);
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);