Magellan Linux

Diff of /trunk/mkinitrd-magellan/klibc/usr/kinit/ipconfig/bootp_proto.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1121 by niro, Fri Apr 24 18:32:46 2009 UTC revision 1122 by niro, Wed Aug 18 21:11:40 2010 UTC
# Line 49  int bootp_send_request(struct netdev *de Line 49  int bootp_send_request(struct netdev *de
49   bootp.secs = htons(time(NULL) - dev->open_time);   bootp.secs = htons(time(NULL) - dev->open_time);
50   memcpy(bootp.chaddr, dev->hwaddr, 16);   memcpy(bootp.chaddr, dev->hwaddr, 16);
51    
52   DEBUG(("-> bootp xid 0x%08x secs 0x%08x ",   dprintf("-> bootp xid 0x%08x secs 0x%08x ",
53         bootp.xid, ntohs(bootp.secs)));   bootp.xid, ntohs(bootp.secs));
54    
55   return packet_send(dev, iov, 2);   return packet_send(dev, iov, 2);
56  }  }
# Line 153  int bootp_parse(struct netdev *dev, stru Line 153  int bootp_parse(struct netdev *dev, stru
153    
154  /*  /*
155   * Receive a bootp reply and parse packet   * Receive a bootp reply and parse packet
156     * Returns:
157     *-1 = Error in packet_recv, try again later
158     * 0 = Unexpected packet, discarded
159     * 1 = Correctly received and parsed packet
160   */   */
161  int bootp_recv_reply(struct netdev *dev)  int bootp_recv_reply(struct netdev *dev)
162  {  {
# Line 167  int bootp_recv_reply(struct netdev *dev) Line 171  int bootp_recv_reply(struct netdev *dev)
171    
172   ret = packet_recv(iov, 3);   ret = packet_recv(iov, 3);
173   if (ret <= 0)   if (ret <= 0)
174   return ret;   return -1;
175    
176   if (ret < sizeof(struct bootp_hdr) ||   if (ret < sizeof(struct bootp_hdr) ||
177      bootp.op != BOOTP_REPLY || /* RFC951 7.5 */      bootp.op != BOOTP_REPLY || /* RFC951 7.5 */

Legend:
Removed from v.1121  
changed lines
  Added in v.1122