Works for me no problem. tested to IOS.

On 03.07.19 00:00, Remi Locherer wrote:
ping

On Mon, Jun 24, 2019 at 12:33:16AM +0200, Remi Locherer wrote:
Diff below adds to ospfd point to point support for Ethernet interfaces.
I successfully tested this against Junos and FastIron.

I first made the key word in the config "point-to-point". But then I
changed to "type p2p". The later would allow for "type nbma" or "type p2mp"
should we implement these types.

On Junos it looks like this:

area 0.0.0.0 {
     interface ge-0/0/1.0 {
         interface-type p2p;
     }
}

On FastIron it's similar to IOS:

interface ethernet 1/2/1
  ip address 10.10.10.5 255.255.255.0
  ip ospf area 0
  ip ospf network point-to-point

Comments, test reports and OKs are welcome.

Remi


Index: interface.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/interface.c,v
retrieving revision 1.82
diff -u -p -r1.82 interface.c
--- interface.c 11 Mar 2018 13:16:49 -0000      1.82
+++ interface.c 23 Jun 2019 11:27:57 -0000
@@ -190,6 +190,8 @@ if_new(struct kif *kif, struct kif_addr
        if (kif->flags & IFF_BROADCAST &&
            kif->flags & IFF_MULTICAST)
                iface->type = IF_TYPE_BROADCAST;
+       if (iface->p2p)
+               iface->type = IF_TYPE_POINTOPOINT;
        if (kif->flags & IFF_LOOPBACK) {
                iface->type = IF_TYPE_POINTOPOINT;
                iface->passive = 1;
@@ -351,6 +353,9 @@ if_act_start(struct iface *iface)
                orig_rtr_lsa(iface->area);
                return (0);
        }
+
+       if (iface->p2p)
+               iface->type = IF_TYPE_POINTOPOINT;
switch (iface->type) {
        case IF_TYPE_POINTOPOINT:
Index: ospfd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/ospfd.c,v
retrieving revision 1.108
diff -u -p -r1.108 ospfd.c
--- ospfd.c     16 May 2019 05:49:22 -0000      1.108
+++ ospfd.c     23 Jun 2019 21:06:44 -0000
@@ -911,6 +911,22 @@ merge_interfaces(struct area *a, struct
                                if_fsm(i, IF_EVT_UP);
                }
+ if (i->p2p != xi->p2p) {
+                       /* re-add interface to enable or disable DR election */
+                       if (ospfd_process == PROC_OSPF_ENGINE)
+                               if_fsm(i, IF_EVT_DOWN);
+                       else if (ospfd_process == PROC_RDE_ENGINE)
+                               rde_nbr_iface_del(i);
+                       LIST_REMOVE(i, entry);
+                       if_del(i);
+                       LIST_REMOVE(xi, entry);
+                       LIST_INSERT_HEAD(&a->iface_list, xi, entry);
+                       xi->area = a;
+                       if (ospfd_process == PROC_OSPF_ENGINE)
+                               xi->state = IF_STA_NEW;
+                       continue;
+               }
+
                strlcpy(i->dependon, xi->dependon,
                        sizeof(i->dependon));
                i->depend_ok = xi->depend_ok;
Index: ospfd.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/ospfd.conf.5,v
retrieving revision 1.57
diff -u -p -r1.57 ospfd.conf.5
--- ospfd.conf.5        10 Jun 2019 06:07:15 -0000      1.57
+++ ospfd.conf.5        23 Jun 2019 22:10:32 -0000
@@ -419,6 +419,9 @@ Router.
  .It Ic transmit-delay Ar seconds
  Set the transmit delay.
  The default value is 1; valid range is 1\-3600 seconds.
+.It Ic type p2p
+Set the interface type to point to point.
+This disables the election of a DR and BDR for the given interface.
  .El
  .Sh FILES
  .Bl -tag -width "/etc/ospfd.conf" -compact
Index: ospfd.h
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/ospfd.h,v
retrieving revision 1.104
diff -u -p -r1.104 ospfd.h
--- ospfd.h     16 May 2019 05:49:22 -0000      1.104
+++ ospfd.h     23 Jun 2019 11:28:24 -0000
@@ -363,6 +363,7 @@ struct iface {
        u_int8_t                 linkstate;
        u_int8_t                 priority;
        u_int8_t                 passive;
+       u_int8_t                 p2p;
  };
struct ifaddrchange {
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
retrieving revision 1.98
diff -u -p -r1.98 parse.y
--- parse.y     7 Jun 2019 04:57:45 -0000       1.98
+++ parse.y     23 Jun 2019 22:04:22 -0000
@@ -129,7 +129,7 @@ typedef struct {
  %token        AREA INTERFACE ROUTERID FIBPRIORITY FIBUPDATE REDISTRIBUTE 
RTLABEL
  %token        RDOMAIN RFC1583COMPAT STUB ROUTER SPFDELAY SPFHOLDTIME EXTTAG
  %token        AUTHKEY AUTHTYPE AUTHMD AUTHMDKEYID
-%token METRIC PASSIVE
+%token METRIC P2P PASSIVE
  %token        HELLOINTERVAL FASTHELLOINTERVAL TRANSMITDELAY
  %token        RETRANSMITINTERVAL ROUTERDEADTIME ROUTERPRIORITY
  %token        SET TYPE
@@ -743,6 +743,7 @@ interfaceopts_l     : interfaceopts_l interf
                ;
interfaceoptsl : PASSIVE { iface->passive = 1; }
+               | TYPE P2P              { iface->p2p = 1; }
                | DEMOTE STRING         {
                        if (strlcpy(iface->demote_group, $2,
                            sizeof(iface->demote_group)) >=
@@ -833,6 +834,7 @@ lookup(char *s)
                {"msec",              MSEC},
                {"no",                        NO},
                {"on",                        ON},
+               {"p2p",                       P2P},
                {"passive",           PASSIVE},
                {"rdomain",           RDOMAIN},
                {"redistribute",      REDISTRIBUTE},
Index: printconf.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/printconf.c,v
retrieving revision 1.20
diff -u -p -r1.20 printconf.c
--- printconf.c 28 Dec 2018 19:25:10 -0000      1.20
+++ printconf.c 23 Jun 2019 22:05:55 -0000
@@ -149,6 +149,9 @@ 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)
+                       printf("\t\ttype p2p\n");
+
                printf("\t\tauth-type %s\n", if_auth_name(iface->auth_type));
                switch (iface->auth_type) {
                case AUTH_TYPE_NONE:


Reply via email to