Hi

This one gets rid of the second DHCPDISCOVER packet which is the
correct way to do it, as far as I can tell from the RFC's..



--- anaconda-rawhide.orig/pump/dhcp.c   Wed Nov 10 18:51:36 1999
+++ anaconda-rawhide/pump/dhcp.c        Mon Nov 29 18:14:20 1999
@@ -1045,7 +1042,6 @@
     struct sockaddr_in clientAddr;
     struct sockaddr_in broadcastAddr;
     struct bootpRequest breq, bresp;
-    struct bootpRequest protoReq;
     unsigned char * chptr;
     unsigned char messageType;
     time_t startTime = time(NULL);
@@ -1129,10 +1129,10 @@
     }
 
     /* Otherwise we're in the land of bootp */
+    /* Yes, but we still should not send more than one DHCPDISCOVER,
+       as that is what is specified in RFC 1534 and 2131.
+                                               -- [EMAIL PROTECTED] */
     if (dhcpMessageType(&bresp) == DHCP_TYPE_OFFER) {
-       /* Admittedly, this seems a bit odd. If we find a dhcp server, we
-          rerun the dhcp discover broadcast, but with the proper option
-          field this time. This makes me rfc compliant. */
        syslog (LOG_DEBUG, "got dhcp offer\n");
 
        initVendorCodes(&breq);
@@ -1172,47 +1172,25 @@
        i = htonl(intf->reqLease);
        addVendorCode(&breq, DHCP_OPTION_LEASE, 4, &i);
 
-       protoReq = breq;
-
-       syslog (LOG_DEBUG, "PUMP: sending second discover");
-
-       messageType = DHCP_TYPE_DISCOVER;
-       addVendorCode(&breq, DHCP_OPTION_TYPE, 1, &messageType);
-
-       /* Send another DHCP_REQUEST with the proper option list */
-       if ((chptr = handleTransaction(s, override, &breq, &bresp, 
-                                      &broadcastAddr, NULL, 1, 
-                                      DHCP_TYPE_OFFER))) {
-           close(s);
-           pumpDisableInterface(intf->device);
-           return chptr;
-       }
-
-
-       if (dhcpMessageType(&bresp) != DHCP_TYPE_OFFER) {
-           close(s);
-           pumpDisableInterface(intf->device);
-           return "dhcp offer expected";
-       }
-
-       syslog (LOG_DEBUG, "PUMP: got an offer");
-
        if (getVendorCode(&bresp, DHCP_OPTION_SERVER, &serverAddr.sin_addr)) {
-           syslog (LOG_DEBUG, "DHCPOFFER didn't include server address");
+           syslog (LOG_WARNING, "DHCPOFFER didn't include server address");
            intf->bootServer = broadcastAddr.sin_addr;
        }
+       /* Now would probably be a good time listen look at other
+          DHCPOFFER packets or maybe send a new DHCPDISCOVER.
+                                               -- [EMAIL PROTECTED] */
 
-       breq = protoReq;
        messageType = DHCP_TYPE_REQUEST;
        addVendorCode(&breq, DHCP_OPTION_TYPE, 1, &messageType);
 
        addVendorCode(&breq, DHCP_OPTION_SERVER, 4, &serverAddr.sin_addr);
        addVendorCode(&breq, DHCP_OPTION_REQADDR, 4, &bresp.yiaddr);
 
-       /* why do we need to use the broadcast address here? better reread the
-          spec! */
+       /* Now broadcast a DHCPREQUEST with the proper option list.  It has
+          to be broadcast so that any other standing DHCPOFFER is
+          declined.                            -- [EMAIL PROTECTED] */
        if ((chptr = handleTransaction(s, override, &breq, &bresp, 
-                                      &broadcastAddr, NULL, 0, 
+                                      &broadcastAddr, NULL, 1, 
                                       DHCP_TYPE_ACK))) {
            close(s);
            pumpDisableInterface(intf->device);




/bart
-- 
caffeine low .... brain halted

-- 
To unsubscribe:
mail -s unsubscribe [EMAIL PROTECTED] < /dev/null

Reply via email to