]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/router-id.c
zebra: print unknown rule family as number
[mirror_frr.git] / zebra / router-id.c
index b5a8860c43daf08ab67123f11356fd17b64017e8..b37d4aea70277766a4b2a141136ecf7a2c19b715 100644 (file)
@@ -122,7 +122,7 @@ void router_id_add_address(struct connected *ifc)
        struct prefix before;
        struct prefix after;
        struct zserv *client;
-       struct zebra_vrf *zvrf = vrf_info_get(vrf_to_id(ifc->ifp->vrf));
+       struct zebra_vrf *zvrf = vrf_info_get(ifc->ifp->vrf_id);
 
        if (router_id_bad_address(ifc))
                return;
@@ -154,7 +154,7 @@ void router_id_del_address(struct connected *ifc)
        struct prefix before;
        struct listnode *node;
        struct zserv *client;
-       struct zebra_vrf *zvrf = vrf_info_get(vrf_to_id(ifc->ifp->vrf));
+       struct zebra_vrf *zvrf = vrf_info_get(ifc->ifp->vrf_id);
 
        if (router_id_bad_address(ifc))
                return;
@@ -253,6 +253,36 @@ DEFUN (no_router_id,
        return CMD_SUCCESS;
 }
 
+DEFUN (show_router_id,
+       show_router_id_cmd,
+       "show router-id [vrf NAME]",
+       SHOW_STR
+       "Show the configured router-id\n"
+       VRF_CMD_HELP_STR)
+{
+        int idx_name = 3;
+
+        vrf_id_t vrf_id = VRF_DEFAULT;
+        struct zebra_vrf *zvrf;
+
+        if (argc > 2)
+                VRF_GET_ID(vrf_id, argv[idx_name]->arg, false);
+
+        zvrf = vrf_info_get(vrf_id);
+
+        if ((zvrf != NULL) && (zvrf->rid_user_assigned.u.prefix4.s_addr)) {
+                vty_out(vty, "zebra:\n");
+                if (vrf_id == VRF_DEFAULT)
+                        vty_out(vty, "     router-id %s vrf default\n",
+                                inet_ntoa(zvrf->rid_user_assigned.u.prefix4));
+                else
+                        vty_out(vty, "     router-id %s vrf %s\n",
+                                inet_ntoa(zvrf->rid_user_assigned.u.prefix4),
+                                argv[idx_name]->arg);
+        }
+
+        return CMD_SUCCESS;
+}
 
 static int router_id_cmp(void *a, void *b)
 {
@@ -267,6 +297,7 @@ void router_id_cmd_init(void)
 {
        install_element(CONFIG_NODE, &router_id_cmd);
        install_element(CONFIG_NODE, &no_router_id_cmd);
+       install_element(VIEW_NODE, &show_router_id_cmd);
 }
 
 void router_id_init(struct zebra_vrf *zvrf)