]> git.proxmox.com Git - mirror_frr.git/blobdiff - eigrpd/eigrp_network.c
Merge pull request #5787 from karamalla0406/rmac_check
[mirror_frr.git] / eigrpd / eigrp_network.c
index ae7b655e5035850fa985146f22799437f92236a0..39008a01c4a427f6748909b0f869242d62ac3c35 100644 (file)
@@ -55,12 +55,15 @@ static void eigrp_network_run_interface(struct eigrp *, struct prefix *,
 
 int eigrp_sock_init(struct vrf *vrf)
 {
-       int eigrp_sock;
+       int eigrp_sock = -1;
        int ret;
 #ifdef IP_HDRINCL
        int hincl = 1;
 #endif
 
+       if (!vrf)
+               return eigrp_sock;
+
        frr_with_privs(&eigrpd_privs) {
                eigrp_sock = vrf_socket(
                        AF_INET, SOCK_RAW, IPPROTO_EIGRPIGP, vrf->vrf_id,
@@ -227,7 +230,7 @@ int eigrp_network_set(struct eigrp *eigrp, struct prefix *p)
        rn->info = (void *)pref;
 
        /* Schedule Router ID Update. */
-       if (eigrp->router_id.s_addr == 0)
+       if (eigrp->router_id.s_addr == INADDR_ANY)
                eigrp_router_id_update(eigrp);
        /* Run network config now. */
        /* Get target interface. */
@@ -285,7 +288,7 @@ void eigrp_if_update(struct interface *ifp)
 {
        struct listnode *node, *nnode;
        struct route_node *rn;
-       struct eigrp *eigrp  = eigrp_lookup(ifp->vrf_id);
+       struct eigrp *eigrp;
 
        /*
         * In the event there are multiple eigrp autonymnous systems running,
@@ -324,8 +327,7 @@ int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p)
        if (!IPV4_ADDR_SAME(&pref->u.prefix4, &p->u.prefix4))
                return 0;
 
-       prefix_ipv4_free(rn->info);
-       rn->info = NULL;
+       prefix_ipv4_free((struct prefix_ipv4 **)&rn->info);
        route_unlock_node(rn); /* initial reference */
 
        /* Find interfaces that not configured already.  */