37 s =
format (s,
"PPPoE decap from pppoe_session%d session_id %d next %d error %d",
42 s =
format (s,
"PPPoE decap error - session for session_id %d does not exist",
56 u32 pkts_decapsulated = 0;
58 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
67 cached_result.
raw = ~0;
70 stats_sw_if_index =
node->runtime_data[0];
71 stats_n_packets = stats_n_bytes = 0;
78 to_next, n_left_to_next);
87 u16 ppp_proto0 = 0, ppp_proto1 = 0;
89 u32 error0 = 0, error1 = 0;
90 u32 sw_if_index0, sw_if_index1, len0, len1;
129 type0 = clib_net_to_host_u16(h0->
type);
130 if(type0 == ETHERNET_TYPE_VLAN){
132 type0 = clib_net_to_host_u16(vlan0->
type);
134 if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) {
135 error0 = PPPOE_ERROR_BAD_VER_TYPE;
136 next0 = PPPOE_INPUT_NEXT_DROP;
143 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
146 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
147 && (ppp_proto0 != PPP_PROTOCOL_ip6))
153 error0 = PPPOE_ERROR_CONTROL_PLANE;
154 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
161 &key0, &bucket0, &result0);
164 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
165 next0 = PPPOE_INPUT_NEXT_DROP;
170 result0.
fields.session_index);
178 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
179 PPPOE_INPUT_NEXT_IP4_INPUT
180 : PPPOE_INPUT_NEXT_IP6_INPUT;
186 pkts_decapsulated ++;
187 stats_n_packets += 1;
188 stats_n_bytes += len0;
194 stats_n_packets -= 1;
195 stats_n_bytes -= len0;
200 stats_n_packets, stats_n_bytes);
202 stats_n_bytes = len0;
203 stats_sw_if_index = sw_if_index0;
207 b0->
error = error0 ?
node->errors[error0] : 0;
224 type1 = clib_net_to_host_u16(h1->
type);
225 if(type1 == ETHERNET_TYPE_VLAN){
227 type1 = clib_net_to_host_u16(vlan1->type);
229 if( type1 != ETHERNET_TYPE_PPPOE_DISCOVERY && type1 != ETHERNET_TYPE_PPPOE_SESSION ) {
230 error1 = PPPOE_ERROR_BAD_VER_TYPE;
231 next1 = PPPOE_INPUT_NEXT_DROP;
238 ppp_proto1 = clib_net_to_host_u16(pppoe1->
ppp_proto);
241 if ((ppp_proto1 != PPP_PROTOCOL_ip4)
242 && (ppp_proto1 != PPP_PROTOCOL_ip6))
248 error1 = PPPOE_ERROR_CONTROL_PLANE;
249 next1 = PPPOE_INPUT_NEXT_CP_INPUT;
255 &key1, &bucket1, &result1);
258 error1 = PPPOE_ERROR_NO_SUCH_SESSION;
259 next1 = PPPOE_INPUT_NEXT_DROP;
264 result1.
fields.session_index);
272 next1 = (ppp_proto1==PPP_PROTOCOL_ip4)?
273 PPPOE_INPUT_NEXT_IP4_INPUT
274 : PPPOE_INPUT_NEXT_IP6_INPUT;
280 pkts_decapsulated ++;
281 stats_n_packets += 1;
282 stats_n_bytes += len1;
288 stats_n_packets -= 1;
289 stats_n_bytes -= len1;
294 stats_n_packets, stats_n_bytes);
296 stats_n_bytes = len1;
297 stats_sw_if_index = sw_if_index1;
301 b1->
error = error1 ?
node->errors[error1] : 0;
314 to_next, n_left_to_next,
315 bi0, bi1, next0, next1);
329 u32 sw_if_index0, len0;
350 type0 = clib_net_to_host_u16(h0->
type);
351 if(type0 == ETHERNET_TYPE_VLAN){
353 type0 = clib_net_to_host_u16(vlan0->
type);
355 if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) {
356 error0 = PPPOE_ERROR_BAD_VER_TYPE;
357 next0 = PPPOE_INPUT_NEXT_DROP;
364 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
366 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
367 && (ppp_proto0 != PPP_PROTOCOL_ip6))
373 error0 = PPPOE_ERROR_CONTROL_PLANE;
374 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
380 &key0, &bucket0, &result0);
383 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
384 next0 = PPPOE_INPUT_NEXT_DROP;
389 result0.
fields.session_index);
397 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
398 PPPOE_INPUT_NEXT_IP4_INPUT
399 : PPPOE_INPUT_NEXT_IP6_INPUT;
405 pkts_decapsulated ++;
406 stats_n_packets += 1;
407 stats_n_bytes += len0;
413 stats_n_packets -= 1;
414 stats_n_bytes -= len0;
419 stats_n_packets, stats_n_bytes);
421 stats_n_bytes = len0;
422 stats_sw_if_index = sw_if_index0;
426 b0->
error = error0 ?
node->errors[error0] : 0;
438 to_next, n_left_to_next,
446 PPPOE_ERROR_DECAPSULATED,
454 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
455 node->runtime_data[0] = stats_sw_if_index;
461 #ifndef CLIB_MARCH_VARIANT
463 #define pppoe_error(n,s) s,
471 .name =
"pppoe-input",
473 .vector_size =
sizeof (
u32),
480 #define _(s,n) [PPPOE_INPUT_NEXT_##s] = n,
491 .arc_name =
"device-input",
492 .node_name =
"pppoe-input",