summaryrefslogtreecommitdiffstats
path: root/sbin/routed/parms.c
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2004-02-25 23:45:57 +0000
committerbms <bms@FreeBSD.org>2004-02-25 23:45:57 +0000
commitd21d623f8e8a4315c961e4c21e8791364bf5da82 (patch)
treee4203cef0e18ccd65dbc668359693d2d9e6ed679 /sbin/routed/parms.c
parent3bcc63994d2161d13a723601b646ddf345c06251 (diff)
downloadFreeBSD-src-d21d623f8e8a4315c961e4c21e8791364bf5da82.zip
FreeBSD-src-d21d623f8e8a4315c961e4c21e8791364bf5da82.tar.gz
Sync HEAD sources to vendor branch import of routed v2.27 from rhyolite.com.
Update <protocols/routed.h> for the MD5 changes requested in bin/35843. Preserve local changes. Education by: obrien, markm, pointy-stick PR: bin/35843 (and doubtless others)
Diffstat (limited to 'sbin/routed/parms.c')
-rw-r--r--sbin/routed/parms.c55
1 files changed, 44 insertions, 11 deletions
diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c
index 7a2c34a..97f49c2 100644
--- a/sbin/routed/parms.c
+++ b/sbin/routed/parms.c
@@ -37,10 +37,13 @@
#include "pathnames.h"
#include <sys/stat.h>
-#if !defined(sgi) && !defined(__NetBSD__)
-static char sccsid[] __attribute__((unused)) = "@(#)if.c 8.1 (Berkeley) 6/5/93";
-#elif defined(__NetBSD__)
+#ifdef __NetBSD__
__RCSID("$NetBSD$");
+#elif defined(__FreeBSD__)
+__RCSID("$FreeBSD$");
+#else
+__RCSID("$Revision: 2.26 $");
+#ident "$Revision: 2.26 $"
#endif
#ident "$FreeBSD$"
@@ -85,8 +88,10 @@ get_parms(struct interface *ifp)
ifp->int_rdisc_pref = parmp->parm_rdisc_pref;
if (parmp->parm_rdisc_int != 0)
ifp->int_rdisc_int = parmp->parm_rdisc_int;
- if (parmp->parm_d_metric != 0)
- ifp->int_d_metric = parmp->parm_d_metric;
+ if (parmp->parm_adj_inmetric != 0)
+ ifp->int_adj_inmetric = parmp->parm_adj_inmetric;
+ if (parmp->parm_adj_outmetric != 0)
+ ifp->int_adj_outmetric = parmp->parm_adj_outmetric;
}
}
@@ -314,7 +319,7 @@ gwkludge(void)
if (state & IS_PASSIVE)
state |= IS_NO_RIP;
- ifp = check_dup(gate,dst,netmask,0);
+ ifp = check_dup(gate,dst,netmask,state);
if (ifp != 0) {
msglog("duplicate "_PATH_GATEWAYS" entry \"%s\"",lptr);
continue;
@@ -761,7 +766,7 @@ parse_parms(char *line,
} else if (PARS("passive")) {
CKF((GROUP_IS_SOL_OUT|GROUP_IS_ADV_OUT), IS_NO_RDISC);
- parm.parm_int_state |= IS_NO_RIP| IS_PASSIVE;
+ parm.parm_int_state |= IS_NO_RIP | IS_PASSIVE;
} else if (PARSEQ("rdisc_pref")) {
if (parm.parm_rdisc_pref != 0
@@ -785,10 +790,24 @@ parse_parms(char *line,
} else if (PARSEQ("fake_default")) {
if (parm.parm_d_metric != 0
|| IS_RIP_OUT_OFF(parm.parm_int_state)
- || (parm.parm_d_metric = (int)strtoul(buf,&p,0),
- *p != '\0')
- || parm.parm_d_metric > HOPCNT_INFINITY-1)
+ || (i = strtoul(buf,&p,0), *p != '\0')
+ || i > HOPCNT_INFINITY-1)
+ return bad_str(tgt);
+ parm.parm_d_metric = i;
+
+ } else if (PARSEQ("adj_inmetric")) {
+ if (parm.parm_adj_inmetric != 0
+ || (i = strtoul(buf,&p,0), *p != '\0')
+ || i > HOPCNT_INFINITY-1)
+ return bad_str(tgt);
+ parm.parm_adj_inmetric = i;
+
+ } else if (PARSEQ("adj_outmetric")) {
+ if (parm.parm_adj_outmetric != 0
+ || (i = strtoul(buf,&p,0), *p != '\0')
+ || i > HOPCNT_INFINITY-1)
return bad_str(tgt);
+ parm.parm_adj_outmetric = i;
} else if (PARSEQ("trust_gateway")) {
/* look for trust_gateway=x.y.z|net/mask|...) */
@@ -898,9 +917,23 @@ check_parms(struct parm *new)
return ("conflicting, duplicate poor man's router"
" discovery or fake default metric");
}
+
+ if (new->parm_adj_inmetric != 0
+ && parmp->parm_adj_inmetric != 0
+ && new->parm_adj_inmetric != parmp->parm_adj_inmetric) {
+ return ("conflicting interface input "
+ "metric adjustments");
+ }
+
+ if (new->parm_adj_outmetric != 0
+ && parmp->parm_adj_outmetric != 0
+ && new->parm_adj_outmetric != parmp->parm_adj_outmetric) {
+ return ("conflicting interface output "
+ "metric adjustments");
+ }
}
- /* link new entry on the so that when the entries are scanned,
+ /* link new entry on the list so that when the entries are scanned,
* they affect the result in the order the operator specified.
*/
parmp = (struct parm*)rtmalloc(sizeof(*parmp), "check_parms");
OpenPOWER on IntegriCloud