Home | History | Annotate | Line # | Download | only in libsa
bootp.c revision 1.11.4.2
      1  1.11.4.2   thorpej /*	$NetBSD: bootp.c,v 1.11.4.2 1997/09/22 06:33:51 thorpej Exp $	*/
      2       1.2       cgd 
      3       1.1    brezak /*
      4       1.1    brezak  * Copyright (c) 1992 Regents of the University of California.
      5       1.1    brezak  * All rights reserved.
      6       1.1    brezak  *
      7       1.1    brezak  * This software was developed by the Computer Systems Engineering group
      8       1.1    brezak  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9       1.1    brezak  * contributed to Berkeley.
     10       1.1    brezak  *
     11       1.1    brezak  * Redistribution and use in source and binary forms, with or without
     12       1.1    brezak  * modification, are permitted provided that the following conditions
     13       1.1    brezak  * are met:
     14       1.1    brezak  * 1. Redistributions of source code must retain the above copyright
     15       1.1    brezak  *    notice, this list of conditions and the following disclaimer.
     16       1.1    brezak  * 2. Redistributions in binary form must reproduce the above copyright
     17       1.1    brezak  *    notice, this list of conditions and the following disclaimer in the
     18       1.1    brezak  *    documentation and/or other materials provided with the distribution.
     19       1.1    brezak  * 3. All advertising materials mentioning features or use of this software
     20       1.1    brezak  *    must display the following acknowledgement:
     21       1.1    brezak  *	This product includes software developed by the University of
     22       1.1    brezak  *	California, Lawrence Berkeley Laboratory and its contributors.
     23       1.1    brezak  * 4. Neither the name of the University nor the names of its contributors
     24       1.1    brezak  *    may be used to endorse or promote products derived from this software
     25       1.1    brezak  *    without specific prior written permission.
     26       1.1    brezak  *
     27       1.1    brezak  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     28       1.1    brezak  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     29       1.1    brezak  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     30       1.1    brezak  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     31       1.1    brezak  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     32       1.1    brezak  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     33       1.1    brezak  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     34       1.1    brezak  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     35       1.1    brezak  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     36       1.1    brezak  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     37       1.1    brezak  * SUCH DAMAGE.
     38       1.1    brezak  *
     39       1.2       cgd  * @(#) Header: bootp.c,v 1.4 93/09/11 03:13:51 leres Exp  (LBL)
     40       1.1    brezak  */
     41       1.1    brezak 
     42       1.1    brezak #include <sys/types.h>
     43       1.1    brezak #include <netinet/in.h>
     44       1.1    brezak #include <netinet/in_systm.h>
     45       1.1    brezak 
     46      1.11  drochner #ifdef _STANDALONE
     47      1.11  drochner #include <lib/libkern/libkern.h>
     48      1.11  drochner #else
     49       1.1    brezak #include <string.h>
     50      1.11  drochner #endif
     51       1.1    brezak 
     52       1.1    brezak #include "stand.h"
     53       1.1    brezak #include "net.h"
     54       1.1    brezak #include "netif.h"
     55       1.1    brezak #include "bootp.h"
     56       1.1    brezak 
     57  1.11.4.2   thorpej struct in_addr servip;
     58  1.11.4.2   thorpej 
     59       1.1    brezak static n_long	nmask, smask;
     60       1.1    brezak 
     61       1.1    brezak static time_t	bot;
     62       1.1    brezak 
     63       1.1    brezak static	char vm_rfc1048[4] = VM_RFC1048;
     64  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
     65       1.1    brezak static	char vm_cmu[4] = VM_CMU;
     66  1.11.4.1   thorpej #endif
     67       1.1    brezak 
     68       1.1    brezak /* Local forwards */
     69       1.6        pk static	ssize_t bootpsend __P((struct iodesc *, void *, size_t));
     70       1.6        pk static	ssize_t bootprecv __P((struct iodesc *, void *, size_t, time_t));
     71  1.11.4.1   thorpej static	int vend_rfc1048 __P((u_char *, u_int));
     72  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
     73       1.1    brezak static	void vend_cmu __P((u_char *));
     74  1.11.4.1   thorpej #endif
     75  1.11.4.1   thorpej 
     76  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
     77  1.11.4.1   thorpej static char expected_dhcpmsgtype = -1, dhcp_ok;
     78  1.11.4.1   thorpej struct in_addr dhcp_serverip;
     79  1.11.4.1   thorpej #endif
     80       1.1    brezak 
     81       1.1    brezak /* Fetch required bootp infomation */
     82       1.1    brezak void
     83       1.1    brezak bootp(sock)
     84       1.1    brezak 	int sock;
     85       1.1    brezak {
     86       1.1    brezak 	struct iodesc *d;
     87       1.1    brezak 	register struct bootp *bp;
     88       1.1    brezak 	struct {
     89       1.1    brezak 		u_char header[HEADER_SIZE];
     90       1.1    brezak 		struct bootp wbootp;
     91       1.1    brezak 	} wbuf;
     92       1.3   mycroft 	struct {
     93       1.3   mycroft 		u_char header[HEADER_SIZE];
     94       1.3   mycroft 		struct bootp rbootp;
     95       1.1    brezak 	} rbuf;
     96       1.1    brezak 
     97       1.1    brezak #ifdef BOOTP_DEBUG
     98       1.1    brezak  	if (debug)
     99      1.10  christos 		printf("bootp: socket=%d\n", sock);
    100       1.1    brezak #endif
    101       1.1    brezak 	if (!bot)
    102       1.1    brezak 		bot = getsecs();
    103       1.1    brezak 
    104       1.1    brezak 	if (!(d = socktodesc(sock))) {
    105      1.10  christos 		printf("bootp: bad socket. %d\n", sock);
    106       1.1    brezak 		return;
    107       1.1    brezak 	}
    108       1.1    brezak #ifdef BOOTP_DEBUG
    109       1.1    brezak  	if (debug)
    110  1.11.4.1   thorpej 		printf("bootp: d=%lx\n", (long)d);
    111       1.1    brezak #endif
    112       1.4   mycroft 
    113       1.1    brezak 	bp = &wbuf.wbootp;
    114       1.1    brezak 	bzero(bp, sizeof(*bp));
    115       1.1    brezak 
    116       1.1    brezak 	bp->bp_op = BOOTREQUEST;
    117       1.1    brezak 	bp->bp_htype = 1;		/* 10Mb Ethernet (48 bits) */
    118       1.1    brezak 	bp->bp_hlen = 6;
    119       1.7        pk 	bp->bp_xid = htonl(d->xid);
    120       1.1    brezak 	MACPY(d->myea, bp->bp_chaddr);
    121  1.11.4.1   thorpej 	strncpy(bp->bp_file, bootfile, sizeof(bp->bp_file));
    122       1.4   mycroft 	bcopy(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048));
    123  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    124  1.11.4.1   thorpej 	bp->bp_vend[4] = TAG_DHCP_MSGTYPE;
    125  1.11.4.1   thorpej 	bp->bp_vend[5] = 1;
    126  1.11.4.1   thorpej 	bp->bp_vend[6] = DHCPDISCOVER;
    127  1.11.4.1   thorpej 	bp->bp_vend[7] = TAG_END;
    128  1.11.4.1   thorpej #else
    129  1.11.4.1   thorpej 	bp->bp_vend[4] = TAG_END;
    130  1.11.4.1   thorpej #endif
    131       1.1    brezak 
    132       1.1    brezak 	d->myip = myip;
    133       1.7        pk 	d->myport = htons(IPPORT_BOOTPC);
    134       1.7        pk 	d->destip.s_addr = INADDR_BROADCAST;
    135       1.7        pk 	d->destport = htons(IPPORT_BOOTPS);
    136       1.1    brezak 
    137  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    138  1.11.4.1   thorpej 	expected_dhcpmsgtype = DHCPOFFER;
    139  1.11.4.1   thorpej 	dhcp_ok = 0;
    140  1.11.4.1   thorpej #endif
    141  1.11.4.1   thorpej 
    142  1.11.4.1   thorpej 	if(sendrecv(d,
    143  1.11.4.1   thorpej 		    bootpsend, bp, sizeof(*bp),
    144  1.11.4.1   thorpej 		    bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
    145  1.11.4.1   thorpej 	   == -1) {
    146  1.11.4.1   thorpej 	    printf("bootp: no reply\n");
    147  1.11.4.1   thorpej 	    return;
    148  1.11.4.1   thorpej 	}
    149  1.11.4.1   thorpej 
    150  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    151  1.11.4.1   thorpej 	if(dhcp_ok) {
    152  1.11.4.1   thorpej 		u_int32_t leasetime;
    153  1.11.4.1   thorpej 		bp->bp_vend[6] = DHCPREQUEST;
    154  1.11.4.1   thorpej 		bp->bp_vend[7] = TAG_REQ_ADDR;
    155  1.11.4.1   thorpej 		bp->bp_vend[8] = 4;
    156  1.11.4.1   thorpej 		bcopy(&rbuf.rbootp.bp_yiaddr, &bp->bp_vend[9], 4);
    157  1.11.4.1   thorpej 		bp->bp_vend[13] = TAG_SERVERID;
    158  1.11.4.1   thorpej 		bp->bp_vend[14] = 4;
    159  1.11.4.1   thorpej 		bcopy(&dhcp_serverip.s_addr, &bp->bp_vend[15], 4);
    160  1.11.4.1   thorpej 		bp->bp_vend[19] = TAG_LEASETIME;
    161  1.11.4.1   thorpej 		bp->bp_vend[20] = 4;
    162  1.11.4.1   thorpej 		leasetime = htonl(300);
    163  1.11.4.1   thorpej 		bcopy(&leasetime, &bp->bp_vend[21], 4);
    164  1.11.4.1   thorpej 		bp->bp_vend[25] = TAG_END;
    165  1.11.4.1   thorpej 
    166  1.11.4.1   thorpej 		expected_dhcpmsgtype = DHCPACK;
    167  1.11.4.1   thorpej 
    168  1.11.4.1   thorpej 		if(sendrecv(d,
    169  1.11.4.1   thorpej 			    bootpsend, bp, sizeof(*bp),
    170  1.11.4.1   thorpej 			    bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
    171  1.11.4.1   thorpej 		   == -1) {
    172  1.11.4.1   thorpej 			printf("DHCPREQUEST failed\n");
    173  1.11.4.1   thorpej 			return;
    174  1.11.4.1   thorpej 		}
    175  1.11.4.1   thorpej 	}
    176  1.11.4.1   thorpej #endif
    177  1.11.4.1   thorpej 
    178  1.11.4.1   thorpej 	myip = d->myip = rbuf.rbootp.bp_yiaddr;
    179  1.11.4.2   thorpej 	servip = rbuf.rbootp.bp_siaddr;
    180  1.11.4.2   thorpej 	if(rootip.s_addr == INADDR_ANY) rootip = servip;
    181  1.11.4.1   thorpej 	bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile));
    182  1.11.4.1   thorpej 	bootfile[sizeof(bootfile) - 1] = '\0';
    183  1.11.4.1   thorpej 
    184  1.11.4.1   thorpej 	if (IN_CLASSA(myip.s_addr))
    185  1.11.4.1   thorpej 		nmask = IN_CLASSA_NET;
    186  1.11.4.1   thorpej 	else if (IN_CLASSB(myip.s_addr))
    187  1.11.4.1   thorpej 		nmask = IN_CLASSB_NET;
    188  1.11.4.1   thorpej 	else
    189  1.11.4.1   thorpej 		nmask = IN_CLASSC_NET;
    190  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    191  1.11.4.1   thorpej 	if (debug)
    192  1.11.4.1   thorpej 		printf("'native netmask' is %s\n", intoa(nmask));
    193  1.11.4.1   thorpej #endif
    194  1.11.4.1   thorpej 
    195  1.11.4.1   thorpej 	/* Check subnet mask against net mask; toss if bogus */
    196  1.11.4.1   thorpej 	if ((nmask & smask) != nmask) {
    197  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    198  1.11.4.1   thorpej 		if (debug)
    199  1.11.4.1   thorpej 			printf("subnet mask (%s) bad\n", intoa(smask));
    200  1.11.4.1   thorpej #endif
    201  1.11.4.1   thorpej 		smask = 0;
    202  1.11.4.1   thorpej 	}
    203  1.11.4.1   thorpej 
    204  1.11.4.1   thorpej 	/* Get subnet (or natural net) mask */
    205  1.11.4.1   thorpej 	netmask = nmask;
    206  1.11.4.1   thorpej 	if (smask)
    207  1.11.4.1   thorpej 		netmask = smask;
    208  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    209  1.11.4.1   thorpej 	if (debug)
    210  1.11.4.1   thorpej 		printf("mask: %s\n", intoa(netmask));
    211  1.11.4.1   thorpej #endif
    212  1.11.4.1   thorpej 
    213  1.11.4.1   thorpej 	/* We need a gateway if root is on a different net */
    214  1.11.4.1   thorpej 	if (!SAMENET(myip, rootip, netmask)) {
    215  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    216  1.11.4.1   thorpej 		if (debug)
    217  1.11.4.1   thorpej 			printf("need gateway for root ip\n");
    218  1.11.4.1   thorpej #endif
    219  1.11.4.1   thorpej 	}
    220  1.11.4.1   thorpej 
    221  1.11.4.1   thorpej 	/* Toss gateway if on a different net */
    222  1.11.4.1   thorpej 	if (!SAMENET(myip, gateip, netmask)) {
    223  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    224  1.11.4.1   thorpej 		if (debug)
    225  1.11.4.1   thorpej 			printf("gateway ip (%s) bad\n", inet_ntoa(gateip));
    226  1.11.4.1   thorpej #endif
    227  1.11.4.1   thorpej 		gateip.s_addr = 0;
    228  1.11.4.1   thorpej 	}
    229       1.4   mycroft 
    230       1.4   mycroft 	/* Bump xid so next request will be unique. */
    231       1.4   mycroft 	++d->xid;
    232       1.1    brezak }
    233       1.1    brezak 
    234       1.1    brezak /* Transmit a bootp request */
    235       1.6        pk static ssize_t
    236       1.1    brezak bootpsend(d, pkt, len)
    237       1.1    brezak 	register struct iodesc *d;
    238       1.1    brezak 	register void *pkt;
    239       1.3   mycroft 	register size_t len;
    240       1.1    brezak {
    241       1.1    brezak 	register struct bootp *bp;
    242       1.1    brezak 
    243       1.1    brezak #ifdef BOOTP_DEBUG
    244       1.1    brezak 	if (debug)
    245  1.11.4.1   thorpej 		printf("bootpsend: d=%lx called.\n", (long)d);
    246       1.1    brezak #endif
    247       1.3   mycroft 
    248       1.1    brezak 	bp = pkt;
    249       1.7        pk 	bp->bp_secs = htons((u_short)(getsecs() - bot));
    250       1.3   mycroft 
    251       1.1    brezak #ifdef BOOTP_DEBUG
    252       1.1    brezak 	if (debug)
    253      1.10  christos 		printf("bootpsend: calling sendudp\n");
    254       1.1    brezak #endif
    255       1.3   mycroft 
    256       1.1    brezak 	return (sendudp(d, pkt, len));
    257       1.1    brezak }
    258       1.1    brezak 
    259       1.6        pk static ssize_t
    260       1.3   mycroft bootprecv(d, pkt, len, tleft)
    261  1.11.4.1   thorpej register struct iodesc *d;
    262  1.11.4.1   thorpej register void *pkt;
    263  1.11.4.1   thorpej register size_t len;
    264  1.11.4.1   thorpej time_t tleft;
    265       1.1    brezak {
    266       1.6        pk 	register ssize_t n;
    267       1.1    brezak 	register struct bootp *bp;
    268       1.1    brezak 
    269  1.11.4.1   thorpej #ifdef BOOTP_DEBUGx
    270       1.1    brezak 	if (debug)
    271  1.11.4.1   thorpej 		printf("bootp_recvoffer: called\n");
    272       1.1    brezak #endif
    273       1.3   mycroft 
    274       1.6        pk 	n = readudp(d, pkt, len, tleft);
    275  1.11.4.1   thorpej 	if (n == -1 || n < sizeof(struct bootp) - BOOTP_VENDSIZE)
    276       1.3   mycroft 		goto bad;
    277       1.3   mycroft 
    278       1.3   mycroft 	bp = (struct bootp *)pkt;
    279  1.11.4.1   thorpej 
    280       1.1    brezak #ifdef BOOTP_DEBUG
    281       1.1    brezak 	if (debug)
    282  1.11.4.1   thorpej 		printf("bootprecv: checked.  bp = 0x%lx, n = %d\n",
    283  1.11.4.1   thorpej 		    (long)bp, (int)n);
    284       1.1    brezak #endif
    285       1.7        pk 	if (bp->bp_xid != htonl(d->xid)) {
    286       1.1    brezak #ifdef BOOTP_DEBUG
    287       1.1    brezak 		if (debug) {
    288  1.11.4.1   thorpej 			printf("bootprecv: expected xid 0x%lx, got 0x%x\n",
    289       1.7        pk 			    d->xid, ntohl(bp->bp_xid));
    290       1.1    brezak 		}
    291       1.1    brezak #endif
    292       1.3   mycroft 		goto bad;
    293       1.1    brezak 	}
    294       1.1    brezak 
    295       1.1    brezak #ifdef BOOTP_DEBUG
    296       1.1    brezak 	if (debug)
    297      1.10  christos 		printf("bootprecv: got one!\n");
    298       1.1    brezak #endif
    299       1.1    brezak 
    300       1.1    brezak 	/* Suck out vendor info */
    301  1.11.4.1   thorpej 	if (bcmp(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)) == 0) {
    302  1.11.4.1   thorpej 		if(vend_rfc1048(bp->bp_vend, sizeof(bp->bp_vend)) != 0)
    303  1.11.4.1   thorpej 		    goto bad;
    304  1.11.4.1   thorpej 	}
    305  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
    306  1.11.4.1   thorpej 	else if (bcmp(vm_cmu, bp->bp_vend, sizeof(vm_cmu)) == 0)
    307       1.1    brezak 		vend_cmu(bp->bp_vend);
    308  1.11.4.1   thorpej #endif
    309       1.1    brezak 	else
    310      1.10  christos 		printf("bootprecv: unknown vendor 0x%lx\n", (long)bp->bp_vend);
    311       1.1    brezak 
    312  1.11.4.1   thorpej 	return(n);
    313       1.3   mycroft bad:
    314       1.3   mycroft 	errno = 0;
    315       1.3   mycroft 	return (-1);
    316       1.1    brezak }
    317       1.1    brezak 
    318  1.11.4.1   thorpej static int
    319       1.1    brezak vend_rfc1048(cp, len)
    320       1.1    brezak 	register u_char *cp;
    321       1.1    brezak 	u_int len;
    322       1.1    brezak {
    323       1.1    brezak 	register u_char *ep;
    324       1.1    brezak 	register int size;
    325       1.1    brezak 	register u_char tag;
    326       1.1    brezak 
    327       1.1    brezak #ifdef BOOTP_DEBUG
    328       1.1    brezak 	if (debug)
    329      1.10  christos 		printf("vend_rfc1048 bootp info. len=%d\n", len);
    330       1.1    brezak #endif
    331       1.1    brezak 	ep = cp + len;
    332       1.1    brezak 
    333       1.1    brezak 	/* Step over magic cookie */
    334       1.8       cgd 	cp += sizeof(int);
    335       1.1    brezak 
    336       1.1    brezak 	while (cp < ep) {
    337       1.1    brezak 		tag = *cp++;
    338       1.1    brezak 		size = *cp++;
    339       1.1    brezak 		if (tag == TAG_END)
    340       1.1    brezak 			break;
    341       1.1    brezak 
    342       1.1    brezak 		if (tag == TAG_SUBNET_MASK) {
    343       1.1    brezak 			bcopy(cp, &smask, sizeof(smask));
    344       1.1    brezak 		}
    345       1.1    brezak 		if (tag == TAG_GATEWAY) {
    346       1.7        pk 			bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr));
    347       1.1    brezak 		}
    348       1.1    brezak 		if (tag == TAG_SWAPSERVER) {
    349  1.11.4.1   thorpej 			/* let it override bp_siaddr */
    350  1.11.4.1   thorpej 			bcopy(cp, &rootip.s_addr, sizeof(swapip.s_addr));
    351       1.1    brezak 		}
    352       1.1    brezak 		if (tag == TAG_ROOTPATH) {
    353       1.7        pk 			strncpy(rootpath, (char *)cp, sizeof(rootpath));
    354       1.1    brezak 			rootpath[size] = '\0';
    355       1.1    brezak 		}
    356       1.1    brezak 		if (tag == TAG_HOSTNAME) {
    357       1.7        pk 			strncpy(hostname, (char *)cp, sizeof(hostname));
    358       1.1    brezak 			hostname[size] = '\0';
    359       1.1    brezak 		}
    360  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    361  1.11.4.1   thorpej 		if (tag == TAG_DHCP_MSGTYPE) {
    362  1.11.4.1   thorpej 			if(*cp != expected_dhcpmsgtype)
    363  1.11.4.1   thorpej 			    return(-1);
    364  1.11.4.1   thorpej 			dhcp_ok = 1;
    365  1.11.4.1   thorpej 		}
    366  1.11.4.1   thorpej 		if (tag == TAG_SERVERID) {
    367  1.11.4.1   thorpej 			bcopy(cp, &dhcp_serverip.s_addr,
    368  1.11.4.1   thorpej 			      sizeof(dhcp_serverip.s_addr));
    369       1.1    brezak 		}
    370  1.11.4.1   thorpej #endif
    371       1.1    brezak 		cp += size;
    372       1.1    brezak 	}
    373  1.11.4.1   thorpej 	return(0);
    374  1.11.4.1   thorpej }
    375  1.11.4.1   thorpej 
    376  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
    377  1.11.4.1   thorpej static void
    378  1.11.4.1   thorpej vend_cmu(cp)
    379  1.11.4.1   thorpej 	u_char *cp;
    380  1.11.4.1   thorpej {
    381  1.11.4.1   thorpej 	register struct cmu_vend *vp;
    382  1.11.4.1   thorpej 
    383  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    384  1.11.4.1   thorpej 	if (debug)
    385  1.11.4.1   thorpej 		printf("vend_cmu bootp info.\n");
    386  1.11.4.1   thorpej #endif
    387  1.11.4.1   thorpej 	vp = (struct cmu_vend *)cp;
    388  1.11.4.1   thorpej 
    389  1.11.4.1   thorpej 	if (vp->v_smask.s_addr != 0) {
    390  1.11.4.1   thorpej 		smask = vp->v_smask.s_addr;
    391  1.11.4.1   thorpej 	}
    392  1.11.4.1   thorpej 	if (vp->v_dgate.s_addr != 0) {
    393  1.11.4.1   thorpej 		gateip = vp->v_dgate;
    394  1.11.4.1   thorpej 	}
    395       1.1    brezak }
    396  1.11.4.1   thorpej #endif
    397