From: Roy Marples Date: Mon, 8 Oct 2012 16:13:47 +0000 (+0000) Subject: xid should be treated in network byte order X-Git-Tag: v5.99.3~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7d18e2ceb8913b263ec7d528333ede9fd99001b;p=thirdparty%2Fdhcpcd.git xid should be treated in network byte order --- diff --git a/dhcp.c b/dhcp.c index 742e352d..df7c55a5 100644 --- a/dhcp.c +++ b/dhcp.c @@ -951,7 +951,7 @@ make_message(struct dhcp_message **message, else dhcp->secs = htons(up); } - dhcp->xid = iface->state->xid; + dhcp->xid = htonl(iface->state->xid); dhcp->cookie = htonl(MAGIC_COOKIE); *p++ = DHO_MESSAGETYPE; diff --git a/dhcpcd.c b/dhcpcd.c index f5f51dd2..b0c202ed 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -718,10 +718,10 @@ handle_dhcp_packet(void *arg) continue; } /* Ensure it's the right transaction */ - if (iface->state->xid != dhcp->xid) { + if (iface->state->xid != ntohl(dhcp->xid)) { syslog(LOG_DEBUG, "%s: wrong xid 0x%x (expecting 0x%x) from %s", - iface->name, dhcp->xid, iface->state->xid, + iface->name, ntohl(dhcp->xid), iface->state->xid, inet_ntoa(from)); continue; } @@ -730,7 +730,7 @@ handle_dhcp_packet(void *arg) memcmp(dhcp->chaddr, iface->hwaddr, iface->hwlen)) { syslog(LOG_DEBUG, "%s: xid 0x%x is not for hwaddr %s", - iface->name, dhcp->xid, + iface->name, ntohl(dhcp->xid), hwaddr_ntoa(dhcp->chaddr, sizeof(dhcp->chaddr))); continue; }