Lines Matching refs:skb

123 static void *ipvlan_get_L3_hdr(struct sk_buff *skb, int *type)  in ipvlan_get_L3_hdr()  argument
127 switch (skb->protocol) { in ipvlan_get_L3_hdr()
131 if (unlikely(!pskb_may_pull(skb, sizeof(*arph)))) in ipvlan_get_L3_hdr()
134 arph = arp_hdr(skb); in ipvlan_get_L3_hdr()
143 if (unlikely(!pskb_may_pull(skb, sizeof(*ip4h)))) in ipvlan_get_L3_hdr()
146 ip4h = ip_hdr(skb); in ipvlan_get_L3_hdr()
150 if (skb->len < pktlen || pktlen < (ip4h->ihl * 4)) in ipvlan_get_L3_hdr()
160 if (unlikely(!pskb_may_pull(skb, sizeof(*ip6h)))) in ipvlan_get_L3_hdr()
163 ip6h = ipv6_hdr(skb); in ipvlan_get_L3_hdr()
192 static void ipvlan_multicast_frame(struct ipvl_port *port, struct sk_buff *skb, in ipvlan_multicast_frame() argument
195 struct ethhdr *eth = eth_hdr(skb); in ipvlan_multicast_frame()
202 if (skb->protocol == htons(ETH_P_PAUSE)) in ipvlan_multicast_frame()
215 len = skb->len + ETH_HLEN; in ipvlan_multicast_frame()
216 nskb = skb_clone(skb, GFP_ATOMIC); in ipvlan_multicast_frame()
240 nskb = skb_clone(skb, GFP_ATOMIC); in ipvlan_multicast_frame()
252 static int ipvlan_rcv_frame(struct ipvl_addr *addr, struct sk_buff *skb, in ipvlan_rcv_frame() argument
261 len = skb->len + ETH_HLEN; in ipvlan_rcv_frame()
263 kfree_skb(skb); in ipvlan_rcv_frame()
267 skb = skb_share_check(skb, GFP_ATOMIC); in ipvlan_rcv_frame()
268 if (!skb) in ipvlan_rcv_frame()
271 skb->dev = dev; in ipvlan_rcv_frame()
272 skb->pkt_type = PACKET_HOST; in ipvlan_rcv_frame()
275 if (dev_forward_skb(ipvlan->dev, skb) == NET_RX_SUCCESS) in ipvlan_rcv_frame()
338 static int ipvlan_process_v4_outbound(struct sk_buff *skb) in ipvlan_process_v4_outbound() argument
340 const struct iphdr *ip4h = ip_hdr(skb); in ipvlan_process_v4_outbound()
341 struct net_device *dev = skb->dev; in ipvlan_process_v4_outbound()
360 skb_dst_drop(skb); in ipvlan_process_v4_outbound()
361 skb_dst_set(skb, &rt->dst); in ipvlan_process_v4_outbound()
362 err = ip_local_out(skb); in ipvlan_process_v4_outbound()
370 kfree_skb(skb); in ipvlan_process_v4_outbound()
375 static int ipvlan_process_v6_outbound(struct sk_buff *skb) in ipvlan_process_v6_outbound() argument
377 const struct ipv6hdr *ip6h = ipv6_hdr(skb); in ipvlan_process_v6_outbound()
378 struct net_device *dev = skb->dev; in ipvlan_process_v6_outbound()
382 .flowi6_iif = skb->dev->ifindex, in ipvlan_process_v6_outbound()
387 .flowi6_mark = skb->mark, in ipvlan_process_v6_outbound()
397 skb_dst_drop(skb); in ipvlan_process_v6_outbound()
398 skb_dst_set(skb, dst); in ipvlan_process_v6_outbound()
399 err = ip6_local_out(skb); in ipvlan_process_v6_outbound()
407 kfree_skb(skb); in ipvlan_process_v6_outbound()
412 static int ipvlan_process_outbound(struct sk_buff *skb, in ipvlan_process_outbound() argument
415 struct ethhdr *ethh = eth_hdr(skb); in ipvlan_process_outbound()
421 ntohs(skb->protocol)); in ipvlan_process_outbound()
422 kfree_skb(skb); in ipvlan_process_outbound()
430 if (skb_mac_header_was_set(skb)) { in ipvlan_process_outbound()
431 skb_pull(skb, sizeof(*ethh)); in ipvlan_process_outbound()
432 skb->mac_header = (typeof(skb->mac_header))~0U; in ipvlan_process_outbound()
433 skb_reset_network_header(skb); in ipvlan_process_outbound()
436 if (skb->protocol == htons(ETH_P_IPV6)) in ipvlan_process_outbound()
437 ret = ipvlan_process_v6_outbound(skb); in ipvlan_process_outbound()
438 else if (skb->protocol == htons(ETH_P_IP)) in ipvlan_process_outbound()
439 ret = ipvlan_process_v4_outbound(skb); in ipvlan_process_outbound()
442 ntohs(skb->protocol)); in ipvlan_process_outbound()
443 kfree_skb(skb); in ipvlan_process_outbound()
449 static int ipvlan_xmit_mode_l3(struct sk_buff *skb, struct net_device *dev) in ipvlan_xmit_mode_l3() argument
456 lyr3h = ipvlan_get_L3_hdr(skb, &addr_type); in ipvlan_xmit_mode_l3()
462 return ipvlan_rcv_frame(addr, skb, true); in ipvlan_xmit_mode_l3()
465 skb->dev = ipvlan->phy_dev; in ipvlan_xmit_mode_l3()
466 return ipvlan_process_outbound(skb, ipvlan); in ipvlan_xmit_mode_l3()
469 static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) in ipvlan_xmit_mode_l2() argument
472 struct ethhdr *eth = eth_hdr(skb); in ipvlan_xmit_mode_l2()
478 lyr3h = ipvlan_get_L3_hdr(skb, &addr_type); in ipvlan_xmit_mode_l2()
482 return ipvlan_rcv_frame(addr, skb, true); in ipvlan_xmit_mode_l2()
484 skb = skb_share_check(skb, GFP_ATOMIC); in ipvlan_xmit_mode_l2()
485 if (!skb) in ipvlan_xmit_mode_l2()
493 return dev_forward_skb(ipvlan->phy_dev, skb); in ipvlan_xmit_mode_l2()
496 u8 ip_summed = skb->ip_summed; in ipvlan_xmit_mode_l2()
498 skb->ip_summed = CHECKSUM_UNNECESSARY; in ipvlan_xmit_mode_l2()
499 ipvlan_multicast_frame(ipvlan->port, skb, ipvlan, true); in ipvlan_xmit_mode_l2()
500 skb->ip_summed = ip_summed; in ipvlan_xmit_mode_l2()
503 skb->dev = ipvlan->phy_dev; in ipvlan_xmit_mode_l2()
504 return dev_queue_xmit(skb); in ipvlan_xmit_mode_l2()
507 int ipvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) in ipvlan_queue_xmit() argument
515 if (unlikely(!pskb_may_pull(skb, sizeof(struct ethhdr)))) in ipvlan_queue_xmit()
520 return ipvlan_xmit_mode_l2(skb, dev); in ipvlan_queue_xmit()
522 return ipvlan_xmit_mode_l3(skb, dev); in ipvlan_queue_xmit()
529 kfree_skb(skb); in ipvlan_queue_xmit()
533 static bool ipvlan_external_frame(struct sk_buff *skb, struct ipvl_port *port) in ipvlan_external_frame() argument
535 struct ethhdr *eth = eth_hdr(skb); in ipvlan_external_frame()
540 if (ether_addr_equal(eth->h_source, skb->dev->dev_addr)) { in ipvlan_external_frame()
541 lyr3h = ipvlan_get_L3_hdr(skb, &addr_type); in ipvlan_external_frame()
559 struct sk_buff *skb = *pskb; in ipvlan_handle_mode_l3() local
562 lyr3h = ipvlan_get_L3_hdr(skb, &addr_type); in ipvlan_handle_mode_l3()
568 ret = ipvlan_rcv_frame(addr, skb, false); in ipvlan_handle_mode_l3()
577 struct sk_buff *skb = *pskb; in ipvlan_handle_mode_l2() local
578 struct ethhdr *eth = eth_hdr(skb); in ipvlan_handle_mode_l2()
584 if (ipvlan_external_frame(skb, port)) in ipvlan_handle_mode_l2()
585 ipvlan_multicast_frame(port, skb, NULL, false); in ipvlan_handle_mode_l2()
589 lyr3h = ipvlan_get_L3_hdr(skb, &addr_type); in ipvlan_handle_mode_l2()
595 ret = ipvlan_rcv_frame(addr, skb, false); in ipvlan_handle_mode_l2()
603 struct sk_buff *skb = *pskb; in ipvlan_handle_frame() local
604 struct ipvl_port *port = ipvlan_port_get_rcu(skb->dev); in ipvlan_handle_frame()
619 kfree_skb(skb); in ipvlan_handle_frame()