parms.c (64526) | parms.c (90868) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sbin/routed/parms.c 64131 2000-08-02 11:38:20Z sheldonh $ | 33 * $FreeBSD: head/sbin/routed/parms.c 90868 2002-02-18 20:35:27Z mike $ |
34 */ 35 36#include "defs.h" 37#include "pathnames.h" 38#include <sys/stat.h> 39 40#if !defined(sgi) && !defined(__NetBSD__) 41static char sccsid[] __attribute__((unused)) = "@(#)if.c 8.1 (Berkeley) 6/5/93"; 42#elif defined(__NetBSD__) 43__RCSID("$NetBSD$"); 44#endif | 34 */ 35 36#include "defs.h" 37#include "pathnames.h" 38#include <sys/stat.h> 39 40#if !defined(sgi) && !defined(__NetBSD__) 41static char sccsid[] __attribute__((unused)) = "@(#)if.c 8.1 (Berkeley) 6/5/93"; 42#elif defined(__NetBSD__) 43__RCSID("$NetBSD$"); 44#endif |
45#ident "$FreeBSD: head/sbin/routed/parms.c 64131 2000-08-02 11:38:20Z sheldonh $" | 45#ident "$FreeBSD: head/sbin/routed/parms.c 90868 2002-02-18 20:35:27Z mike $" |
46 47 48struct parm *parms; 49struct intnet *intnets; 50struct r1net *r1nets; 51struct tgate *tgates; 52 53 --- 190 unchanged lines hidden (view full) --- 244 continue; 245 } 246 if (dst == RIP_DEFAULT) { 247 msglog("bad net \"%s\" in "_PATH_GATEWAYS 248 " entry \"%s\"--cannot be default", 249 dname, lptr); 250 continue; 251 } | 46 47 48struct parm *parms; 49struct intnet *intnets; 50struct r1net *r1nets; 51struct tgate *tgates; 52 53 --- 190 unchanged lines hidden (view full) --- 244 continue; 245 } 246 if (dst == RIP_DEFAULT) { 247 msglog("bad net \"%s\" in "_PATH_GATEWAYS 248 " entry \"%s\"--cannot be default", 249 dname, lptr); 250 continue; 251 } |
252 HTONL(dst); /* make network # into IP address */ | 252 /* Turn network # into IP address. */ 253 dst = htonl(dst); |
253 } else { 254 msglog("bad \"%s\" in "_PATH_GATEWAYS 255 " entry \"%s\"", net_host, lptr); 256 continue; 257 } 258 259 if (!gethost(gname, &gate)) { 260 msglog("bad gateway \"%s\" in "_PATH_GATEWAYS --- 346 unchanged lines hidden (view full) --- 607 return bad_str(line); 608 } 609 if (!getnet(buf, &intnetp->intnet_addr, &intnetp->intnet_mask) 610 || intnetp->intnet_mask == HOST_MASK 611 || intnetp->intnet_addr == RIP_DEFAULT) { 612 free(intnetp); 613 return bad_str(line); 614 } | 254 } else { 255 msglog("bad \"%s\" in "_PATH_GATEWAYS 256 " entry \"%s\"", net_host, lptr); 257 continue; 258 } 259 260 if (!gethost(gname, &gate)) { 261 msglog("bad gateway \"%s\" in "_PATH_GATEWAYS --- 346 unchanged lines hidden (view full) --- 608 return bad_str(line); 609 } 610 if (!getnet(buf, &intnetp->intnet_addr, &intnetp->intnet_mask) 611 || intnetp->intnet_mask == HOST_MASK 612 || intnetp->intnet_addr == RIP_DEFAULT) { 613 free(intnetp); 614 return bad_str(line); 615 } |
615 HTONL(intnetp->intnet_addr); | 616 intnetp->intnet_addr = htonl(intnetp->intnet_addr); |
616 intnetp->intnet_next = intnets; 617 intnets = intnetp; 618 return 0; 619 } 620 621 /* "ripv1_mask=x.y.z.u/mask1,mask2" must be alone on the line. 622 * This requires that x.y.z.u/mask1 be considered a subnet of 623 * x.y.z.u/mask2, as if x.y.z.u/mask2 were a class-full network. --- 316 unchanged lines hidden (view full) --- 940 in.s_addr = (naddr)np->n_net; 941 if (0 == (in.s_addr & 0xff000000)) 942 in.s_addr <<= 8; 943 if (0 == (in.s_addr & 0xff000000)) 944 in.s_addr <<= 8; 945 if (0 == (in.s_addr & 0xff000000)) 946 in.s_addr <<= 8; 947 } else if (inet_aton(name, &in) == 1) { | 617 intnetp->intnet_next = intnets; 618 intnets = intnetp; 619 return 0; 620 } 621 622 /* "ripv1_mask=x.y.z.u/mask1,mask2" must be alone on the line. 623 * This requires that x.y.z.u/mask1 be considered a subnet of 624 * x.y.z.u/mask2, as if x.y.z.u/mask2 were a class-full network. --- 316 unchanged lines hidden (view full) --- 941 in.s_addr = (naddr)np->n_net; 942 if (0 == (in.s_addr & 0xff000000)) 943 in.s_addr <<= 8; 944 if (0 == (in.s_addr & 0xff000000)) 945 in.s_addr <<= 8; 946 if (0 == (in.s_addr & 0xff000000)) 947 in.s_addr <<= 8; 948 } else if (inet_aton(name, &in) == 1) { |
948 NTOHL(in.s_addr); | 949 in.s_addr = ntohl(in.s_addr); |
949 } else if (!mname && !strcasecmp(name,"default")) { 950 in.s_addr = RIP_DEFAULT; 951 } else { 952 return 0; 953 } 954 955 if (!mname) { 956 /* we cannot use the interfaces here because we have not --- 64 unchanged lines hidden --- | 950 } else if (!mname && !strcasecmp(name,"default")) { 951 in.s_addr = RIP_DEFAULT; 952 } else { 953 return 0; 954 } 955 956 if (!mname) { 957 /* we cannot use the interfaces here because we have not --- 64 unchanged lines hidden --- |