summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_bfd.c4
-rw-r--r--bgpd/bgp_main.c6
-rw-r--r--bgpd/bgp_nht.c4
-rw-r--r--bgpd/bgp_route.c16
-rw-r--r--bgpd/bgp_vty.c20
-rw-r--r--bgpd/rfapi/rfapi.c2
-rw-r--r--doc/isisd.texi55
-rw-r--r--doc/ospfd.texi55
-rw-r--r--lib/ns.h5
-rw-r--r--lib/vrf.c8
-rw-r--r--lib/vrf.h3
-rw-r--r--lib/zclient.c12
-rw-r--r--lib/zclient.h4
-rw-r--r--lib/zebra.h2
-rw-r--r--ospfd/ospf_vty.c42
-rw-r--r--ospfd/ospfd.c10
-rw-r--r--pimd/pim_instance.c4
-rw-r--r--pimd/pim_nht.c2
-rw-r--r--pimd/pim_zebra.c12
-rw-r--r--redhat/frr.spec.in5
-rw-r--r--zebra/interface.c3
-rw-r--r--zebra/zebra_fpm.c20
-rw-r--r--zebra/zebra_ns.c2
-rw-r--r--zebra/zebra_ns.h3
-rw-r--r--zebra/zebra_ptm.c2
-rw-r--r--zebra/zebra_static.c2
-rw-r--r--zebra/zebra_vty.c10
-rw-r--r--zebra/zserv.c10
28 files changed, 189 insertions, 134 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 2e277bfa5f..ce46b21f03 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -302,13 +302,13 @@ static int bgp_bfd_dest_update(int command, struct zclient *zclient,
prefix2str(&dp, buf[0], sizeof(buf[0]));
if (ifp) {
zlog_debug(
- "Zebra: vrf %d interface %s bfd destination %s %s",
+ "Zebra: vrf %u interface %s bfd destination %s %s",
vrf_id, ifp->name, buf[0],
bfd_get_status_str(status));
} else {
prefix2str(&sp, buf[1], sizeof(buf[1]));
zlog_debug(
- "Zebra: vrf %d source %s bfd destination %s %s",
+ "Zebra: vrf %u source %s bfd destination %s %s",
vrf_id, buf[1], buf[0],
bfd_get_status_str(status));
}
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index a720d31a76..0508f4846d 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -232,7 +232,7 @@ static __attribute__((__noreturn__)) void bgp_exit(int status)
static int bgp_vrf_new(struct vrf *vrf)
{
if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("VRF Created: %s(%d)", vrf->name, vrf->vrf_id);
+ zlog_debug("VRF Created: %s(%u)", vrf->name, vrf->vrf_id);
return 0;
}
@@ -240,7 +240,7 @@ static int bgp_vrf_new(struct vrf *vrf)
static int bgp_vrf_delete(struct vrf *vrf)
{
if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("VRF Deletion: %s(%d)", vrf->name, vrf->vrf_id);
+ zlog_debug("VRF Deletion: %s(%u)", vrf->name, vrf->vrf_id);
return 0;
}
@@ -251,7 +251,7 @@ static int bgp_vrf_enable(struct vrf *vrf)
vrf_id_t old_vrf_id;
if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("VRF enable add %s id %d", vrf->name, vrf->vrf_id);
+ zlog_debug("VRF enable add %s id %u", vrf->name, vrf->vrf_id);
bgp = bgp_lookup_by_name(vrf->name);
if (bgp) {
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 625d4f8442..247884d294 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -336,7 +336,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
bgp = bgp_lookup_by_vrf_id(vrf_id);
if (!bgp) {
zlog_err(
- "parse nexthop update: instance not found for vrf_id %d",
+ "parse nexthop update: instance not found for vrf_id %u",
vrf_id);
return;
}
@@ -389,7 +389,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
char buf[PREFIX2STR_BUFFER];
prefix2str(&p, buf, sizeof(buf));
zlog_debug(
- "%d: Rcvd NH update %s - metric %d/%d #nhops %d/%d flags 0x%x",
+ "%u: Rcvd NH update %s - metric %d/%d #nhops %d/%d flags 0x%x",
vrf_id, buf, metric, bnc->metric, nexthop_num,
bnc->nexthop_num, bnc->flags);
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 445ee8696b..fdc7f22ae8 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -7859,7 +7859,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
vty_out(vty,
"{\n \"vrfId\": %d,\n \"vrfName\": \"%s\",\n \"tableVersion\": %" PRId64
",\n \"routerId\": \"%s\",\n \"routes\": { ",
- bgp->vrf_id == VRF_UNKNOWN ? -1 : bgp->vrf_id,
+ bgp->vrf_id == VRF_UNKNOWN ? -1 : (int)bgp->vrf_id,
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT ? "Default"
: bgp->name,
table->version, inet_ntoa(bgp->router_id));
@@ -8127,6 +8127,9 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_node *rn, *next;
unsigned long output_cum = 0;
unsigned long total_cum = 0;
+ bool show_msg;
+
+ show_msg = (!use_json && type == bgp_show_type_normal);
for (rn = bgp_table_top(table); rn; rn = next) {
next = bgp_route_next(rn);
@@ -8142,8 +8145,19 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
output_arg, use_json,
rd, next == NULL,
&output_cum, &total_cum);
+ if (next == NULL)
+ show_msg = false;
}
}
+ if (show_msg) {
+ if (output_cum == 0)
+ vty_out(vty, "No BGP prefixes displayed, %ld exist\n",
+ total_cum);
+ else
+ vty_out(vty,
+ "\nDisplayed %ld routes and %ld total paths\n",
+ output_cum, total_cum);
+ }
if (use_json)
vty_out(vty, " } }");
return CMD_SUCCESS;
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 19cfb2d91d..c98cf9c327 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -6479,7 +6479,6 @@ DEFUN (show_bgp_vrfs,
struct listnode *node, *nnode;
int peers_cfg, peers_estb;
json_object *json_vrf = NULL;
- int vrf_id_ui;
/* Skip Views. */
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
@@ -6513,8 +6512,10 @@ DEFUN (show_bgp_vrfs,
type = "VRF";
}
- vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
+
if (uj) {
+ int64_t vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 :
+ (int64_t)bgp->vrf_id;
json_object_string_add(json_vrf, "type", type);
json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
json_object_string_add(json_vrf, "routerId",
@@ -6532,7 +6533,9 @@ DEFUN (show_bgp_vrfs,
} else
vty_out(vty,
"%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n",
- type, vrf_id_ui, inet_ntoa(bgp->router_id),
+ type, bgp->vrf_id == VRF_UNKNOWN ?
+ -1 : (int)bgp->vrf_id,
+ inet_ntoa(bgp->router_id),
peers_cfg, peers_estb, name, bgp->l3vni,
prefix_mac2str(&bgp->rmac, buf, sizeof(buf)));
}
@@ -6852,10 +6855,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (!count) {
unsigned long ents;
char memstrbuf[MTYPE_MEMSTR_LEN];
- int vrf_id_ui;
+ int64_t vrf_id_ui;
vrf_id_ui =
- (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
+ (bgp->vrf_id == VRF_UNKNOWN) ? -1 :
+ (int64_t)bgp->vrf_id;
/* Usage summary and header */
if (use_json) {
@@ -6874,7 +6878,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty,
"BGP router identifier %s, local AS number %u vrf-id %d",
inet_ntoa(bgp->router_id), bgp->as,
- vrf_id_ui);
+ bgp->vrf_id == VRF_UNKNOWN ? -1 :
+ (int)bgp->vrf_id);
vty_out(vty, "\n");
}
@@ -9876,8 +9881,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
json_object_int_add(json, "vrfId",
(bgp->vrf_id == VRF_UNKNOWN)
- ? -1
- : bgp->vrf_id);
+ ? -1 : (int64_t) bgp->vrf_id);
json_object_string_add(
json, "vrfName",
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 1e3c5a0352..95666143a5 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -913,7 +913,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
* aspath: points to interned hash from aspath hash table
*/
- red = bgp_redist_lookup(bgp, afi, type, VRF_DEFAULT);
+ red = bgp_redist_lookup(bgp, afi, type, 0);
if (red && red->redist_metric_flag) {
attr.med = red->redist_metric;
diff --git a/doc/isisd.texi b/doc/isisd.texi
index bbc2896755..404698d805 100644
--- a/doc/isisd.texi
+++ b/doc/isisd.texi
@@ -373,36 +373,37 @@ log file /var/log/zebra.log
!
interface eth0
ip address 10.2.2.2/24
- mpls-te on
- mpls-te link metric 10
- mpls-te link max-bw 1.25e+06
- mpls-te link max-rsv-bw 1.25e+06
- mpls-te link unrsv-bw 0 1.25e+06
- mpls-te link unrsv-bw 1 1.25e+06
- mpls-te link unrsv-bw 2 1.25e+06
- mpls-te link unrsv-bw 3 1.25e+06
- mpls-te link unrsv-bw 4 1.25e+06
- mpls-te link unrsv-bw 5 1.25e+06
- mpls-te link unrsv-bw 6 1.25e+06
- mpls-te link unrsv-bw 7 1.25e+06
- mpls-te link rsc-clsclr 0xab
+ link-params
+ enable
+ metric 100
+ max-bw 1.25e+07
+ max-rsv-bw 1.25e+06
+ unrsv-bw 0 1.25e+06
+ unrsv-bw 1 1.25e+06
+ unrsv-bw 2 1.25e+06
+ unrsv-bw 3 1.25e+06
+ unrsv-bw 4 1.25e+06
+ unrsv-bw 5 1.25e+06
+ unrsv-bw 6 1.25e+06
+ unrsv-bw 7 1.25e+06
+ admin-grp 0xab
!
interface eth1
ip address 10.1.1.1/24
- mpls-te on
- mpls-te link metric 10
- mpls-te link max-bw 1.25e+06
- mpls-te link max-rsv-bw 1.25e+06
- mpls-te link unrsv-bw 0 1.25e+06
- mpls-te link unrsv-bw 1 1.25e+06
- mpls-te link unrsv-bw 2 1.25e+06
- mpls-te link unrsv-bw 3 1.25e+06
- mpls-te link unrsv-bw 4 1.25e+06
- mpls-te link unrsv-bw 5 1.25e+06
- mpls-te link unrsv-bw 6 1.25e+06
- mpls-te link unrsv-bw 7 1.25e+06
- mpls-te link rsc-clsclr 0xab
- mpls-te neighbor 10.1.1.2 as 65000
+ link-params
+ enable
+ metric 100
+ max-bw 1.25e+07
+ max-rsv-bw 1.25e+06
+ unrsv-bw 0 1.25e+06
+ unrsv-bw 1 1.25e+06
+ unrsv-bw 2 1.25e+06
+ unrsv-bw 3 1.25e+06
+ unrsv-bw 4 1.25e+06
+ unrsv-bw 5 1.25e+06
+ unrsv-bw 6 1.25e+06
+ unrsv-bw 7 1.25e+06
+ neighbor 10.1.1.2 as 65000
@end group
@end example
diff --git a/doc/ospfd.texi b/doc/ospfd.texi
index cc33211510..26a7637048 100644
--- a/doc/ospfd.texi
+++ b/doc/ospfd.texi
@@ -843,36 +843,37 @@ log file /var/log/zebra.log
!
interface eth0
ip address 198.168.1.1/24
- mpls-te on
- mpls-te link metric 10
- mpls-te link max-bw 1.25e+06
- mpls-te link max-rsv-bw 1.25e+06
- mpls-te link unrsv-bw 0 1.25e+06
- mpls-te link unrsv-bw 1 1.25e+06
- mpls-te link unrsv-bw 2 1.25e+06
- mpls-te link unrsv-bw 3 1.25e+06
- mpls-te link unrsv-bw 4 1.25e+06
- mpls-te link unrsv-bw 5 1.25e+06
- mpls-te link unrsv-bw 6 1.25e+06
- mpls-te link unrsv-bw 7 1.25e+06
- mpls-te link rsc-clsclr 0xab
+ link-params
+ enable
+ admin-grp 0xa1
+ metric 100
+ max-bw 1.25e+07
+ max-rsv-bw 1.25e+06
+ unrsv-bw 0 1.25e+06
+ unrsv-bw 1 1.25e+06
+ unrsv-bw 2 1.25e+06
+ unrsv-bw 3 1.25e+06
+ unrsv-bw 4 1.25e+06
+ unrsv-bw 5 1.25e+06
+ unrsv-bw 6 1.25e+06
+ unrsv-bw 7 1.25e+06
!
interface eth1
ip address 192.168.2.1/24
- mpls-te on
- mpls-te link metric 10
- mpls-te link max-bw 1.25e+06
- mpls-te link max-rsv-bw 1.25e+06
- mpls-te link unrsv-bw 0 1.25e+06
- mpls-te link unrsv-bw 1 1.25e+06
- mpls-te link unrsv-bw 2 1.25e+06
- mpls-te link unrsv-bw 3 1.25e+06
- mpls-te link unrsv-bw 4 1.25e+06
- mpls-te link unrsv-bw 5 1.25e+06
- mpls-te link unrsv-bw 6 1.25e+06
- mpls-te link unrsv-bw 7 1.25e+06
- mpls-te link rsc-clsclr 0xab
- mpls-te neighbor 192.168.2.2 as 65000
+ link-params
+ enable
+ metric 10
+ max-bw 1.25e+07
+ max-rsv-bw 1.25e+06
+ unrsv-bw 0 1.25e+06
+ unrsv-bw 1 1.25e+06
+ unrsv-bw 2 1.25e+06
+ unrsv-bw 3 1.25e+06
+ unrsv-bw 4 1.25e+06
+ unrsv-bw 5 1.25e+06
+ unrsv-bw 6 1.25e+06
+ unrsv-bw 7 1.25e+06
+ neighbor 192.168.2.2 as 65000
@end group
@end example
diff --git a/lib/ns.h b/lib/ns.h
index c492d6600b..79b4cab04d 100644
--- a/lib/ns.h
+++ b/lib/ns.h
@@ -25,10 +25,11 @@
#include "openbsd-tree.h"
#include "linklist.h"
-typedef u_int16_t ns_id_t;
+typedef u_int32_t ns_id_t;
-/* The default NS ID */
+/* the default NS ID */
#define NS_DEFAULT 0
+#define NS_UNKNOWN UINT32_MAX
/* Default netns directory (Linux) */
#define NS_RUN_DIR "/var/run/netns"
diff --git a/lib/vrf.c b/lib/vrf.c
index 3c34b95262..2fa3a9c0ef 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -94,7 +94,7 @@ struct vrf *vrf_get(vrf_id_t vrf_id, const char *name)
int new = 0;
if (debug_vrf)
- zlog_debug("VRF_GET: %s(%d)", name, vrf_id);
+ zlog_debug("VRF_GET: %s(%u)", name, vrf_id);
/* Nothing to see, move along here */
if (!name && vrf_id == VRF_UNKNOWN)
@@ -267,8 +267,8 @@ void *vrf_info_lookup(vrf_id_t vrf_id)
* VRF bit-map
*/
-#define VRF_BITMAP_NUM_OF_GROUPS 8
-#define VRF_BITMAP_NUM_OF_BITS_IN_GROUP (UINT16_MAX / VRF_BITMAP_NUM_OF_GROUPS)
+#define VRF_BITMAP_NUM_OF_GROUPS 1024
+#define VRF_BITMAP_NUM_OF_BITS_IN_GROUP (UINT32_MAX / VRF_BITMAP_NUM_OF_GROUPS)
#define VRF_BITMAP_NUM_OF_BYTES_IN_GROUP \
(VRF_BITMAP_NUM_OF_BITS_IN_GROUP / CHAR_BIT + 1) /* +1 for ensure */
@@ -355,7 +355,7 @@ static void vrf_autocomplete(vector comps, struct cmd_token *token)
struct vrf *vrf = NULL;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (vrf->vrf_id != 0)
+ if (vrf->vrf_id != VRF_DEFAULT)
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, vrf->name));
}
}
diff --git a/lib/vrf.h b/lib/vrf.h
index 9afca4c6fb..7e625769e7 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -32,8 +32,7 @@
/* The default VRF ID */
#define VRF_DEFAULT 0
-#define VRF_UNKNOWN UINT16_MAX
-#define VRF_ALL UINT16_MAX - 1
+#define VRF_UNKNOWN UINT32_MAX
/* Pending: May need to refine this. */
#ifndef IFLA_VRF_MAX
diff --git a/lib/zclient.c b/lib/zclient.c
index 4177ce1a71..d4a7b45b97 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -291,7 +291,7 @@ void zclient_create_header(struct stream *s, uint16_t command, vrf_id_t vrf_id)
stream_putw(s, ZEBRA_HEADER_SIZE);
stream_putc(s, ZEBRA_HEADER_MARKER);
stream_putc(s, ZSERV_VERSION);
- stream_putw(s, vrf_id);
+ stream_putl(s, vrf_id);
stream_putw(s, command);
}
@@ -306,7 +306,7 @@ int zclient_read_header(struct stream *s, int sock, u_int16_t *size,
*size -= ZEBRA_HEADER_SIZE;
STREAM_GETC(s, *marker);
STREAM_GETC(s, *version);
- STREAM_GETW(s, *vrf_id);
+ STREAM_GETL(s, *vrf_id);
STREAM_GETW(s, *cmd);
if (*version != ZSERV_VERSION || *marker != ZEBRA_HEADER_MARKER) {
@@ -1677,7 +1677,7 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s,
{
unsigned int ifindex;
struct interface *ifp;
- vrf_id_t new_id = VRF_DEFAULT;
+ vrf_id_t new_id;
/* Get interface index. */
ifindex = stream_getl(s);
@@ -2043,7 +2043,7 @@ static int zclient_read(struct thread *thread)
length = stream_getw(zclient->ibuf);
marker = stream_getc(zclient->ibuf);
version = stream_getc(zclient->ibuf);
- vrf_id = stream_getw(zclient->ibuf);
+ vrf_id = stream_getl(zclient->ibuf);
command = stream_getw(zclient->ibuf);
if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) {
@@ -2346,9 +2346,9 @@ void zclient_interface_set_master(struct zclient *client,
zclient_create_header(s, ZEBRA_INTERFACE_SET_MASTER, master->vrf_id);
- stream_putw(s, master->vrf_id);
+ stream_putl(s, master->vrf_id);
stream_putl(s, master->ifindex);
- stream_putw(s, slave->vrf_id);
+ stream_putl(s, slave->vrf_id);
stream_putl(s, slave->ifindex);
stream_putw_at(s, 0, stream_get_endp(s));
diff --git a/lib/zclient.h b/lib/zclient.h
index cc34fd9d2c..00ad692718 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -40,7 +40,7 @@
#define ZEBRA_MAX_PACKET_SIZ 4096
/* Zebra header size. */
-#define ZEBRA_HEADER_SIZE 8
+#define ZEBRA_HEADER_SIZE 10
/* special socket path name to use TCP
* @ is used as first character because that's abstract socket names on Linux
@@ -227,7 +227,7 @@ struct zserv_header {
* always set to 255 in new zserv.
*/
uint8_t version;
-#define ZSERV_VERSION 4
+#define ZSERV_VERSION 5
vrf_id_t vrf_id;
uint16_t command;
};
diff --git a/lib/zebra.h b/lib/zebra.h
index 1eb0c56252..b9a795d160 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -486,7 +486,7 @@ typedef u_int16_t zebra_size_t;
typedef u_int16_t zebra_command_t;
/* VRF ID type. */
-typedef u_int16_t vrf_id_t;
+typedef uint32_t vrf_id_t;
typedef uint32_t route_tag_t;
#define ROUTE_TAG_MAX UINT32_MAX
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index bc95118345..6d28c2cdc5 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -218,7 +218,7 @@ DEFUN_NOSH (router_ospf,
if (ospf->vrf_id != VRF_UNKNOWN)
ospf->oi_running = 1;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("Config command 'router ospf %d' received, vrf %s id %d oi_running %u",
+ zlog_debug("Config command 'router ospf %d' received, vrf %s id %u oi_running %u",
instance, ospf->name ? ospf->name : "NIL",
ospf->vrf_id, ospf->oi_running);
VTY_PUSH_CONTEXT(OSPF_NODE, ospf);
@@ -3693,14 +3693,15 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
{
struct interface *ifp;
struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
- json_object *json_vrf = NULL;
- json_object *json_interface_sub = NULL;
+ json_object *json_vrf = NULL, *json_intf_array = NULL;
+ json_object *json_interface_sub = NULL, *json_interface = NULL;
if (use_json) {
if (use_vrf)
json_vrf = json_object_new_object();
else
json_vrf = json;
+ json_intf_array = json_object_new_array();
}
if (ospf->instance) {
@@ -3714,21 +3715,29 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
ospf_show_vrf_name(ospf, vty, json_vrf, use_vrf);
if (intf_name == NULL) {
+ if (use_json)
+ json_object_object_add(json_vrf, "interfaces",
+ json_intf_array);
/* Show All Interfaces.*/
FOR_ALL_INTERFACES (vrf, ifp) {
if (ospf_oi_count(ifp)) {
- if (use_json)
+ if (use_json) {
+ json_interface =
+ json_object_new_object();
json_interface_sub =
json_object_new_object();
-
+ }
show_ip_ospf_interface_sub(vty, ospf, ifp,
json_interface_sub,
use_json);
- if (use_json)
+ if (use_json) {
+ json_object_array_add(json_intf_array,
+ json_interface);
json_object_object_add(
- json_vrf, ifp->name,
+ json_interface, ifp->name,
json_interface_sub);
+ }
}
}
} else {
@@ -3741,15 +3750,23 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
else
vty_out(vty, "No such interface name\n");
} else {
- if (use_json)
+ if (use_json) {
json_interface_sub = json_object_new_object();
+ json_interface = json_object_new_object();
+ json_object_object_add(json_vrf, "interfaces",
+ json_intf_array);
+ }
show_ip_ospf_interface_sub(
vty, ospf, ifp, json_interface_sub, use_json);
- if (use_json)
- json_object_object_add(json_vrf, ifp->name,
+ if (use_json) {
+ json_object_array_add(json_intf_array,
+ json_interface);
+ json_object_object_add(json_interface,
+ ifp->name,
json_interface_sub);
+ }
}
}
@@ -9583,7 +9600,7 @@ DEFUN (show_ip_ospf_vrfs,
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
json_object *json_vrf = NULL;
const char *name = NULL;
- int vrf_id_ui = 0;
+ int64_t vrf_id_ui = 0;
count++;
@@ -9597,7 +9614,8 @@ DEFUN (show_ip_ospf_vrfs,
else
name = ospf->name;
- vrf_id_ui = (ospf->vrf_id == VRF_UNKNOWN) ? -1 : ospf->vrf_id;
+ vrf_id_ui = (ospf->vrf_id == VRF_UNKNOWN) ? -1 :
+ (int64_t) ospf->vrf_id;
if (uj) {
json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 862e87e40f..6d583e9b4a 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -240,7 +240,7 @@ static struct ospf *ospf_new(u_short instance, const char *name)
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
vrf = vrf_lookup_by_name(new->name);
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("%s: Create new ospf instance with vrf_name %s vrf_id %d",
+ zlog_debug("%s: Create new ospf instance with vrf_name %s vrf_id %u",
__PRETTY_FUNCTION__, name, new->vrf_id);
if (vrf)
ospf_vrf_link(new, vrf);
@@ -2013,7 +2013,7 @@ void ospf_vrf_unlink(struct ospf *ospf, struct vrf *vrf)
static int ospf_vrf_new(struct vrf *vrf)
{
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("%s: VRF Created: %s(%d)", __PRETTY_FUNCTION__,
+ zlog_debug("%s: VRF Created: %s(%u)", __PRETTY_FUNCTION__,
vrf->name, vrf->vrf_id);
return 0;
@@ -2023,7 +2023,7 @@ static int ospf_vrf_new(struct vrf *vrf)
static int ospf_vrf_delete(struct vrf *vrf)
{
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("%s: VRF Deletion: %s(%d)", __PRETTY_FUNCTION__,
+ zlog_debug("%s: VRF Deletion: %s(%u)", __PRETTY_FUNCTION__,
vrf->name, vrf->vrf_id);
return 0;
@@ -2036,7 +2036,7 @@ static int ospf_vrf_enable(struct vrf *vrf)
vrf_id_t old_vrf_id = VRF_DEFAULT;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("%s: VRF %s id %d enabled",
+ zlog_debug("%s: VRF %s id %u enabled",
__PRETTY_FUNCTION__, vrf->name, vrf->vrf_id);
ospf = ospf_lookup_by_name(vrf->name);
@@ -2045,7 +2045,7 @@ static int ospf_vrf_enable(struct vrf *vrf)
/* We have instance configured, link to VRF and make it "up". */
ospf_vrf_link(ospf, vrf);
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("%s: ospf linked to vrf %s vrf_id %d (old id %d)",
+ zlog_debug("%s: ospf linked to vrf %s vrf_id %u (old id %u)",
__PRETTY_FUNCTION__, vrf->name, ospf->vrf_id,
old_vrf_id);
diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c
index 1fccbaeafa..8da610a3a6 100644
--- a/pimd/pim_instance.c
+++ b/pimd/pim_instance.c
@@ -136,7 +136,7 @@ static int pim_vrf_new(struct vrf *vrf)
{
struct pim_instance *pim = pim_instance_init(vrf);
- zlog_debug("VRF Created: %s(%d)", vrf->name, vrf->vrf_id);
+ zlog_debug("VRF Created: %s(%u)", vrf->name, vrf->vrf_id);
if (pim == NULL) {
zlog_err("%s %s: pim class init failure ", __FILE__,
__PRETTY_FUNCTION__);
@@ -159,7 +159,7 @@ static int pim_vrf_delete(struct vrf *vrf)
{
struct pim_instance *pim = vrf->info;
- zlog_debug("VRF Deletion: %s(%d)", vrf->name, vrf->vrf_id);
+ zlog_debug("VRF Deletion: %s(%u)", vrf->name, vrf->vrf_id);
pim_ssmpingd_destroy(pim);
pim_instance_terminate(pim);
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index e2984e1d13..089639c77e 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -811,7 +811,7 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
char buf[PREFIX2STR_BUFFER];
prefix2str(&p, buf, sizeof(buf));
zlog_debug(
- "%s: NHT Update for %s(%s) num_nh %d num_pim_nh %d vrf:%d up %ld rp %d",
+ "%s: NHT Update for %s(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d",
__PRETTY_FUNCTION__, buf, pim->vrf->name, nexthop_num,
pnc->nexthop_num, vrf_id, pnc->upstream_hash->count,
listcount(pnc->rp_list));
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 689e9a7449..6e82558766 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -80,7 +80,7 @@ static int pim_zebra_if_add(int command, struct zclient *zclient,
if (PIM_DEBUG_ZEBRA) {
zlog_debug(
- "%s: %s index %d(%d) flags %ld metric %d mtu %d operative %d",
+ "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__, ifp->name, ifp->ifindex, vrf_id,
(long)ifp->flags, ifp->metric, ifp->mtu,
if_is_operative(ifp));
@@ -130,7 +130,7 @@ static int pim_zebra_if_del(int command, struct zclient *zclient,
if (PIM_DEBUG_ZEBRA) {
zlog_debug(
- "%s: %s index %d(%d) flags %ld metric %d mtu %d operative %d",
+ "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__, ifp->name, ifp->ifindex, vrf_id,
(long)ifp->flags, ifp->metric, ifp->mtu,
if_is_operative(ifp));
@@ -158,7 +158,7 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient,
if (PIM_DEBUG_ZEBRA) {
zlog_debug(
- "%s: %s index %d(%d) flags %ld metric %d mtu %d operative %d",
+ "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__, ifp->name, ifp->ifindex, vrf_id,
(long)ifp->flags, ifp->metric, ifp->mtu,
if_is_operative(ifp));
@@ -213,7 +213,7 @@ static int pim_zebra_if_state_down(int command, struct zclient *zclient,
if (PIM_DEBUG_ZEBRA) {
zlog_debug(
- "%s: %s index %d(%d) flags %ld metric %d mtu %d operative %d",
+ "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__, ifp->name, ifp->ifindex, vrf_id,
(long)ifp->flags, ifp->metric, ifp->mtu,
if_is_operative(ifp));
@@ -293,7 +293,7 @@ static int pim_zebra_if_address_add(int command, struct zclient *zclient,
if (PIM_DEBUG_ZEBRA) {
char buf[BUFSIZ];
prefix2str(p, buf, BUFSIZ);
- zlog_debug("%s: %s(%d) connected IP address %s flags %u %s",
+ zlog_debug("%s: %s(%u) connected IP address %s flags %u %s",
__PRETTY_FUNCTION__, c->ifp->name, vrf_id, buf,
c->flags, CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
@@ -372,7 +372,7 @@ static int pim_zebra_if_address_del(int command, struct zclient *client,
char buf[BUFSIZ];
prefix2str(p, buf, BUFSIZ);
zlog_debug(
- "%s: %s(%d) disconnected IP address %s flags %u %s",
+ "%s: %s(%u) disconnected IP address %s flags %u %s",
__PRETTY_FUNCTION__, c->ifp->name, vrf_id, buf,
c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in
index 4e05f7828c..20b96bb76f 100644
--- a/redhat/frr.spec.in
+++ b/redhat/frr.spec.in
@@ -22,7 +22,7 @@
%{!?with_multipath: %global with_multipath 256 }
%{!?frr_user: %global frr_user frr }
%{!?vty_group: %global vty_group frrvty }
-%{!?with_fpm: %global with_fpm 0 }
+%{!?with_fpm: %global with_fpm 1 }
%{!?with_watchfrr: %global with_watchfrr 1 }
%{!?with_bgp_vnc: %global with_bgp_vnc 0 }
%{!?with_pimd: %global with_pimd 1 }
@@ -554,6 +554,9 @@ rm -rf %{buildroot}
%{_libdir}/lib*.so.0
%attr(755,root,root) %{_libdir}/lib*.so.0.*
%endif
+%if %{with_fpm}
+%attr(755,root,root) %{_libdir}/frr/modules/zebra_fpm.so
+%endif
%attr(755,root,root) %{_libdir}/frr/modules/zebra_irdp.so
%{_bindir}/*
%config(noreplace) /etc/frr/[!v]*.conf*
diff --git a/zebra/interface.c b/zebra/interface.c
index 906f796136..07570e64bf 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -768,7 +768,8 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id)
zebra_interface_vrf_update_add(ifp, old_vrf_id);
/* Install connected routes (in new VRF). */
- if_install_connected(ifp);
+ if (if_is_operative(ifp))
+ if_install_connected(ifp);
static_ifindex_update(ifp, true);
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 0d0a2cb3bf..a6e0882ff8 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -713,7 +713,15 @@ static int zfpm_read_cb(struct thread *thread)
nbyte = stream_read_try(ibuf, zfpm_g->sock,
FPM_MSG_HDR_LEN - already);
if (nbyte == 0 || nbyte == -1) {
- zfpm_connection_down("closed socket in read");
+ if (nbyte == -1) {
+ char buffer[1024];
+
+ sprintf(buffer, "closed socket in read(%d): %s",
+ errno, safe_strerror(errno));
+ zfpm_connection_down(buffer);
+ }
+ else
+ zfpm_connection_down("closed socket in read");
return 0;
}
@@ -743,7 +751,15 @@ static int zfpm_read_cb(struct thread *thread)
nbyte = stream_read_try(ibuf, zfpm_g->sock, msg_len - already);
if (nbyte == 0 || nbyte == -1) {
- zfpm_connection_down("failed to read message");
+ if (nbyte == -1) {
+ char buffer[1024];
+
+ sprintf(buffer, "failed to read message(%d) %s",
+ errno, safe_strerror(errno));
+ zfpm_connection_down(buffer);
+ }
+ else
+ zfpm_connection_down("failed to read message");
return 0;
}
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 5ede948e0a..b3b9c6d18a 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -81,7 +81,7 @@ int zebra_ns_init(void)
zebra_vrf_init();
- zebra_ns_enable(0, (void **)&dzns);
+ zebra_ns_enable(NS_DEFAULT, (void **)&dzns);
return 0;
}
diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h
index 0c340d8d59..5d90b9be67 100644
--- a/zebra/zebra_ns.h
+++ b/zebra/zebra_ns.h
@@ -57,9 +57,6 @@ struct zebra_ns {
#endif /* HAVE_RTADV */
};
-#define NS_DEFAULT 0
-#define NS_UNKNOWN UINT16_MAX
-
struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id);
int zebra_ns_init(void);
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 769d2f5666..953f74ecec 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -432,7 +432,7 @@ static void if_bfd_session_update(struct interface *ifp, struct prefix *dp,
} else {
zlog_debug(
"MESSAGE: ZEBRA_INTERFACE_BFD_DEST_UPDATE %s/%d "
- "with src %s/%d and vrf %d %s event",
+ "with src %s/%d and vrf %u %s event",
inet_ntop(dp->family, &dp->u.prefix, buf[0],
INET6_ADDRSTRLEN),
dp->prefixlen,
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 751ea08a38..3dd5378f22 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -156,7 +156,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
re->mtu = 0;
re->vrf_id = si->vrf_id;
re->table =
- si->vrf_id
+ (si->vrf_id != VRF_DEFAULT)
? (zebra_vrf_lookup_by_id(si->vrf_id))->table_id
: zebrad.rtm_table_default;
re->nexthop_num = 0;
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 82b0157ad3..df461ab10c 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1181,7 +1181,7 @@ DEFUN (ip_nht_default_route,
return CMD_SUCCESS;
zebra_rnh_ip_default_route = 1;
- zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(VRF_DEFAULT, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1197,7 +1197,7 @@ DEFUN (no_ip_nht_default_route,
return CMD_SUCCESS;
zebra_rnh_ip_default_route = 0;
- zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(VRF_DEFAULT, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1212,7 +1212,7 @@ DEFUN (ipv6_nht_default_route,
return CMD_SUCCESS;
zebra_rnh_ipv6_default_route = 1;
- zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(VRF_DEFAULT, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1228,7 +1228,7 @@ DEFUN (no_ipv6_nht_default_route,
return CMD_SUCCESS;
zebra_rnh_ipv6_default_route = 0;
- zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(VRF_DEFAULT, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1890,7 +1890,7 @@ DEFUN (show_vrf,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (!(zvrf = vrf->info))
continue;
- if (!zvrf_id(zvrf))
+ if (zvrf_id(zvrf) == VRF_DEFAULT)
continue;
vty_out(vty, "vrf %s ", zvrf_name(zvrf));
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 7eded89f6d..6241a16389 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -155,7 +155,7 @@ void zserv_create_header(struct stream *s, uint16_t cmd, vrf_id_t vrf_id)
stream_putw(s, ZEBRA_HEADER_SIZE);
stream_putc(s, ZEBRA_HEADER_MARKER);
stream_putc(s, ZSERV_VERSION);
- stream_putw(s, vrf_id);
+ stream_putl(s, vrf_id);
stream_putw(s, cmd);
}
@@ -508,7 +508,7 @@ int zsend_interface_vrf_update(struct zserv *client, struct interface *ifp,
/* Fill in the ifIndex of the interface and its new VRF (id) */
stream_putl(s, ifp->ifindex);
- stream_putw(s, vrf_id);
+ stream_putl(s, vrf_id);
/* Write packet size. */
stream_putw_at(s, 0, stream_get_endp(s));
@@ -2472,11 +2472,11 @@ static int zread_interface_set_master(struct zserv *client,
int ifindex;
vrf_id_t vrf_id;
- STREAM_GETW(s, vrf_id);
+ STREAM_GETL(s, vrf_id);
STREAM_GETL(s, ifindex);
master = if_lookup_by_index(ifindex, vrf_id);
- STREAM_GETW(s, vrf_id);
+ STREAM_GETL(s, vrf_id);
STREAM_GETL(s, ifindex);
slave = if_lookup_by_index(ifindex, vrf_id);
@@ -2714,7 +2714,7 @@ static int zebra_client_read(struct thread *thread)
STREAM_GETW(client->ibuf, length);
STREAM_GETC(client->ibuf, marker);
STREAM_GETC(client->ibuf, version);
- STREAM_GETW(client->ibuf, vrf_id);
+ STREAM_GETL(client->ibuf, vrf_id);
STREAM_GETW(client->ibuf, command);
if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) {