aboutsummaryrefslogtreecommitdiff
path: root/sbin/routed/parms.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/routed/parms.c')
-rw-r--r--sbin/routed/parms.c56
1 files changed, 44 insertions, 12 deletions
diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c
index b4a362837750..1274e71c93ae 100644
--- a/sbin/routed/parms.c
+++ b/sbin/routed/parms.c
@@ -35,12 +35,14 @@
#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 "$Revision: 2.21 $"
struct parm *parms;
@@ -83,8 +85,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;
}
}
@@ -311,7 +315,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;
@@ -755,7 +759,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
@@ -779,10 +783,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|...) */
@@ -892,9 +910,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");