summaryrefslogtreecommitdiff
path: root/gdhcp
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-04-26 09:51:28 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-04-26 13:05:11 +0300
commit9f1f8cacfac8a15f44d2cece08427cb93b7c3c4c (patch)
tree18d847ecc6d3d8b58623540d158804d84d5ee66c /gdhcp
parent1f8a5316fdc8c17b3e2af1d011b65d584857997f (diff)
downloadconnman-9f1f8cacfac8a15f44d2cece08427cb93b7c3c4c.tar.gz
connman-9f1f8cacfac8a15f44d2cece08427cb93b7c3c4c.tar.bz2
connman-9f1f8cacfac8a15f44d2cece08427cb93b7c3c4c.zip
gdhcp: Add debug print for transaction id
Print transaction id of sent and received messages so that it is easier to match the packets.
Diffstat (limited to 'gdhcp')
-rw-r--r--gdhcp/client.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index e8fa5d52..34e773f0 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -797,14 +797,15 @@ static int send_dhcpv6_msg(GDHCPClient *dhcp_client, int type, char *msg)
packet = (struct dhcpv6_packet *)&buf[0];
ptr = buf + sizeof(struct dhcpv6_packet);
- debug(dhcp_client, "sending DHCPv6 %s message", msg);
-
init_packet(dhcp_client, packet, type);
dhcp_client->xid = packet->transaction_id[0] << 16 |
packet->transaction_id[1] << 8 |
packet->transaction_id[2];
+ debug(dhcp_client, "sending DHCPv6 %s message xid 0x%04x", msg,
+ dhcp_client->xid);
+
max_buf = MAX_DHCPV6_PKT_SIZE - sizeof(struct dhcpv6_packet);
add_dhcpv6_request_options(dhcp_client, packet, buf, max_buf, &ptr);
@@ -1823,6 +1824,7 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
uint8_t *message_type = NULL, *client_id = NULL, *option,
*server_id = NULL;
uint16_t option_len = 0, status = 0;
+ uint32_t xid = 0;
gpointer pkt;
unsigned char buf[MAX_DHCPV6_PKT_SIZE];
uint16_t pkt_len = 0;
@@ -1848,9 +1850,14 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
dhcp_client->listener_sockfd);
pkt_len = re;
pkt = packet6;
- } else
+ xid = packet6->transaction_id[0] << 16 |
+ packet6->transaction_id[1] << 8 |
+ packet6->transaction_id[2];
+ } else {
re = dhcp_recv_l3_packet(&packet,
dhcp_client->listener_sockfd);
+ xid = packet.xid;
+ }
} else if (dhcp_client->listen_mode == L_ARP) {
ipv4ll_recv_arp_packet(dhcp_client);
return TRUE;
@@ -1910,8 +1917,8 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
/* No message type / client id option, ignore package */
return TRUE;
- debug(dhcp_client, "received DHCP packet (current state %d)",
- dhcp_client->state);
+ debug(dhcp_client, "received DHCP packet xid 0x%04x "
+ "(current state %d)", xid, dhcp_client->state);
switch (dhcp_client->state) {
case INIT_SELECTING: