]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: Support use of ospf with DMVPN
authorAmol Lad <amol.lad@4rf.com>
Wed, 17 Feb 2021 00:51:52 +0000 (13:51 +1300)
committerReuben Dowle <reuben.dowle@4rf.com>
Mon, 5 Apr 2021 21:22:59 +0000 (09:22 +1200)
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
ospfd/ospf_interface.c
ospfd/ospf_interface.h
ospfd/ospf_lsa.c
ospfd/ospf_vty.c
ospfd/ospfd.c

index 6829c4a347cc25243fbad736f491ce81930133c5..9bb28baa72cded699b3249236fb15c125be415c0 100644 (file)
@@ -543,6 +543,8 @@ static struct ospf_if_params *ospf_new_if_params(void)
        oip->network_lsa_seqnum = htonl(OSPF_INITIAL_SEQUENCE_NUMBER);
        oip->is_v_wait_set = false;
 
+       oip->ptp_dmvpn = 0;
+
        return oip;
 }
 
index e2d732738169a2032330419532011c19c7be13f6..4a211472468a256d16b5c70515fbe209556228e8 100644 (file)
@@ -118,6 +118,9 @@ struct ospf_if_params {
 
        /* MPLS LDP-IGP Sync configuration */
        struct ldp_sync_info *ldp_sync_info;
+
+       /* point-to-point DMVPN configuration */
+       uint8_t ptp_dmvpn;
 };
 
 enum { MEMBER_ALLROUTERS = 0,
@@ -180,6 +183,9 @@ struct ospf_interface {
        /* OSPF Network Type. */
        uint8_t type;
 
+       /* point-to-point DMVPN configuration */
+       uint8_t ptp_dmvpn;
+
        /* State of Interface State Machine. */
        uint8_t state;
 
index cb1c565d3770f73469ad626e03936985375b3969..6e9df77fb879db8fb5099cfcdac9cc930a901a69 100644 (file)
@@ -469,6 +469,12 @@ char link_info_set(struct stream **s, struct in_addr id, struct in_addr data,
 }
 
 /* Describe Point-to-Point link (Section 12.4.1.1). */
+
+/* Note: If the interface is configured as point-to-point dmvpn then the other
+ * end of link is dmvpn hub with point-to-multipoint ospf network type. The
+ * hub then expects this router to populate the stub network and also Link Data
+ * Field set to IP Address and not MIB-II ifIndex
+ */
 static int lsa_link_ptop_set(struct stream **s, struct ospf_interface *oi)
 {
        int links = 0;
@@ -482,7 +488,8 @@ static int lsa_link_ptop_set(struct stream **s, struct ospf_interface *oi)
        if ((nbr = ospf_nbr_lookup_ptop(oi)))
                if (nbr->state == NSM_Full) {
                        if (CHECK_FLAG(oi->connected->flags,
-                                      ZEBRA_IFA_UNNUMBERED)) {
+                                      ZEBRA_IFA_UNNUMBERED)
+                           && !oi->ptp_dmvpn) {
                                /* For unnumbered point-to-point networks, the
                                   Link Data field
                                   should specify the interface's MIB-II ifIndex
@@ -500,7 +507,8 @@ static int lsa_link_ptop_set(struct stream **s, struct ospf_interface *oi)
                }
 
        /* no need for a stub link for unnumbered interfaces */
-       if (!CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED)) {
+       if (oi->ptp_dmvpn
+           || !CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED)) {
                /* Regardless of the state of the neighboring router, we must
                   add a Type 3 link (stub network).
                   N.B. Options 1 & 2 share basically the same logic. */
index a1dac641d7ea2ca777f25e57cd60ed1ba8fc8655..2803354a03eed3cd70023eec956e791a324d6a8d 100644 (file)
@@ -8392,6 +8392,7 @@ DEFUN (no_ip_ospf_hello_interval,
                        continue;
 
                oi->type = IF_DEF_PARAMS(ifp)->type;
+               oi->ptp_dmvpn = IF_DEF_PARAMS(ifp)->ptp_dmvpn;
 
                if (oi->state > ISM_Down) {
                        OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceDown);
@@ -8419,20 +8420,21 @@ DEFUN_HIDDEN (no_ospf_hello_interval,
        return no_ip_ospf_hello_interval(self, vty, argc, argv);
 }
 
-DEFUN (ip_ospf_network,
-       ip_ospf_network_cmd,
-       "ip ospf network <broadcast|non-broadcast|point-to-multipoint|point-to-point>",
-       "IP Information\n"
-       "OSPF interface commands\n"
-       "Network type\n"
-       "Specify OSPF broadcast multi-access network\n"
-       "Specify OSPF NBMA network\n"
-       "Specify OSPF point-to-multipoint network\n"
-       "Specify OSPF point-to-point network\n")
+DEFUN(ip_ospf_network, ip_ospf_network_cmd,
+      "ip ospf network <broadcast|non-broadcast|point-to-multipoint|point-to-point [dmvpn]>",
+      "IP Information\n"
+      "OSPF interface commands\n"
+      "Network type\n"
+      "Specify OSPF broadcast multi-access network\n"
+      "Specify OSPF NBMA network\n"
+      "Specify OSPF point-to-multipoint network\n"
+      "Specify OSPF point-to-point network\n"
+      "Specify OSPF point-to-point DMVPN network\n")
 {
        VTY_DECLVAR_CONTEXT(interface, ifp);
        int idx = 0;
        int old_type = IF_DEF_PARAMS(ifp)->type;
+       uint8_t old_ptp_dmvpn = IF_DEF_PARAMS(ifp)->ptp_dmvpn;
        struct route_node *rn;
 
        if (old_type == OSPF_IFTYPE_LOOPBACK) {
@@ -8441,16 +8443,22 @@ DEFUN (ip_ospf_network,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
+       IF_DEF_PARAMS(ifp)->ptp_dmvpn = 0;
+
        if (argv_find(argv, argc, "broadcast", &idx))
                IF_DEF_PARAMS(ifp)->type = OSPF_IFTYPE_BROADCAST;
        else if (argv_find(argv, argc, "non-broadcast", &idx))
                IF_DEF_PARAMS(ifp)->type = OSPF_IFTYPE_NBMA;
        else if (argv_find(argv, argc, "point-to-multipoint", &idx))
                IF_DEF_PARAMS(ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
-       else if (argv_find(argv, argc, "point-to-point", &idx))
+       else if (argv_find(argv, argc, "point-to-point", &idx)) {
                IF_DEF_PARAMS(ifp)->type = OSPF_IFTYPE_POINTOPOINT;
+               if (argv_find(argv, argc, "dmvpn", &idx))
+                       IF_DEF_PARAMS(ifp)->ptp_dmvpn = 1;
+       }
 
-       if (IF_DEF_PARAMS(ifp)->type == old_type)
+       if (IF_DEF_PARAMS(ifp)->type == old_type
+           && IF_DEF_PARAMS(ifp)->ptp_dmvpn == old_ptp_dmvpn)
                return CMD_SUCCESS;
 
        SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
@@ -8502,6 +8510,7 @@ DEFUN (no_ip_ospf_network,
        struct route_node *rn;
 
        IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
+       IF_DEF_PARAMS(ifp)->ptp_dmvpn = 0;
 
        if (IF_DEF_PARAMS(ifp)->type == old_type)
                return CMD_SUCCESS;
@@ -11644,6 +11653,10 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
                                        vty_out(vty, " ip ospf network %s",
                                                ospf_int_type_str
                                                        [params->type]);
+                                       if (params->type
+                                                   == OSPF_IFTYPE_POINTOPOINT
+                                           && params->ptp_dmvpn)
+                                               vty_out(vty, " dmvpn");
                                        if (params != IF_DEF_PARAMS(ifp) && rn)
                                                vty_out(vty, " %pI4",
                                                        &rn->p.u.prefix4);
index 259209a736876c7c92dba9685b7a926d987cdda1..9949a78336409a9982488c5e0e586ccf33dceec6 100644 (file)
@@ -1076,6 +1076,7 @@ struct ospf_interface *add_ospf_interface(struct connected *co,
        /* If network type is specified previously,
           skip network type setting. */
        oi->type = IF_DEF_PARAMS(co->ifp)->type;
+       oi->ptp_dmvpn = IF_DEF_PARAMS(co->ifp)->ptp_dmvpn;
 
        /* Add pseudo neighbor. */
        ospf_nbr_self_reset(oi, oi->ospf->router_id);