vapi: fix coverity warnings
[vpp.git] / src / plugins / pppoe / pppoe_cp_node.c
index 884d207..1a44b5d 100644 (file)
@@ -19,8 +19,6 @@
 #include <vnet/ppp/packet.h>
 #include <pppoe/pppoe.h>
 
-vlib_node_registration_t pppoe_cp_dispatch_node;
-
 #define foreach_pppoe_cp_next        \
 _(DROP, "error-drop")                  \
 _(INTERFACE, "interface-output" )      \
@@ -66,8 +64,7 @@ static u8 * format_pppoe_cp_trace (u8 * s, va_list * args)
   return s;
 }
 
-static uword
-pppoe_cp_dispatch (vlib_main_t * vm,
+VLIB_NODE_FN (pppoe_cp_dispatch_node) (vlib_main_t * vm,
                     vlib_node_runtime_t * node,
                     vlib_frame_t * from_frame)
 {
@@ -156,6 +153,9 @@ pppoe_cp_dispatch (vlib_main_t * vm,
 
               /* set src mac address */
               si = vnet_get_sw_interface(vnm, tx_sw_if_index0);
+              if( si->type == VNET_SW_INTERFACE_TYPE_SUB ) {
+                si = vnet_get_sw_interface(vnm, si->sup_sw_if_index);
+              }
               hi = vnet_get_hw_interface (vnm, si->hw_if_index);
               clib_memcpy_fast (vlib_buffer_get_current (b0)+6, hi->hw_address, 6);
             }
@@ -236,11 +236,13 @@ pppoe_cp_dispatch (vlib_main_t * vm,
 }
 
 VLIB_REGISTER_NODE (pppoe_cp_dispatch_node) = {
-  .function = pppoe_cp_dispatch,
   .name = "pppoe-cp-dispatch",
   /* Takes a vector of packets. */
   .vector_size = sizeof (u32),
 
+  .n_errors = PPPOE_N_ERROR,
+  .error_strings = pppoe_error_strings,
+
   .n_next_nodes = PPPOE_CP_N_NEXT,
   .next_nodes = {
 #define _(s,n) [PPPOE_CP_NEXT_##s] = n,
@@ -251,5 +253,3 @@ VLIB_REGISTER_NODE (pppoe_cp_dispatch_node) = {
   .format_trace = format_pppoe_cp_trace,
 };
 
-VLIB_NODE_FUNCTION_MULTIARCH (pppoe_cp_dispatch_node, pppoe_cp_dispatch)
-