nat: Include platform specific headers on FreeBSD
[vpp.git] / src / plugins / pppoe / pppoe_decap.c
index b2a6e4a..7c456a7 100644 (file)
@@ -133,8 +133,10 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
                          pppoe0 = (pppoe_header_t*)(vlan0+1);
                          if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) {
                                error0 = PPPOE_ERROR_BAD_VER_TYPE;
-                       next0 = PPPOE_INPUT_NEXT_DROP;
-                       goto trace0;
+                               result0.fields.session_index =
+                                 ~0; // avoid tracing random data
+                               next0 = PPPOE_INPUT_NEXT_DROP;
+                               goto trace0;
                          }
                  } else {
                          pppoe0 = (pppoe_header_t*)(h0+1);
@@ -152,6 +154,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
                    vlib_buffer_advance(b0, sizeof(*h0)+sizeof(*vlan0));
              error0 = PPPOE_ERROR_CONTROL_PLANE;
              next0 = PPPOE_INPUT_NEXT_CP_INPUT;
+             result0.fields.session_index = ~0;
              goto trace0;
             }
 
@@ -181,6 +184,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
 
           sw_if_index0 = t0->sw_if_index;
           len0 = vlib_buffer_length_in_chain (vm, b0);
+                 vnet_buffer(b0)->sw_if_index[VLIB_RX] = sw_if_index0;
 
           pkts_decapsulated ++;
           stats_n_packets += 1;
@@ -227,8 +231,10 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
                          pppoe1 = (pppoe_header_t*)(vlan1+1);
                          if( type1 != ETHERNET_TYPE_PPPOE_DISCOVERY && type1 != ETHERNET_TYPE_PPPOE_SESSION ) {
                                error1 = PPPOE_ERROR_BAD_VER_TYPE;
-                       next1 = PPPOE_INPUT_NEXT_DROP;
-                       goto trace1;
+                               result1.fields.session_index =
+                                 ~0; // avoid tracing random data
+                               next1 = PPPOE_INPUT_NEXT_DROP;
+                               goto trace1;
                          }
                  } else {
                          pppoe1 = (pppoe_header_t*)(h1+1);
@@ -246,6 +252,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
                    vlib_buffer_advance(b1, sizeof(*h1)+sizeof(*vlan1));
              error1 = PPPOE_ERROR_CONTROL_PLANE;
              next1 = PPPOE_INPUT_NEXT_CP_INPUT;
+             result1.fields.session_index = ~0;
              goto trace1;
             }
 
@@ -274,6 +281,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
 
           sw_if_index1 = t1->sw_if_index;
           len1 = vlib_buffer_length_in_chain (vm, b1);
+                 vnet_buffer(b1)->sw_if_index[VLIB_RX] = sw_if_index1;
 
           pkts_decapsulated ++;
           stats_n_packets += 1;
@@ -352,8 +360,10 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
                          pppoe0 = (pppoe_header_t*)(vlan0+1);
                          if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) {
                                error0 = PPPOE_ERROR_BAD_VER_TYPE;
-                       next0 = PPPOE_INPUT_NEXT_DROP;
-                       goto trace00;
+                               result0.fields.session_index =
+                                 ~0; // avoid tracing random data
+                               next0 = PPPOE_INPUT_NEXT_DROP;
+                               goto trace00;
                          }
                  } else {
                          pppoe0 = (pppoe_header_t*)(h0+1);
@@ -370,6 +380,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
                    vlib_buffer_advance(b0, sizeof(*h0)+sizeof(*vlan0));
              error0 = PPPOE_ERROR_CONTROL_PLANE;
              next0 = PPPOE_INPUT_NEXT_CP_INPUT;
+             result0.fields.session_index = ~0;
              goto trace00;
             }
 
@@ -398,6 +409,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
 
          sw_if_index0 = t0->sw_if_index;
          len0 = vlib_buffer_length_in_chain (vm, b0);
+         vnet_buffer(b0)->sw_if_index[VLIB_RX] = sw_if_index0;
 
           pkts_decapsulated ++;
           stats_n_packets += 1;
@@ -482,11 +494,9 @@ VLIB_REGISTER_NODE (pppoe_input_node) = {
   .format_trace = format_pppoe_rx_trace,
 };
 
-/* *INDENT-OFF* */
 VNET_FEATURE_INIT (pppoe_input_node, static) =
 {
   .arc_name = "device-input",
   .node_name = "pppoe-input",
   .runs_before = VNET_FEATURES ("ethernet-input"),
 };
-/* *INDENT-ON */