]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/nhrp_interface.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / nhrpd / nhrp_interface.c
index 94cec0281f4a210396e26521b4651f4c31978620..d396f510ed8177f20a70f86e9cc92060dc01ac86 100644 (file)
@@ -1,10 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* NHRP interface
  * Copyright (c) 2014-2015 Timo Teräs
- *
- * This file is free software: you may copy, redistribute and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -143,13 +139,13 @@ static void nhrp_interface_update_source(struct interface *ifp)
 {
        struct nhrp_interface *nifp = ifp->info;
 
-       if (!nifp->source || !nifp->nbmaifp ||
-           ((ifindex_t)nifp->link_idx == nifp->nbmaifp->ifindex &&
-            (nifp->link_vrf_id == nifp->nbmaifp->vrf_id)))
+       if (!nifp->source || !nifp->nbmaifp
+           || ((ifindex_t)nifp->link_idx == nifp->nbmaifp->ifindex
+               && (nifp->link_vrf_id == nifp->nbmaifp->vrf->vrf_id)))
                return;
 
        nifp->link_idx = nifp->nbmaifp->ifindex;
-       nifp->link_vrf_id = nifp->nbmaifp->vrf_id;
+       nifp->link_vrf_id = nifp->nbmaifp->vrf->vrf_id;
        debugf(NHRP_DEBUG_IF, "%s: bound device index changed to %d, vr %u",
               ifp->name, nifp->link_idx, nifp->link_vrf_id);
        nhrp_send_zebra_gre_source_set(ifp, nifp->link_idx, nifp->link_vrf_id);
@@ -165,8 +161,7 @@ static void nhrp_interface_interface_notifier(struct notifier_block *n,
 
        switch (cmd) {
        case NOTIFY_INTERFACE_CHANGED:
-               nhrp_interface_update_mtu(nifp->ifp, AFI_IP);
-               nhrp_interface_update_source(nifp->ifp);
+               nhrp_interface_update_nbma(nifp->ifp, NULL);
                break;
        case NOTIFY_INTERFACE_ADDRESS_CHANGED:
                nifp->nbma = nbmanifp->afi[AFI_IP].addr;
@@ -185,16 +180,17 @@ void nhrp_interface_update_nbma(struct interface *ifp,
        struct nhrp_interface *nifp = ifp->info, *nbmanifp = NULL;
        struct interface *nbmaifp = NULL;
        union sockunion nbma;
+       struct in_addr saddr = {0};
 
        sockunion_family(&nbma) = AF_UNSPEC;
 
        if (nifp->source)
                nbmaifp = if_lookup_by_name(nifp->source, nifp->link_vrf_id);
 
-       switch (ifp->ll_type) {
-       case ZEBRA_LLT_IPGRE: {
-               struct in_addr saddr = {0};
-
+       if (ifp->ll_type != ZEBRA_LLT_IPGRE)
+               debugf(NHRP_DEBUG_IF, "%s: Ignoring non GRE interface type %u",
+                      __func__, ifp->ll_type);
+       else {
                if (!gre_info) {
                        nhrp_send_zebra_gre_request(ifp);
                        return;
@@ -215,9 +211,6 @@ void nhrp_interface_update_nbma(struct interface *ifp,
                        nbmaifp =
                                if_lookup_by_index(nifp->link_idx,
                                                   nifp->link_vrf_id);
-       } break;
-       default:
-               break;
        }
 
        if (nbmaifp)
@@ -414,7 +407,7 @@ static void interface_config_update_nhrp_map(struct nhrp_cache_config *cc,
                return;
 
        /* gre layer not ready */
-       if (ifp->vrf_id == VRF_UNKNOWN)
+       if (ifp->vrf->vrf_id == VRF_UNKNOWN)
                return;
 
        c = nhrp_cache_get(ifp, &cc->remote_addr, ctx->enabled ? 1 : 0);