Home | History | Annotate | Line # | Download | only in libsa
bootp.c revision 1.11.4.1
      1  1.11.4.1   thorpej /*	$NetBSD: bootp.c,v 1.11.4.1 1997/09/06 19:06:50 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.1    brezak static n_long	nmask, smask;
     58       1.1    brezak 
     59       1.1    brezak static time_t	bot;
     60       1.1    brezak 
     61       1.1    brezak static	char vm_rfc1048[4] = VM_RFC1048;
     62  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
     63       1.1    brezak static	char vm_cmu[4] = VM_CMU;
     64  1.11.4.1   thorpej #endif
     65       1.1    brezak 
     66       1.1    brezak /* Local forwards */
     67       1.6        pk static	ssize_t bootpsend __P((struct iodesc *, void *, size_t));
     68       1.6        pk static	ssize_t bootprecv __P((struct iodesc *, void *, size_t, time_t));
     69  1.11.4.1   thorpej static	int vend_rfc1048 __P((u_char *, u_int));
     70  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
     71       1.1    brezak static	void vend_cmu __P((u_char *));
     72  1.11.4.1   thorpej #endif
     73  1.11.4.1   thorpej 
     74  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
     75  1.11.4.1   thorpej static char expected_dhcpmsgtype = -1, dhcp_ok;
     76  1.11.4.1   thorpej struct in_addr dhcp_serverip;
     77  1.11.4.1   thorpej #endif
     78       1.1    brezak 
     79       1.1    brezak /* Fetch required bootp infomation */
     80       1.1    brezak void
     81       1.1    brezak bootp(sock)
     82       1.1    brezak 	int sock;
     83       1.1    brezak {
     84       1.1    brezak 	struct iodesc *d;
     85       1.1    brezak 	register struct bootp *bp;
     86       1.1    brezak 	struct {
     87       1.1    brezak 		u_char header[HEADER_SIZE];
     88       1.1    brezak 		struct bootp wbootp;
     89       1.1    brezak 	} wbuf;
     90       1.3   mycroft 	struct {
     91       1.3   mycroft 		u_char header[HEADER_SIZE];
     92       1.3   mycroft 		struct bootp rbootp;
     93       1.1    brezak 	} rbuf;
     94       1.1    brezak 
     95       1.1    brezak #ifdef BOOTP_DEBUG
     96       1.1    brezak  	if (debug)
     97      1.10  christos 		printf("bootp: socket=%d\n", sock);
     98       1.1    brezak #endif
     99       1.1    brezak 	if (!bot)
    100       1.1    brezak 		bot = getsecs();
    101       1.1    brezak 
    102       1.1    brezak 	if (!(d = socktodesc(sock))) {
    103      1.10  christos 		printf("bootp: bad socket. %d\n", sock);
    104       1.1    brezak 		return;
    105       1.1    brezak 	}
    106       1.1    brezak #ifdef BOOTP_DEBUG
    107       1.1    brezak  	if (debug)
    108  1.11.4.1   thorpej 		printf("bootp: d=%lx\n", (long)d);
    109       1.1    brezak #endif
    110       1.4   mycroft 
    111       1.1    brezak 	bp = &wbuf.wbootp;
    112       1.1    brezak 	bzero(bp, sizeof(*bp));
    113       1.1    brezak 
    114       1.1    brezak 	bp->bp_op = BOOTREQUEST;
    115       1.1    brezak 	bp->bp_htype = 1;		/* 10Mb Ethernet (48 bits) */
    116       1.1    brezak 	bp->bp_hlen = 6;
    117       1.7        pk 	bp->bp_xid = htonl(d->xid);
    118       1.1    brezak 	MACPY(d->myea, bp->bp_chaddr);
    119  1.11.4.1   thorpej 	strncpy(bp->bp_file, bootfile, sizeof(bp->bp_file));
    120       1.4   mycroft 	bcopy(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048));
    121  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    122  1.11.4.1   thorpej 	bp->bp_vend[4] = TAG_DHCP_MSGTYPE;
    123  1.11.4.1   thorpej 	bp->bp_vend[5] = 1;
    124  1.11.4.1   thorpej 	bp->bp_vend[6] = DHCPDISCOVER;
    125  1.11.4.1   thorpej 	bp->bp_vend[7] = TAG_END;
    126  1.11.4.1   thorpej #else
    127  1.11.4.1   thorpej 	bp->bp_vend[4] = TAG_END;
    128  1.11.4.1   thorpej #endif
    129       1.1    brezak 
    130       1.1    brezak 	d->myip = myip;
    131       1.7        pk 	d->myport = htons(IPPORT_BOOTPC);
    132       1.7        pk 	d->destip.s_addr = INADDR_BROADCAST;
    133       1.7        pk 	d->destport = htons(IPPORT_BOOTPS);
    134       1.1    brezak 
    135  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    136  1.11.4.1   thorpej 	expected_dhcpmsgtype = DHCPOFFER;
    137  1.11.4.1   thorpej 	dhcp_ok = 0;
    138  1.11.4.1   thorpej #endif
    139  1.11.4.1   thorpej 
    140  1.11.4.1   thorpej 	if(sendrecv(d,
    141  1.11.4.1   thorpej 		    bootpsend, bp, sizeof(*bp),
    142  1.11.4.1   thorpej 		    bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
    143  1.11.4.1   thorpej 	   == -1) {
    144  1.11.4.1   thorpej 	    printf("bootp: no reply\n");
    145  1.11.4.1   thorpej 	    return;
    146  1.11.4.1   thorpej 	}
    147  1.11.4.1   thorpej 
    148  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    149  1.11.4.1   thorpej 	if(dhcp_ok) {
    150  1.11.4.1   thorpej 		u_int32_t leasetime;
    151  1.11.4.1   thorpej 		bp->bp_vend[6] = DHCPREQUEST;
    152  1.11.4.1   thorpej 		bp->bp_vend[7] = TAG_REQ_ADDR;
    153  1.11.4.1   thorpej 		bp->bp_vend[8] = 4;
    154  1.11.4.1   thorpej 		bcopy(&rbuf.rbootp.bp_yiaddr, &bp->bp_vend[9], 4);
    155  1.11.4.1   thorpej 		bp->bp_vend[13] = TAG_SERVERID;
    156  1.11.4.1   thorpej 		bp->bp_vend[14] = 4;
    157  1.11.4.1   thorpej 		bcopy(&dhcp_serverip.s_addr, &bp->bp_vend[15], 4);
    158  1.11.4.1   thorpej 		bp->bp_vend[19] = TAG_LEASETIME;
    159  1.11.4.1   thorpej 		bp->bp_vend[20] = 4;
    160  1.11.4.1   thorpej 		leasetime = htonl(300);
    161  1.11.4.1   thorpej 		bcopy(&leasetime, &bp->bp_vend[21], 4);
    162  1.11.4.1   thorpej 		bp->bp_vend[25] = TAG_END;
    163  1.11.4.1   thorpej 
    164  1.11.4.1   thorpej 		expected_dhcpmsgtype = DHCPACK;
    165  1.11.4.1   thorpej 
    166  1.11.4.1   thorpej 		if(sendrecv(d,
    167  1.11.4.1   thorpej 			    bootpsend, bp, sizeof(*bp),
    168  1.11.4.1   thorpej 			    bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
    169  1.11.4.1   thorpej 		   == -1) {
    170  1.11.4.1   thorpej 			printf("DHCPREQUEST failed\n");
    171  1.11.4.1   thorpej 			return;
    172  1.11.4.1   thorpej 		}
    173  1.11.4.1   thorpej 	}
    174  1.11.4.1   thorpej #endif
    175  1.11.4.1   thorpej 
    176  1.11.4.1   thorpej 	myip = d->myip = rbuf.rbootp.bp_yiaddr;
    177  1.11.4.1   thorpej 	if(rootip.s_addr == INADDR_ANY) rootip = rbuf.rbootp.bp_siaddr;
    178  1.11.4.1   thorpej 	bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile));
    179  1.11.4.1   thorpej 	bootfile[sizeof(bootfile) - 1] = '\0';
    180  1.11.4.1   thorpej 
    181  1.11.4.1   thorpej 	if (IN_CLASSA(myip.s_addr))
    182  1.11.4.1   thorpej 		nmask = IN_CLASSA_NET;
    183  1.11.4.1   thorpej 	else if (IN_CLASSB(myip.s_addr))
    184  1.11.4.1   thorpej 		nmask = IN_CLASSB_NET;
    185  1.11.4.1   thorpej 	else
    186  1.11.4.1   thorpej 		nmask = IN_CLASSC_NET;
    187  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    188  1.11.4.1   thorpej 	if (debug)
    189  1.11.4.1   thorpej 		printf("'native netmask' is %s\n", intoa(nmask));
    190  1.11.4.1   thorpej #endif
    191  1.11.4.1   thorpej 
    192  1.11.4.1   thorpej 	/* Check subnet mask against net mask; toss if bogus */
    193  1.11.4.1   thorpej 	if ((nmask & smask) != nmask) {
    194  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    195  1.11.4.1   thorpej 		if (debug)
    196  1.11.4.1   thorpej 			printf("subnet mask (%s) bad\n", intoa(smask));
    197  1.11.4.1   thorpej #endif
    198  1.11.4.1   thorpej 		smask = 0;
    199  1.11.4.1   thorpej 	}
    200  1.11.4.1   thorpej 
    201  1.11.4.1   thorpej 	/* Get subnet (or natural net) mask */
    202  1.11.4.1   thorpej 	netmask = nmask;
    203  1.11.4.1   thorpej 	if (smask)
    204  1.11.4.1   thorpej 		netmask = smask;
    205  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    206  1.11.4.1   thorpej 	if (debug)
    207  1.11.4.1   thorpej 		printf("mask: %s\n", intoa(netmask));
    208  1.11.4.1   thorpej #endif
    209  1.11.4.1   thorpej 
    210  1.11.4.1   thorpej 	/* We need a gateway if root is on a different net */
    211  1.11.4.1   thorpej 	if (!SAMENET(myip, rootip, netmask)) {
    212  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    213  1.11.4.1   thorpej 		if (debug)
    214  1.11.4.1   thorpej 			printf("need gateway for root ip\n");
    215  1.11.4.1   thorpej #endif
    216  1.11.4.1   thorpej 	}
    217  1.11.4.1   thorpej 
    218  1.11.4.1   thorpej 	/* Toss gateway if on a different net */
    219  1.11.4.1   thorpej 	if (!SAMENET(myip, gateip, netmask)) {
    220  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    221  1.11.4.1   thorpej 		if (debug)
    222  1.11.4.1   thorpej 			printf("gateway ip (%s) bad\n", inet_ntoa(gateip));
    223  1.11.4.1   thorpej #endif
    224  1.11.4.1   thorpej 		gateip.s_addr = 0;
    225  1.11.4.1   thorpej 	}
    226       1.4   mycroft 
    227       1.4   mycroft 	/* Bump xid so next request will be unique. */
    228       1.4   mycroft 	++d->xid;
    229       1.1    brezak }
    230       1.1    brezak 
    231       1.1    brezak /* Transmit a bootp request */
    232       1.6        pk static ssize_t
    233       1.1    brezak bootpsend(d, pkt, len)
    234       1.1    brezak 	register struct iodesc *d;
    235       1.1    brezak 	register void *pkt;
    236       1.3   mycroft 	register size_t len;
    237       1.1    brezak {
    238       1.1    brezak 	register struct bootp *bp;
    239       1.1    brezak 
    240       1.1    brezak #ifdef BOOTP_DEBUG
    241       1.1    brezak 	if (debug)
    242  1.11.4.1   thorpej 		printf("bootpsend: d=%lx called.\n", (long)d);
    243       1.1    brezak #endif
    244       1.3   mycroft 
    245       1.1    brezak 	bp = pkt;
    246       1.7        pk 	bp->bp_secs = htons((u_short)(getsecs() - bot));
    247       1.3   mycroft 
    248       1.1    brezak #ifdef BOOTP_DEBUG
    249       1.1    brezak 	if (debug)
    250      1.10  christos 		printf("bootpsend: calling sendudp\n");
    251       1.1    brezak #endif
    252       1.3   mycroft 
    253       1.1    brezak 	return (sendudp(d, pkt, len));
    254       1.1    brezak }
    255       1.1    brezak 
    256       1.6        pk static ssize_t
    257       1.3   mycroft bootprecv(d, pkt, len, tleft)
    258  1.11.4.1   thorpej register struct iodesc *d;
    259  1.11.4.1   thorpej register void *pkt;
    260  1.11.4.1   thorpej register size_t len;
    261  1.11.4.1   thorpej time_t tleft;
    262       1.1    brezak {
    263       1.6        pk 	register ssize_t n;
    264       1.1    brezak 	register struct bootp *bp;
    265       1.1    brezak 
    266  1.11.4.1   thorpej #ifdef BOOTP_DEBUGx
    267       1.1    brezak 	if (debug)
    268  1.11.4.1   thorpej 		printf("bootp_recvoffer: called\n");
    269       1.1    brezak #endif
    270       1.3   mycroft 
    271       1.6        pk 	n = readudp(d, pkt, len, tleft);
    272  1.11.4.1   thorpej 	if (n == -1 || n < sizeof(struct bootp) - BOOTP_VENDSIZE)
    273       1.3   mycroft 		goto bad;
    274       1.3   mycroft 
    275       1.3   mycroft 	bp = (struct bootp *)pkt;
    276  1.11.4.1   thorpej 
    277       1.1    brezak #ifdef BOOTP_DEBUG
    278       1.1    brezak 	if (debug)
    279  1.11.4.1   thorpej 		printf("bootprecv: checked.  bp = 0x%lx, n = %d\n",
    280  1.11.4.1   thorpej 		    (long)bp, (int)n);
    281       1.1    brezak #endif
    282       1.7        pk 	if (bp->bp_xid != htonl(d->xid)) {
    283       1.1    brezak #ifdef BOOTP_DEBUG
    284       1.1    brezak 		if (debug) {
    285  1.11.4.1   thorpej 			printf("bootprecv: expected xid 0x%lx, got 0x%x\n",
    286       1.7        pk 			    d->xid, ntohl(bp->bp_xid));
    287       1.1    brezak 		}
    288       1.1    brezak #endif
    289       1.3   mycroft 		goto bad;
    290       1.1    brezak 	}
    291       1.1    brezak 
    292       1.1    brezak #ifdef BOOTP_DEBUG
    293       1.1    brezak 	if (debug)
    294      1.10  christos 		printf("bootprecv: got one!\n");
    295       1.1    brezak #endif
    296       1.1    brezak 
    297       1.1    brezak 	/* Suck out vendor info */
    298  1.11.4.1   thorpej 	if (bcmp(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)) == 0) {
    299  1.11.4.1   thorpej 		if(vend_rfc1048(bp->bp_vend, sizeof(bp->bp_vend)) != 0)
    300  1.11.4.1   thorpej 		    goto bad;
    301  1.11.4.1   thorpej 	}
    302  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
    303  1.11.4.1   thorpej 	else if (bcmp(vm_cmu, bp->bp_vend, sizeof(vm_cmu)) == 0)
    304       1.1    brezak 		vend_cmu(bp->bp_vend);
    305  1.11.4.1   thorpej #endif
    306       1.1    brezak 	else
    307      1.10  christos 		printf("bootprecv: unknown vendor 0x%lx\n", (long)bp->bp_vend);
    308       1.1    brezak 
    309  1.11.4.1   thorpej 	return(n);
    310       1.3   mycroft bad:
    311       1.3   mycroft 	errno = 0;
    312       1.3   mycroft 	return (-1);
    313       1.1    brezak }
    314       1.1    brezak 
    315  1.11.4.1   thorpej static int
    316       1.1    brezak vend_rfc1048(cp, len)
    317       1.1    brezak 	register u_char *cp;
    318       1.1    brezak 	u_int len;
    319       1.1    brezak {
    320       1.1    brezak 	register u_char *ep;
    321       1.1    brezak 	register int size;
    322       1.1    brezak 	register u_char tag;
    323       1.1    brezak 
    324       1.1    brezak #ifdef BOOTP_DEBUG
    325       1.1    brezak 	if (debug)
    326      1.10  christos 		printf("vend_rfc1048 bootp info. len=%d\n", len);
    327       1.1    brezak #endif
    328       1.1    brezak 	ep = cp + len;
    329       1.1    brezak 
    330       1.1    brezak 	/* Step over magic cookie */
    331       1.8       cgd 	cp += sizeof(int);
    332       1.1    brezak 
    333       1.1    brezak 	while (cp < ep) {
    334       1.1    brezak 		tag = *cp++;
    335       1.1    brezak 		size = *cp++;
    336       1.1    brezak 		if (tag == TAG_END)
    337       1.1    brezak 			break;
    338       1.1    brezak 
    339       1.1    brezak 		if (tag == TAG_SUBNET_MASK) {
    340       1.1    brezak 			bcopy(cp, &smask, sizeof(smask));
    341       1.1    brezak 		}
    342       1.1    brezak 		if (tag == TAG_GATEWAY) {
    343       1.7        pk 			bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr));
    344       1.1    brezak 		}
    345       1.1    brezak 		if (tag == TAG_SWAPSERVER) {
    346  1.11.4.1   thorpej 			/* let it override bp_siaddr */
    347  1.11.4.1   thorpej 			bcopy(cp, &rootip.s_addr, sizeof(swapip.s_addr));
    348       1.1    brezak 		}
    349       1.1    brezak 		if (tag == TAG_ROOTPATH) {
    350       1.7        pk 			strncpy(rootpath, (char *)cp, sizeof(rootpath));
    351       1.1    brezak 			rootpath[size] = '\0';
    352       1.1    brezak 		}
    353       1.1    brezak 		if (tag == TAG_HOSTNAME) {
    354       1.7        pk 			strncpy(hostname, (char *)cp, sizeof(hostname));
    355       1.1    brezak 			hostname[size] = '\0';
    356       1.1    brezak 		}
    357  1.11.4.1   thorpej #ifdef SUPPORT_DHCP
    358  1.11.4.1   thorpej 		if (tag == TAG_DHCP_MSGTYPE) {
    359  1.11.4.1   thorpej 			if(*cp != expected_dhcpmsgtype)
    360  1.11.4.1   thorpej 			    return(-1);
    361  1.11.4.1   thorpej 			dhcp_ok = 1;
    362  1.11.4.1   thorpej 		}
    363  1.11.4.1   thorpej 		if (tag == TAG_SERVERID) {
    364  1.11.4.1   thorpej 			bcopy(cp, &dhcp_serverip.s_addr,
    365  1.11.4.1   thorpej 			      sizeof(dhcp_serverip.s_addr));
    366       1.1    brezak 		}
    367  1.11.4.1   thorpej #endif
    368       1.1    brezak 		cp += size;
    369       1.1    brezak 	}
    370  1.11.4.1   thorpej 	return(0);
    371  1.11.4.1   thorpej }
    372  1.11.4.1   thorpej 
    373  1.11.4.1   thorpej #ifdef BOOTP_VEND_CMU
    374  1.11.4.1   thorpej static void
    375  1.11.4.1   thorpej vend_cmu(cp)
    376  1.11.4.1   thorpej 	u_char *cp;
    377  1.11.4.1   thorpej {
    378  1.11.4.1   thorpej 	register struct cmu_vend *vp;
    379  1.11.4.1   thorpej 
    380  1.11.4.1   thorpej #ifdef BOOTP_DEBUG
    381  1.11.4.1   thorpej 	if (debug)
    382  1.11.4.1   thorpej 		printf("vend_cmu bootp info.\n");
    383  1.11.4.1   thorpej #endif
    384  1.11.4.1   thorpej 	vp = (struct cmu_vend *)cp;
    385  1.11.4.1   thorpej 
    386  1.11.4.1   thorpej 	if (vp->v_smask.s_addr != 0) {
    387  1.11.4.1   thorpej 		smask = vp->v_smask.s_addr;
    388  1.11.4.1   thorpej 	}
    389  1.11.4.1   thorpej 	if (vp->v_dgate.s_addr != 0) {
    390  1.11.4.1   thorpej 		gateip = vp->v_dgate;
    391  1.11.4.1   thorpej 	}
    392       1.1    brezak }
    393  1.11.4.1   thorpej #endif
    394