不同情况,通过函数参数pkt_type进行的区分。 单播:pkt_type = BR_PKT_UNICAST 广播:pkt_type = BR_PKT_BROADCAST 多播:pkt_type = BR_PKT_MULTICAST 3.4 数据包发往本地:br_pass_frame_up 数据进入br_pass_frame_up,是打算经由Bridge设备,输入到本地Host的。数据包从网桥端口设备进入,经过网桥设备,然后再...
ether_addr_equal_64bits(eth->h_dest, dev->dev_addr))) { if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) { if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast)) skb->pkt_type = PACKET_BROADCAST; else skb->pkt_type = PACKET_MULTICAST; } else { skb->pkt_...
dev->dev_addr))) {if(unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {if(ether_addr_equal_64bits(eth->h_dest, dev->broadcast)) skb->pkt_type =PACKET_BROADCAST;elseskb->pkt_type =PACKET_MULTICAST; }else{ skb->pkt_type =PACKET_OTHERHOST; } }/** Some variants of DSA ta...
skb->pkt_type =PACKET_OUTGOING; skb_reserve(skb, ETH_HLEN+ip_header_len+udp_header_len);//adjust headroom/*allocate space to data and write it*/data=skb_put(skb,udp_payload_len); memcpy(data, hello_world, data_len);/*UDP header*/structudphdr* uh = (structudphdr*)skb_push(skb,u...
skb->pkt_type = PACKET_HOST; skb->protocol = eth_type_trans(skb, skb->dev); skb->dev->stats.rx_packets++; skb->dev->stats.rx_bytes += skb->len;netif_receive_skb(skb);return0; out_drop: kfree_skb(skb); out:return0;
skb->pkt_type == PACKET_OTHERHOST || skb->pkt_type == PACKET_LOOPBACK || arp->ar_pln !=4)gotofreeskb;if((skb =skb_share_check(skb, GFP_ATOMIC)) ==NULL)gotoout_of_mem;returnNF_HOOK(NF_ARP, NF_ARP_IN, skb, dev,NULL, arp_process); ...
*/ But when having a tunnel (say vxlan) attached to a bridge we have the following call trace: br_nf_pre_routing br_nf_pre_routing_ipv6 br_nf_pre_routing_finish br_nf_forward_ip br_nf_forward_finish br_nf_post_routing <- pkt_type is updated to PACKET_HOST br_nf_dev_queue_xmit...
skb->pkt_type=PACKET_HOST;//表明是发往本机的包 skb->dev=&can_control;//此处很重要,如果没有这条语句,则内核跑死。至少在我板子上是这样的。can_control是我的net_device结构体变量。 netif_rx(skb); } 注意:当调用skb_copy_expand或者修改了skb的数据域后,一定要更新udph->len和ipv6h->payload_...
skb->pkt_type = PACKET_OTHERHOST; skb->protocol = __constant_htons(ETH_P_IP); skb->ip_summed = CHECKSUM_NONE; skb->priority = 0; //skb->nh.iph = (struct iphdr*)skb_put(skb, sizeof (struct iphdr)); //skb->h.th = (struct tcphdr*)skb_put(skb, sizeof (struct tcphdr));...
skb->protocol = pkt.type; skb->priority = TC_PRIO_CONTROL; @@ -1266,7 +1266,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) u8 *hash_start = NULL; int res = 1; skb->mac.raw = (unsigned char *)skb->data; skb_reset_mac_header(skb); eth_data ...