]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
xid should be treated in network byte order
authorRoy Marples <roy@marples.name>
Mon, 8 Oct 2012 16:13:47 +0000 (16:13 +0000)
committerRoy Marples <roy@marples.name>
Mon, 8 Oct 2012 16:13:47 +0000 (16:13 +0000)
dhcp.c
dhcpcd.c

diff --git a/dhcp.c b/dhcp.c
index 742e352d5079dceb27f202c9c243617a69903855..df7c55a516189d6437757cbf3056ee88090a9763 100644 (file)
--- 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; 
index f5f51dd2f6a34145cb80d7dd6bc6c245573c2ca7..b0c202edb2717c47145eff93f176e379206ac8c8 100644 (file)
--- 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;
                }