#include <vnet/dhcp/dhcp_proxy.h>
#include <vnet/l2tp/l2tp.h>
#include <vnet/l2/l2_input.h>
-#include <vnet/sr/sr_packet.h>
+#include <vnet/srv6/sr.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
#include <vnet/classify/policer_classify.h>
#include <vnet/policer/xlate.h>
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
if (mp->is_ipv6)
- s = format (s, "ip6");
+ s = format (s, "ip6 ");
if (mp->enable)
s = format (s, "enable ");
if (mp->is_add)
{
- s = format (s, "flood %d uu-flood %d forward %d learn %d arp-term %d",
- mp->flood, mp->uu_flood, mp->forward, mp->learn,
- mp->arp_term);
+ s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
+ s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
+ s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
}
else
s = format (s, "del ");
FINISH;
}
+static void *vl_api_bridge_domain_set_mac_age_t_print
+ (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
+
+ s = format (s, "bd_id %d ", ntohl (mp->bd_id));
+
+ s = format (s, "mac-age %d", mp->mac_age);
+
+ FINISH;
+}
+
static void *vl_api_bridge_domain_dump_t_print
(vl_api_bridge_domain_dump_t * mp, void *handle)
{
FINISH;
}
+static void *vl_api_l2fib_flush_bd_t_print
+ (vl_api_l2fib_flush_bd_t * mp, void *handle)
+{
+ u8 *s;
+ u32 bd_id = ntohl (mp->bd_id);
+
+ s = format (0, "SCRIPT: l2fib_flush_bd ");
+ s = format (s, "bd_id %d ", bd_id);
+
+ FINISH;
+}
+
+static void *vl_api_l2fib_flush_int_t_print
+ (vl_api_l2fib_flush_int_t * mp, void *handle)
+{
+ u8 *s;
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+
+ s = format (0, "SCRIPT: l2fib_flush_int ");
+ s = format (s, "sw_if_index %d ", sw_if_index);
+
+ FINISH;
+}
+
static void *vl_api_l2fib_add_del_t_print
(vl_api_l2fib_add_del_t * mp, void *handle)
{
if (mp->is_static)
s = format (s, "is_static ");
+ if (mp->is_no_adj_fib)
+ s = format (s, "is_no_fib_entry ");
+
if (memcmp (mp->mac_address, null_mac, 6))
s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
- s = format (s, "pid %d ", mp->pid);
+ s = format (s, "pid %d ", ntohl (mp->pid));
if (mp->is_add == 0)
s = format (s, "del ");
FINISH;
}
-static void *vl_api_sr_tunnel_add_del_t_print
- (vl_api_sr_tunnel_add_del_t * mp, void *handle)
+static void *vl_api_sr_localsid_add_del_t_print
+ (vl_api_sr_localsid_add_del_t * mp, void *handle)
{
+ vnet_main_t *vnm = vnet_get_main ();
u8 *s;
- ip6_address_t *this_address;
- int i;
- u16 flags_host_byte_order;
- u8 pl_flag;
-
- s = format (0, "SCRIPT: sr_tunnel_add_del ");
-
- if (mp->name[0])
- s = format (s, "name %s ", mp->name);
- s = format (s, "src %U dst %U/%d ", format_ip6_address,
- (ip6_address_t *) mp->src_address,
- format_ip6_address,
- (ip6_address_t *) mp->dst_address, mp->dst_mask_width);
+ s = format (0, "SCRIPT: sr_localsid_add_del ");
- this_address = (ip6_address_t *) mp->segs_and_tags;
- for (i = 0; i < mp->n_segments; i++)
+ switch (mp->behavior)
{
- s = format (s, "next %U ", format_ip6_address, this_address);
- this_address++;
- }
- for (i = 0; i < mp->n_tags; i++)
- {
- s = format (s, "tag %U ", format_ip6_address, this_address);
- this_address++;
+ case SR_BEHAVIOR_END:
+ s = format (s, "Address: %U\nBehavior: End",
+ format_ip6_address, (ip6_address_t *) mp->localsid_addr);
+ s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
+ break;
+ case SR_BEHAVIOR_X:
+ s =
+ format (s,
+ "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
+ "\nIface: %U\nNext hop: %U", format_ip6_address,
+ (ip6_address_t *) mp->localsid_addr,
+ format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
+ format_ip6_address, (ip6_address_t *) mp->nh_addr);
+ s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
+ break;
+ case SR_BEHAVIOR_DX4:
+ s =
+ format (s,
+ "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
+ "\nIface: %U\nNext hop: %U", format_ip6_address,
+ (ip6_address_t *) mp->localsid_addr,
+ format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
+ format_ip4_address, (ip4_address_t *) mp->nh_addr);
+ break;
+ case SR_BEHAVIOR_DX6:
+ s =
+ format (s,
+ "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
+ "\nIface: %UNext hop: %U", format_ip6_address,
+ (ip6_address_t *) mp->localsid_addr,
+ format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
+ format_ip6_address, (ip6_address_t *) mp->nh_addr);
+ break;
+ case SR_BEHAVIOR_DX2:
+ s =
+ format (s,
+ "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
+ "\nIface: %U", format_ip6_address,
+ (ip6_address_t *) mp->localsid_addr,
+ format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
+ break;
+ case SR_BEHAVIOR_DT6:
+ s =
+ format (s,
+ "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
+ "\nTable: %u", format_ip6_address,
+ (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
+ break;
+ case SR_BEHAVIOR_DT4:
+ s =
+ format (s,
+ "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
+ "\nTable: %u", format_ip6_address,
+ (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
+ break;
+ default:
+ if (mp->behavior >= SR_BEHAVIOR_LAST)
+ {
+ s = format (s, "Address: %U\n Behavior: %u",
+ format_ip6_address, (ip6_address_t *) mp->localsid_addr,
+ mp->behavior);
+ }
+ else
+ //Should never get here...
+ s = format (s, "Internal error");
+ break;
}
+ FINISH;
+}
- flags_host_byte_order = clib_net_to_host_u16 (mp->flags_net_byte_order);
+static void *vl_api_sr_steering_add_del_t_print
+ (vl_api_sr_steering_add_del_t * mp, void *handle)
+{
+ u8 *s;
- if (flags_host_byte_order & IP6_SR_HEADER_FLAG_CLEANUP)
- s = format (s, " clean ");
+ s = format (0, "SCRIPT: sr_steering_add_del ");
- if (flags_host_byte_order & IP6_SR_HEADER_FLAG_PROTECTED)
- s = format (s, "protected ");
+ s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
- for (i = 1; i <= 4; i++)
+ switch (mp->traffic_type)
{
- pl_flag = ip6_sr_policy_list_flags (flags_host_byte_order, i);
-
- switch (pl_flag)
- {
- case IP6_SR_HEADER_FLAG_PL_ELT_NOT_PRESENT:
- continue;
-
- case IP6_SR_HEADER_FLAG_PL_ELT_INGRESS_PE:
- s = format (s, "InPE %d ", i);
- break;
-
- case IP6_SR_HEADER_FLAG_PL_ELT_EGRESS_PE:
- s = format (s, "EgPE %d ", i);
- break;
-
- case IP6_SR_HEADER_FLAG_PL_ELT_ORIG_SRC_ADDR:
- s = format (s, "OrgSrc %d ", i);
- break;
-
- default:
- clib_warning ("BUG: pl elt %d value %d", i, pl_flag);
- break;
- }
+ case SR_STEER_L2:
+ s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
+ break;
+ case SR_STEER_IPV4:
+ s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
+ (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
+ break;
+ case SR_STEER_IPV6:
+ s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
+ (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
+ break;
+ default:
+ s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
+ break;
}
+ s = format (s, "BindingSID: %U", format_ip6_address,
+ (ip6_address_t *) mp->bsid_addr);
- if (mp->policy_name[0])
- s = format (s, "policy_name %s ", mp->policy_name);
+ s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
- if (mp->is_add == 0)
- s = format (s, "del ");
+ s = format (s, "FIB_table: %u", ntohl (mp->table_id));
FINISH;
}
-static void *vl_api_sr_policy_add_del_t_print
- (vl_api_sr_policy_add_del_t * mp, void *handle)
+static void *vl_api_sr_policy_add_t_print
+ (vl_api_sr_policy_add_t * mp, void *handle)
{
u8 *s;
+
+ ip6_address_t *segments = 0, *seg;
+ ip6_address_t *this_address = (ip6_address_t *) mp->segments;
+
int i;
+ for (i = 0; i < mp->n_segments; i++)
+ {
+ vec_add2 (segments, seg, 1);
+ clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
+ this_address++;
+ }
- s = format (0, "SCRIPT: sr_policy_add_del ");
+ s = format (0, "SCRIPT: sr_policy_add ");
- if (mp->name[0])
- s = format (s, "name %s ", mp->name);
+ s = format (s, "BSID: %U", format_ip6_address,
+ (ip6_address_t *) mp->bsid_addr);
+ s =
+ format (s,
+ (mp->is_encap ? "Behavior: Encapsulation" :
+ "Behavior: SRH insertion"));
- if (mp->tunnel_names[0])
- {
- // start deserializing tunnel_names
- int num_tunnels = mp->tunnel_names[0]; //number of tunnels
- u8 *deser_tun_names = mp->tunnel_names;
- deser_tun_names += 1; //moving along
+ s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
- u8 *tun_name = 0;
- int tun_name_len = 0;
+ s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
- for (i = 0; i < num_tunnels; i++)
- {
- tun_name_len = *deser_tun_names;
- deser_tun_names += 1;
- vec_resize (tun_name, tun_name_len);
- memcpy (tun_name, deser_tun_names, tun_name_len);
- s = format (s, "tunnel %s ", tun_name);
- deser_tun_names += tun_name_len;
- tun_name = 0;
- }
- }
+ s = format (s, "SID list weight: %u", ntohl (mp->weight));
- if (mp->is_add == 0)
- s = format (s, "del ");
+ s = format (s, "{");
+ vec_foreach (seg, segments)
+ {
+ s = format (s, "%U, ", format_ip6_address, seg);
+ }
+ s = format (s, "\b\b } ");
FINISH;
}
-static void *vl_api_sr_multicast_map_add_del_t_print
- (vl_api_sr_multicast_map_add_del_t * mp, void *handle)
+static void *vl_api_sr_policy_mod_t_print
+ (vl_api_sr_policy_mod_t * mp, void *handle)
{
+ u8 *s;
+ u32 weight;
- u8 *s = 0;
- /* int i; */
+ ip6_address_t *segments = 0, *seg;
+ ip6_address_t *this_address = (ip6_address_t *) mp->segments;
- s = format (0, "SCRIPT: sr_multicast_map_add_del ");
+ int i;
+ for (i = 0; i < mp->n_segments; i++)
+ {
+ vec_add2 (segments, seg, 1);
+ clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
+ this_address++;
+ }
- if (mp->multicast_address[0])
- s = format (s, "address %U ", format_ip6_address, &mp->multicast_address);
+ s = format (0, "SCRIPT: sr_policy_mod ");
- if (mp->policy_name[0])
- s = format (s, "sr-policy %s ", &mp->policy_name);
+ s = format (s, "BSID: %U", format_ip6_address,
+ (ip6_address_t *) mp->bsid_addr);
+ s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
- if (mp->is_add == 0)
- s = format (s, "del ");
+ s = format (s, "Operation: %u", mp->operation);
+
+ s = format (s, "SID list index: %u", ntohl (mp->sl_index));
+
+ s = format (s, "SID list weight: %u", ntohl (mp->weight));
+
+ s = format (s, "{");
+ vec_foreach (seg, segments)
+ {
+ s = format (s, "%U, ", format_ip6_address, seg);
+ }
+ s = format (s, "\b\b } ");
FINISH;
}
+static void *vl_api_sr_policy_del_t_print
+ (vl_api_sr_policy_del_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: sr_policy_del ");
+ u8 bsid_addr[16];
+ u32 sr_policy_index;
+ s = format (s, "To be delivered. Good luck.");
+ FINISH;
+}
static void *vl_api_classify_add_del_table_t_print
(vl_api_classify_add_del_table_t * mp, void *handle)
u8 *s;
s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
- ip46_address_t src, dst;
-
- ip46_from_addr_buf (mp->is_ipv6, mp->dst_address, &dst);
- ip46_from_addr_buf (mp->is_ipv6, mp->src_address, &src);
+ ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
+ ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
u8 is_grp = ip46_address_is_multicast (&dst);
char *dst_name = is_grp ? "group" : "dst";
s = format (s, "vni %d ", ntohl (mp->vni));
- if (mp->is_add == 0)
- s = format (s, "del ");
-
if (mp->is_add == 0)
s = format (s, "del ");
u8 *s;
s = format (0, "SCRIPT: want_ip4_arp_events ");
- s = format (s, "pid %d address %U ", mp->pid,
+ s = format (s, "pid %d address %U ", ntohl (mp->pid),
format_ip4_address, &mp->address);
if (mp->enable_disable == 0)
s = format (s, "del ");
u8 *s;
s = format (0, "SCRIPT: want_ip6_nd_events ");
- s = format (s, "pid %d address %U ", mp->pid,
+ s = format (s, "pid %d address %U ", ntohl (mp->pid),
format_ip6_address, mp->address);
if (mp->enable_disable == 0)
s = format (s, "del ");
_(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
_(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
_(L2_PATCH_ADD_DEL, l2_patch_add_del) \
-_(SR_TUNNEL_ADD_DEL, sr_tunnel_add_del) \
-_(SR_POLICY_ADD_DEL, sr_policy_add_del) \
-_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \
+_(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
+_(SR_STEERING_ADD_DEL, sr_steering_add_del) \
+_(SR_POLICY_ADD, sr_policy_add) \
+_(SR_POLICY_MOD, sr_policy_mod) \
+_(SR_POLICY_DEL, sr_policy_del) \
_(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
_(L2FIB_ADD_DEL, l2fib_add_del) \
+_(L2FIB_FLUSH_BD, l2fib_flush_bd) \
+_(L2FIB_FLUSH_INT, l2fib_flush_int) \
_(L2_FLAGS, l2_flags) \
_(BRIDGE_FLAGS, bridge_flags) \
_(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
_(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
_(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
_(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
+_(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
_(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
_(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
_(ADD_NODE_NEXT, add_node_next) \