diff options
Diffstat (limited to 'zebra/zserv.c')
| -rw-r--r-- | zebra/zserv.c | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c index 83d7d0f811..b7e45d8df1 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -742,28 +742,28 @@ zsend_redistribute_route (int add, struct zserv *client, struct prefix *p, /* ldpd needs all nexthops */ if (client->proto != ZEBRA_ROUTE_LDP) - break; + break; } } /* Distance */ - SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE); - stream_putc (s, rib->distance); + SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE); + stream_putc (s, rib->distance); /* Metric */ - SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC); - stream_putl (s, rib->metric); + SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC); + stream_putl (s, rib->metric); /* Tag */ - if (rib->tag) - { - SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG); + if (rib->tag) + { + SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG); stream_putl(s, rib->tag); - } + } /* MTU */ - SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU); - stream_putl (s, rib->mtu); + SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU); + stream_putl (s, rib->mtu); /* write real message flags value */ stream_putc_at (s, messmark, zapi_flags); @@ -1665,6 +1665,7 @@ zread_mpls_labels (int command, struct zserv *client, u_short length, struct prefix prefix; enum nexthop_types_t gtype; union g_addr gate; + ifindex_t ifindex; mpls_label_t in_label, out_label; u_int8_t distance; struct zebra_vrf *zvrf; @@ -1684,37 +1685,56 @@ zread_mpls_labels (int command, struct zserv *client, u_short length, case AF_INET: prefix.u.prefix4.s_addr = stream_get_ipv4 (s); prefix.prefixlen = stream_getc (s); - gtype = NEXTHOP_TYPE_IPV4; gate.ipv4.s_addr = stream_get_ipv4 (s); break; case AF_INET6: stream_get (&prefix.u.prefix6, s, 16); prefix.prefixlen = stream_getc (s); - gtype = NEXTHOP_TYPE_IPV6; stream_get (&gate.ipv6, s, 16); break; default: return; } + ifindex = stream_getl (s); distance = stream_getc (s); in_label = stream_getl (s); out_label = stream_getl (s); + switch (prefix.family) + { + case AF_INET: + if (ifindex) + gtype = NEXTHOP_TYPE_IPV4_IFINDEX; + else + gtype = NEXTHOP_TYPE_IPV4; + break; + case AF_INET6: + if (ifindex) + gtype = NEXTHOP_TYPE_IPV6_IFINDEX; + else + gtype = NEXTHOP_TYPE_IPV6; + break; + default: + return; + } + if (! mpls_enabled) return; if (command == ZEBRA_MPLS_LABELS_ADD) { mpls_lsp_install (zvrf, type, in_label, out_label, gtype, &gate, - NULL, 0); + NULL, ifindex); if (out_label != MPLS_IMP_NULL_LABEL) - mpls_ftn_update (1, zvrf, type, &prefix, &gate, distance, out_label); + mpls_ftn_update (1, zvrf, type, &prefix, gtype, &gate, ifindex, + distance, out_label); } else if (command == ZEBRA_MPLS_LABELS_DELETE) { - mpls_lsp_uninstall (zvrf, type, in_label, gtype, &gate, NULL, 0); + mpls_lsp_uninstall (zvrf, type, in_label, gtype, &gate, NULL, ifindex); if (out_label != MPLS_IMP_NULL_LABEL) - mpls_ftn_update (0, zvrf, type, &prefix, &gate, distance, out_label); + mpls_ftn_update (0, zvrf, type, &prefix, gtype, &gate, ifindex, + distance, out_label); } } @@ -2364,19 +2384,19 @@ DEFUN (show_table, return CMD_SUCCESS; } -DEFUN (config_table, +DEFUN (config_table, config_table_cmd, "table TABLENO", "Configure target kernel routing table\n" "TABLE integer\n") { - zebrad.rtm_table_default = strtol (argv[0], (char**)0, 10); + zebrad.rtm_table_default = strtol (argv[1]->arg, (char**)0, 10); return CMD_SUCCESS; } DEFUN (no_config_table, no_config_table_cmd, - "no table TABLENO", + "no table [TABLENO]", NO_STR "Configure target kernel routing table\n" "TABLE integer\n") @@ -2433,7 +2453,7 @@ DEFUN (show_zebra_client, show_zebra_client_cmd, "show zebra client", SHOW_STR - "Zebra information" + "Zebra information\n" "Client information") { struct listnode *node; |
