summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorremi <remi@cvs.openbsd.org>2020-01-21 20:38:53 +0000
committerremi <remi@cvs.openbsd.org>2020-01-21 20:38:53 +0000
commite7ba7a5302bffdc56d34818a7632540d0e949786 (patch)
tree1a11611aa69b34b2b6a294f3af7046dd8c45bab5 /usr.sbin
parentebfe0433658cd28c200437cc2e44e355acc7ec6e (diff)
Allow the interface setting "type p2p" to be configured globallz or per
area. Most of the other interface settings allow this. ok denis@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/ospf6d.h3
-rw-r--r--usr.sbin/ospf6d/parse.y13
-rw-r--r--usr.sbin/ospf6d/printconf.c4
-rw-r--r--usr.sbin/ospfd/ospfd.c7
-rw-r--r--usr.sbin/ospfd/ospfd.h3
-rw-r--r--usr.sbin/ospfd/parse.y13
-rw-r--r--usr.sbin/ospfd/printconf.c4
7 files changed, 25 insertions, 22 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h
index 573cc0a6503..a9e4de02a99 100644
--- a/usr.sbin/ospf6d/ospf6d.h
+++ b/usr.sbin/ospf6d/ospf6d.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6d.h,v 1.44 2020/01/03 17:45:02 denis Exp $ */
+/* $OpenBSD: ospf6d.h,v 1.45 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org>
@@ -329,7 +329,6 @@ struct iface {
u_int8_t if_type;
u_int8_t linkstate;
u_int8_t priority;
- u_int8_t p2p;
u_int8_t cflags;
#define F_IFACE_PASSIVE 0x01
#define F_IFACE_CONFIGURED 0x02
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y
index bfb26d5f17b..f163e24149d 100644
--- a/usr.sbin/ospf6d/parse.y
+++ b/usr.sbin/ospf6d/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.48 2019/12/26 10:24:18 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.49 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -102,6 +102,7 @@ struct config_defaults {
u_int16_t rxmt_interval;
u_int16_t metric;
u_int8_t priority;
+ u_int8_t p2p;
};
struct config_defaults globaldefs;
@@ -449,6 +450,9 @@ defaults : METRIC NUMBER {
}
defs->rxmt_interval = $2;
}
+ | TYPE P2P {
+ defs->p2p = 1;
+ }
;
optnl : '\n' optnl
@@ -550,6 +554,8 @@ interface : INTERFACE STRING {
iface->metric = defs->metric;
iface->priority = defs->priority;
iface->cflags |= F_IFACE_CONFIGURED;
+ if (defs->p2p == 1)
+ iface->type = IF_TYPE_POINTOPOINT;
iface = NULL;
/* interface is always part of an area */
defs = &areadefs;
@@ -566,10 +572,6 @@ interfaceopts_l : interfaceopts_l interfaceoptsl nl
;
interfaceoptsl : PASSIVE { iface->cflags |= F_IFACE_PASSIVE; }
- | TYPE P2P {
- iface->p2p = 1;
- iface->type = IF_TYPE_POINTOPOINT;
- }
| DEMOTE STRING {
if (strlcpy(iface->demote_group, $2,
sizeof(iface->demote_group)) >=
@@ -1034,6 +1036,7 @@ parse_config(char *filename, int opts)
defs->rxmt_interval = DEFAULT_RXMT_INTERVAL;
defs->metric = DEFAULT_METRIC;
defs->priority = DEFAULT_PRIORITY;
+ defs->p2p = 0;
conf->spf_delay = DEFAULT_SPF_DELAY;
conf->spf_hold_time = DEFAULT_SPF_HOLDTIME;
diff --git a/usr.sbin/ospf6d/printconf.c b/usr.sbin/ospf6d/printconf.c
index fec50a56865..24105c9380f 100644
--- a/usr.sbin/ospf6d/printconf.c
+++ b/usr.sbin/ospf6d/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.9 2019/12/26 10:24:18 remi Exp $ */
+/* $OpenBSD: printconf.c,v 1.10 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -135,7 +135,7 @@ print_iface(struct iface *iface)
printf("\t\trouter-priority %d\n", iface->priority);
printf("\t\ttransmit-delay %d\n", iface->transmit_delay);
- if (iface->p2p)
+ if (iface->type == IF_TYPE_POINTOPOINT)
printf("\t\ttype p2p\n");
printf("\t}\n");
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index aca36d8508d..b5ddd3e3016 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.110 2019/11/23 15:05:21 remi Exp $ */
+/* $OpenBSD: ospfd.c,v 1.111 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -893,7 +893,6 @@ merge_interfaces(struct area *a, struct area *xa)
if (i->self)
i->self->priority = i->priority;
i->flags = xi->flags; /* needed? */
- i->type = xi->type; /* needed? */
i->if_type = xi->if_type; /* needed? */
i->linkstate = xi->linkstate; /* needed? */
@@ -915,11 +914,11 @@ merge_interfaces(struct area *a, struct area *xa)
if_fsm(i, IF_EVT_UP);
}
- if (i->p2p != xi->p2p) {
+ if (i->type != xi->type) {
/* restart interface to enable or disable DR election */
if (ospfd_process == PROC_OSPF_ENGINE)
if_fsm(i, IF_EVT_DOWN);
- i->p2p = xi->p2p;
+ i->type = xi->type;
if (ospfd_process == PROC_OSPF_ENGINE)
if_fsm(i, IF_EVT_UP);
}
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 27236a6c70b..5ea537cb2f3 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.105 2019/11/19 09:55:55 remi Exp $ */
+/* $OpenBSD: ospfd.h,v 1.106 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -364,7 +364,6 @@ struct iface {
u_int8_t linkstate;
u_int8_t priority;
u_int8_t passive;
- u_int8_t p2p;
};
struct ifaddrchange {
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 6e4092d3f36..a09696504f8 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.99 2019/11/19 09:55:55 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.100 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -103,6 +103,7 @@ struct config_defaults {
enum auth_type auth_type;
u_int8_t auth_keyid;
u_int8_t priority;
+ u_int8_t p2p;
};
struct config_defaults globaldefs;
@@ -560,6 +561,9 @@ defaults : METRIC NUMBER {
}
defs->rxmt_interval = $2;
}
+ | TYPE P2P {
+ defs->p2p = 1;
+ }
| authtype
| authkey
| authmdkeyid
@@ -723,6 +727,8 @@ interface : INTERFACE STRING {
iface->priority = defs->priority;
iface->auth_type = defs->auth_type;
iface->auth_keyid = defs->auth_keyid;
+ if (defs->p2p == 1)
+ iface->type = IF_TYPE_POINTOPOINT;
memcpy(iface->auth_key, defs->auth_key,
sizeof(iface->auth_key));
md_list_copy(&iface->auth_md_list, &defs->md_list);
@@ -743,10 +749,6 @@ interfaceopts_l : interfaceopts_l interfaceoptsl nl
;
interfaceoptsl : PASSIVE { iface->passive = 1; }
- | TYPE P2P {
- iface->p2p = 1;
- iface->type = IF_TYPE_POINTOPOINT;
- }
| DEMOTE STRING {
if (strlcpy(iface->demote_group, $2,
sizeof(iface->demote_group)) >=
@@ -1225,6 +1227,7 @@ parse_config(char *filename, int opts)
defs->rxmt_interval = DEFAULT_RXMT_INTERVAL;
defs->metric = DEFAULT_METRIC;
defs->priority = DEFAULT_PRIORITY;
+ defs->p2p = 0;
conf->spf_delay = DEFAULT_SPF_DELAY;
conf->spf_hold_time = DEFAULT_SPF_HOLDTIME;
diff --git a/usr.sbin/ospfd/printconf.c b/usr.sbin/ospfd/printconf.c
index 6c8635e4940..fd052939314 100644
--- a/usr.sbin/ospfd/printconf.c
+++ b/usr.sbin/ospfd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.21 2019/11/19 09:55:55 remi Exp $ */
+/* $OpenBSD: printconf.c,v 1.22 2020/01/21 20:38:52 remi Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -149,7 +149,7 @@ print_iface(struct iface *iface)
printf("\t\trouter-priority %d\n", iface->priority);
printf("\t\ttransmit-delay %d\n", iface->transmit_delay);
- if (iface->p2p)
+ if (iface->type == IF_TYPE_POINTOPOINT)
printf("\t\ttype p2p\n");
printf("\t\tauth-type %s\n", if_auth_name(iface->auth_type));