On Mon, Jan 20, 2020 at 05:08:26PM +0100, Denis Fondras wrote:
> On Sun, Jan 19, 2020 at 11:04:16PM +0100, Remi Locherer wrote:
> > This makes the interface setting "type p2p" configurable globally or
> > per area. ospf(6)d allows this for almost all interface related settings.
> >
> > As a side-effect of this diff ospf(6)d -nv prints "type p2p" also for
> > point-to-point interfaces like gif or gre. I think this is an advantage
> > but I can also change that by re-introducing the iface->p2p variable.
> >
> > OK?
> >
>
> diff looks good. Is it really useful to set p2p globally ?
Yes, if the router only connects to other routers.
And the diff makes "type p2p" works the same as the other interface
settings do. And as the manual tells the user.
>
> > Remi
> >
> >
> >
> > Index: ospf6d/ospf6d.h
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.h,v
> > retrieving revision 1.44
> > diff -u -p -r1.44 ospf6d.h
> > --- ospf6d/ospf6d.h 3 Jan 2020 17:45:02 -0000 1.44
> > +++ ospf6d/ospf6d.h 12 Jan 2020 21:44:41 -0000
> > @@ -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
> > Index: ospf6d/parse.y
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
> > retrieving revision 1.48
> > diff -u -p -r1.48 parse.y
> > --- ospf6d/parse.y 26 Dec 2019 10:24:18 -0000 1.48
> > +++ ospf6d/parse.y 19 Jan 2020 21:51:56 -0000
> > @@ -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 interf
> > ;
> >
> > 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;
> > Index: ospf6d/printconf.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospf6d/printconf.c,v
> > retrieving revision 1.9
> > diff -u -p -r1.9 printconf.c
> > --- ospf6d/printconf.c 26 Dec 2019 10:24:18 -0000 1.9
> > +++ ospf6d/printconf.c 12 Jan 2020 21:43:06 -0000
> > @@ -1,4 +1,5 @@
> > -/* $OpenBSD: printconf.c,v 1.9 2019/12/26 10:24:18 remi Exp $ */
> > +/* $OpenBSD: printconf.c,v 1.9 2019/12/26 10:24:18 remi Exp $
> > +*/
> >
> > /*
> > * Copyright (c) 2004, 2005 Esben Norby <[email protected]>
> > @@ -135,7 +136,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");
> > Index: ospfd/ospfd.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospfd/ospfd.c,v
> > retrieving revision 1.110
> > diff -u -p -r1.110 ospfd.c
> > --- ospfd/ospfd.c 23 Nov 2019 15:05:21 -0000 1.110
> > +++ ospfd/ospfd.c 18 Jan 2020 14:02:04 -0000
> > @@ -893,7 +893,6 @@ merge_interfaces(struct area *a, struct
> > 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
> > 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);
> > }
> > Index: ospfd/ospfd.h
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospfd/ospfd.h,v
> > retrieving revision 1.105
> > diff -u -p -r1.105 ospfd.h
> > --- ospfd/ospfd.h 19 Nov 2019 09:55:55 -0000 1.105
> > +++ ospfd/ospfd.h 12 Jan 2020 22:08:40 -0000
> > @@ -364,7 +364,6 @@ struct iface {
> > u_int8_t linkstate;
> > u_int8_t priority;
> > u_int8_t passive;
> > - u_int8_t p2p;
> > };
> >
> > struct ifaddrchange {
> > Index: ospfd/parse.y
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
> > retrieving revision 1.99
> > diff -u -p -r1.99 parse.y
> > --- ospfd/parse.y 19 Nov 2019 09:55:55 -0000 1.99
> > +++ ospfd/parse.y 12 Jan 2020 22:07:46 -0000
> > @@ -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 interf
> > ;
> >
> > 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;
> > Index: ospfd/printconf.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospfd/printconf.c,v
> > retrieving revision 1.21
> > diff -u -p -r1.21 printconf.c
> > --- ospfd/printconf.c 19 Nov 2019 09:55:55 -0000 1.21
> > +++ ospfd/printconf.c 12 Jan 2020 22:08:30 -0000
> > @@ -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));
> >
>