I really hoped that there's a better and shorter solution, but I couldn't find it. You can try with this ugly patch with a (lot of) copy-paste from lip_punt_node :)
On Thu, 26 Jan 2023 at 14:14, <agv...@gmail.com> wrote: > Hi Stanislav, > > Situation is better now, but still only half of the problem solved :-) > OSI IS-IS packets passed from network to tap, but not passed from tap to > network. > These are on TAP interface, where:78 is VPP-based router, :7a is non-VPP > peer, both directions are seen: > 13:03:22.911887 3c:ec:ef:5f:78:7a > 09:00:2b:00:00:05, 802.3, length 1500: > LLC, dsap OSI (0xfe) Individual, ssap OSI (0xfe) Command, ctrl 0x03: OSI > NLPID IS-IS (0x83): p2p IIH, src-id 0000.0000.0001, length 1497 > 13:03:23.433773 3c:ec:ef:5f:77:8f > 09:00:2b:00:00:05, 802.3, length 1500: > LLC, dsap OSI (0xfe) Individual, ssap OSI (0xfe) Command, ctrl 0x03: OSI > NLPID IS-IS (0x83): p2p IIH, src-id 0000.0000.0001, length 1497 > , > These are on opposite side of link, (Linux IS-IS router without VPP), only > outgoing packets are seen: > 13:08:54.796588 3c:ec:ef:5f:78:7a > 09:00:2b:00:00:05, 802.3, length 1500: > LLC, dsap OSI (0xfe) Individual, ssap OSI (0xfe) Command, ctrl 0x03: OSI > NLPID IS-IS (0x83): p2p IIH, src-id 0000.0000.0001, length 1497 > 13:08:57.662629 3c:ec:ef:5f:78:7a > 09:00:2b:00:00:05, 802.3, length 1500: > LLC, dsap OSI (0xfe) Individual, ssap OSI (0xfe) Command, ctrl 0x03: OSI > NLPID IS-IS (0x83): p2p IIH, src-id 0000.0000.0001, length 1497 > > > Also, it looks like lcp auto-subint is broken ; VPP aborts on ip link add > <Vlan subif> on TAP device, instead of creating subif. I'll provide back > trace later on > > Jan 26 12:57:04 tn3 vnet[1133419]: unix_signal_handler:191: received > signal SIGWINCH, PC 0x7fdd59a34f41 > Jan 26 12:57:11 tn3 vnet[1133419]: received signal SIGWINCH, PC > 0x7fdd59a34f41 > Jan 26 12:57:11 tn3 vnet[1133419]: #0 0x00007fdd59a95c92 > unix_signal_handler + 0x1f2 > Jan 26 12:57:11 tn3 vnet[1133419]: #1 0x00007fdd59993420 0x7fdd59993420 > Jan 26 12:57:11 tn3 vnet[1133419]: #2 0x00007fdd5a5b8f00 > virtio_refill_vring_split + 0x60 > Jan 26 12:57:11 tn3 vnet[1133419]: #3 0x00007fdd5a5b7f52 > virtio_device_input_inline + 0x2f2 > Jan 26 12:57:11 tn3 vnet[1133419]: #4 0x00007fdd5a5b7acb > virtio_input_node_fn_skx + 0x19b > Jan 26 12:57:11 tn3 vnet[1133419]: #5 0x00007fdd59a3515d dispatch_node + > 0x33d > Jan 26 12:57:11 tn3 vnet[1133419]: #6 0x00007fdd59a30c72 > vlib_main_or_worker_loop + 0x632 > Jan 26 12:57:11 tn3 vnet[1133419]: #7 0x00007fdd59a3277a vlib_main_loop + > 0x1a > Jan 26 12:57:11 tn3 vnet[1133419]: #8 0x00007fdd59a3229a vlib_main + 0x60a > Jan 26 12:57:11 tn3 vnet[1133419]: #9 0x00007fdd59a94a14 thread0 + 0x44 > Jan 26 12:57:11 tn3 vnet[1133419]: #10 0x00007fdd598e43d8 0x7fdd598e43d8 > > > -- Best regards Stanislav Zaikin
diff --git a/src/plugins/linux-cp/lcp_node.c b/src/plugins/linux-cp/lcp_node.c index b00049884..c119b8bd7 100644 --- a/src/plugins/linux-cp/lcp_node.c +++ b/src/plugins/linux-cp/lcp_node.c @@ -15,6 +15,7 @@ * limitations under the License. */ +#include "vnet/osi/osi.h" #include <sys/socket.h> #include <linux/if.h> @@ -935,6 +936,147 @@ VNET_FEATURE_INIT (lcp_arp_host_arp_feat, static) = { .runs_before = VNET_FEATURES ("arp-reply"), }; +typedef struct l2_punt_trace_t_ +{ + u8 direction; + u32 phy_sw_if_index; + u32 host_sw_if_index; +} l2_punt_trace_t; + +static u8 * +format_l2_punt_trace (u8 *s, va_list *args) +{ + CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); + CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); + l2_punt_trace_t *t = va_arg (*args, l2_punt_trace_t *); + + if (t->direction) + { + s = format (s, "l2-punt: %u -> %u", t->host_sw_if_index, + t->phy_sw_if_index); + } + else + { + s = format (s, "l2-punt: %u -> %u", t->phy_sw_if_index, + t->host_sw_if_index); + } + + return s; +} + +VLIB_NODE_FN (l2_punt_node) +(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame) +{ + u32 n_left_from, *from, *to_next, n_left_to_next; + lip_punt_next_t next_index; + + next_index = node->cached_next_index; + n_left_from = frame->n_vectors; + from = vlib_frame_vector_args (frame); + + while (n_left_from > 0) + { + vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); + + while (n_left_from > 0 && n_left_to_next > 0) + { + vlib_buffer_t *b0; + const lcp_itf_pair_t *lip0 = NULL; + u32 next0 = ~0; + u32 bi0, lipi0; + u32 sw_if_index0; + u8 direction = 0; + u8 len0; + + bi0 = to_next[0] = from[0]; + + from += 1; + to_next += 1; + n_left_from -= 1; + n_left_to_next -= 1; + next0 = LIP_PUNT_NEXT_DROP; + + b0 = vlib_get_buffer (vm, bi0); + + sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; + lipi0 = lcp_itf_pair_find_by_phy (sw_if_index0); + if (lipi0 == INDEX_INVALID) + { + lipi0 = lcp_itf_pair_find_by_host (sw_if_index0); + if (lipi0 == INDEX_INVALID) + goto trace0; + + direction = 1; + } + + lip0 = lcp_itf_pair_get (lipi0); + next0 = LIP_PUNT_NEXT_IO; + vnet_buffer (b0)->sw_if_index[VLIB_TX] = + direction ? lip0->lip_phy_sw_if_index : lip0->lip_host_sw_if_index; + + if (PREDICT_TRUE (lip0->lip_host_type == LCP_ITF_HOST_TAP)) + { + /* + * rewind to ethernet header + */ + len0 = ((u8 *) vlib_buffer_get_current (b0) - + (u8 *) ethernet_buffer_get_header (b0)); + vlib_buffer_advance (b0, -len0); + } + + trace0: + if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED))) + { + l2_punt_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); + t->direction = direction; + if (direction) + { + t->phy_sw_if_index = + (lipi0 == INDEX_INVALID) ? ~0 : lip0->lip_phy_sw_if_index; + t->host_sw_if_index = sw_if_index0; + } + else + { + + t->phy_sw_if_index = sw_if_index0; + t->host_sw_if_index = + (lipi0 == INDEX_INVALID) ? ~0 : lip0->lip_host_sw_if_index; + } + } + + vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, + n_left_to_next, bi0, next0); + } + + vlib_put_next_frame (vm, node, next_index, n_left_to_next); + } + + return frame->n_vectors; +} + +VLIB_REGISTER_NODE (l2_punt_node) = { + .name = "linux-cp-punt-l2", + .vector_size = sizeof (u32), + .format_trace = format_l2_punt_trace, + .type = VLIB_NODE_TYPE_INTERNAL, + + .n_next_nodes = LIP_PUNT_N_NEXT, + .next_nodes = { + [LIP_PUNT_NEXT_DROP] = "error-drop", + [LIP_PUNT_NEXT_IO] = "interface-output", + }, + }; + +static clib_error_t * +lcp_osi_init (vlib_main_t *vm) +{ + osi_register_input_protocol (OSI_PROTOCOL_isis, l2_punt_node.index); + + return NULL; +} + +VLIB_INIT_FUNCTION (lcp_osi_init); + /* * fd.io coding-style-patch-verification: ON *
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#22512): https://lists.fd.io/g/vpp-dev/message/22512 Mute This Topic: https://lists.fd.io/mt/96476162/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-