ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/slirp/bootp.c
(Generate patch)

Comparing BasiliskII/src/slirp/bootp.c (file contents):
Revision 1.2 by gbeauche, 2005-05-13T14:02:37Z vs.
Revision 1.3 by gbeauche, 2005-05-14T17:37:07Z

# Line 40 | Line 40 | BOOTPClient bootp_clients[NB_ADDR];
40  
41   static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
42  
43 #ifdef DEBUG
44 #define dprintf(fmt, args...) \
45 if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## args); fflush(dfd); }
46 #else
47 #define dprintf(fmt, args...)
48 #endif
49
43   static BOOTPClient *get_new_addr(struct in_addr *paddr)
44   {
45      BOOTPClient *bc;
# Line 107 | Line 100 | static void dhcp_decode(const uint8_t *b
100              if (p >= p_end)
101                  break;
102              len = *p++;
110            dprintf("dhcp: tag=0x%02x len=%d\n", tag, len);
103  
104              switch(tag) {
105              case RFC2132_MSG_TYPE:
# Line 134 | Line 126 | static void bootp_reply(struct bootp_t *
126  
127      /* extract exact DHCP msg type */
128      dhcp_decode(bp->bp_vend, DHCP_OPT_LEN, &dhcp_msg_type);
137    dprintf("bootp packet op=%d msgtype=%d\n", bp->bp_op, dhcp_msg_type);
129      
130      if (dhcp_msg_type == 0)
131          dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */
# Line 155 | Line 146 | static void bootp_reply(struct bootp_t *
146      if (dhcp_msg_type == DHCPDISCOVER) {
147      new_addr:
148          bc = get_new_addr(&daddr.sin_addr);
149 <        if (!bc) {
159 <            dprintf("no address left\n");
149 >        if (!bc)
150              return;
161        }
151          memcpy(bc->macaddr, client_ethaddr, 6);
152      } else {
153          bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
# Line 168 | Line 157 | static void bootp_reply(struct bootp_t *
157              goto new_addr;
158          }
159      }
171    dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
160  
161      saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
162      saddr.sin_port = htons(BOOTP_SERVER);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines