]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_intra.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ospf6d / ospf6_intra.c
index 6626b4bed55409975706595c30115aacec7341b5..e7ce2f5f723e1769c07f6f394990f01823c9fe3a 100644 (file)
@@ -1,21 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2003 Yasuhiro Ohara
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -224,7 +209,7 @@ int ospf6_router_is_stub_router(struct ospf6_lsa *lsa)
        return OSPF6_NOT_STUB_ROUTER;
 }
 
-int ospf6_router_lsa_originate(struct thread *thread)
+void ospf6_router_lsa_originate(struct thread *thread)
 {
        struct ospf6_area *oa;
 
@@ -249,7 +234,7 @@ int ospf6_router_lsa_originate(struct thread *thread)
                if (IS_DEBUG_OSPF6_GR)
                        zlog_debug(
                                "Graceful Restart in progress, don't originate LSA");
-               return 0;
+               return;
        }
 
        if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER))
@@ -294,7 +279,7 @@ int ospf6_router_lsa_originate(struct thread *thread)
                                       + sizeof(struct ospf6_router_lsa)) {
                                zlog_warn(
                                        "Size limit setting for Router-LSA too short");
-                               return 0;
+                               return;
                        }
 
                        /* Fill LSA Header */
@@ -433,8 +418,6 @@ int ospf6_router_lsa_originate(struct thread *thread)
        if (count && !link_state_id)
                ospf6_spf_schedule(oa->ospf6,
                                   OSPF6_SPF_FLAGS_ROUTER_LSA_ORIGINATED);
-
-       return 0;
 }
 
 /*******************************/
@@ -511,7 +494,7 @@ static int ospf6_network_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
        return 0;
 }
 
-int ospf6_network_lsa_originate(struct thread *thread)
+void ospf6_network_lsa_originate(struct thread *thread)
 {
        struct ospf6_interface *oi;
 
@@ -538,7 +521,7 @@ int ospf6_network_lsa_originate(struct thread *thread)
                if (IS_DEBUG_OSPF6_GR)
                        zlog_debug(
                                "Graceful Restart in progress, don't originate LSA");
-               return 0;
+               return;
        }
 
        old = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_NETWORK),
@@ -558,7 +541,7 @@ int ospf6_network_lsa_originate(struct thread *thread)
                                oi->area->ospf6,
                                OSPF6_SPF_FLAGS_NETWORK_LSA_ORIGINATED);
                }
-               return 0;
+               return;
        }
 
        if (IS_OSPF6_DEBUG_ORIGINATE(NETWORK))
@@ -577,7 +560,7 @@ int ospf6_network_lsa_originate(struct thread *thread)
                        zlog_debug("Interface stub, ignore");
                if (old)
                        ospf6_lsa_purge(old);
-               return 0;
+               return;
        }
 
        /* prepare buffer */
@@ -635,8 +618,6 @@ int ospf6_network_lsa_originate(struct thread *thread)
 
        /* Originate */
        ospf6_lsa_originate_area(lsa, oi->area);
-
-       return 0;
 }
 
 
@@ -765,7 +746,7 @@ static int ospf6_link_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
        return 0;
 }
 
-int ospf6_link_lsa_originate(struct thread *thread)
+void ospf6_link_lsa_originate(struct thread *thread)
 {
        struct ospf6_interface *oi;
 
@@ -785,7 +766,7 @@ int ospf6_link_lsa_originate(struct thread *thread)
                if (IS_DEBUG_OSPF6_GR)
                        zlog_debug(
                                "Graceful Restart in progress, don't originate LSA");
-               return 0;
+               return;
        }
 
 
@@ -797,7 +778,7 @@ int ospf6_link_lsa_originate(struct thread *thread)
        if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) {
                if (old)
                        ospf6_lsa_purge(old);
-               return 0;
+               return;
        }
 
        if (IS_OSPF6_DEBUG_ORIGINATE(LINK))
@@ -812,7 +793,7 @@ int ospf6_link_lsa_originate(struct thread *thread)
                                oi->interface->name);
                if (old)
                        ospf6_lsa_purge(old);
-               return 0;
+               return;
        }
 
        /* prepare buffer */
@@ -860,8 +841,6 @@ int ospf6_link_lsa_originate(struct thread *thread)
 
        /* Originate */
        ospf6_lsa_originate_interface(lsa, oi);
-
-       return 0;
 }
 
 
@@ -1003,7 +982,7 @@ static int ospf6_intra_prefix_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
        return 0;
 }
 
-int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
+void ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
 {
        struct ospf6_area *oa;
 
@@ -1028,7 +1007,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
                if (IS_DEBUG_OSPF6_GR)
                        zlog_debug(
                                "Graceful Restart in progress, don't originate LSA");
-               return 0;
+               return;
        }
 
        /* find previous LSA */
@@ -1051,7 +1030,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
                                        oa->lsdb);
                        }
                }
-               return 0;
+               return;
        }
 
        if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
@@ -1127,7 +1106,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
                        }
                }
                ospf6_route_table_delete(route_advertise);
-               return 0;
+               return;
        }
 
        /* Neighbor change to FULL, if INTRA-AREA-PREFIX LSA
@@ -1212,7 +1191,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
                if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
                        zlog_debug(
                                "Quit to Advertise Intra-Prefix: no route to advertise");
-               return 0;
+               return;
        }
 
        intra_prefix_lsa->prefix_num = htons(prefix_num);
@@ -1235,12 +1214,10 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
 
        /* Originate */
        ospf6_lsa_originate_area(lsa, oa);
-
-       return 0;
 }
 
 
-int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
+void ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
 {
        struct ospf6_interface *oi;
 
@@ -1268,7 +1245,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
                if (IS_DEBUG_OSPF6_GR)
                        zlog_debug(
                                "Graceful Restart in progress, don't originate LSA");
-               return 0;
+               return;
        }
 
        /* find previous LSA */
@@ -1279,7 +1256,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
        if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) {
                if (old)
                        ospf6_lsa_purge(old);
-               return 0;
+               return;
        }
 
        if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
@@ -1304,7 +1281,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
                        zlog_debug("  Interface is not DR");
                if (old)
                        ospf6_lsa_purge(old);
-               return 0;
+               return;
        }
 
        full_count = 0;
@@ -1317,7 +1294,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
                        zlog_debug("  Interface is stub");
                if (old)
                        ospf6_lsa_purge(old);
-               return 0;
+               return;
        }
 
        /* connected prefix to advertise */
@@ -1406,7 +1383,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
                if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
                        zlog_debug(
                                "Quit to Advertise Intra-Prefix: no route to advertise");
-               return 0;
+               return;
        }
 
        intra_prefix_lsa->prefix_num = htons(prefix_num);
@@ -1429,8 +1406,6 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
 
        /* Originate */
        ospf6_lsa_originate_area(lsa, oi->area);
-
-       return 0;
 }
 
 static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route,
@@ -1775,10 +1750,8 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
        intra_prefix_lsa =
                (struct ospf6_intra_prefix_lsa *)OSPF6_LSA_HEADER_END(
                        lsa->header);
-       if (intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_ROUTER))
-               ospf6_linkstate_prefix(intra_prefix_lsa->ref_adv_router,
-                                      intra_prefix_lsa->ref_id, &ls_prefix);
-       else if (intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_NETWORK))
+       if (intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_ROUTER) ||
+           intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_NETWORK))
                ospf6_linkstate_prefix(intra_prefix_lsa->ref_adv_router,
                                       intra_prefix_lsa->ref_id, &ls_prefix);
        else {
@@ -2020,7 +1993,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
                        break;
                prefix_num--;
 
-               memset(&prefix, 0, sizeof(struct prefix));
+               memset(&prefix, 0, sizeof(prefix));
                prefix.family = AF_INET6;
                prefix.prefixlen = op->prefix_length;
                ospf6_prefix_in6_addr(&prefix.u.prefix6, intra_prefix_lsa, op);
@@ -2148,7 +2121,7 @@ static void ospf6_brouter_debug_print(struct ospf6_route *brouter)
        char installed[64], changed[64];
        struct timeval now, res;
        char id[16], adv_router[16];
-       char capa[16], options[16];
+       char capa[16], options[32];
 
        brouter_id = ADV_ROUTER_IN_PREFIX(&brouter->prefix);
        inet_ntop(AF_INET, &brouter_id, brouter_name, sizeof(brouter_name));