1.数据包目的地址是网桥端口地址:将pkt_type设为PACKET_HOST if (ether_addr_equal(p->br->dev->dev_addr, dest)) skb->pkt_type = PACKET_HOST; 2.否则,br_handle_local_finish函数设置到网桥预处理节点,该函数在网桥状态部位disable时,会学习mac与端口信息并记录fdb表中 if (NF_HOOK(NFPROTO_BRIDGE, ...
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; } 开发者ID:MichaelSun1979,项目名称:backfire,代码行数:48,...
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->dev=&can_control;//此处很重要,如果没有这条语句,则内核跑死。至少在我板子上是这样的。can_control是我的net_device结构体变量。 netif_rx(skb); } 注意:当调用skb_copy_expand或者修改了skb的数据域后,一定要更新udph->len和ipv6h->payload_...
pkt_type = PACKET_BROADCAST; else skb->pkt_type = PACKET_MULTICAST; } else if (unlikely(!ether_addr_equal_64bits(eth->h_dest,dev->dev_addr))) skb->pkt_type = PACKET_OTHERHOST; //如果以太网协议大于ETH_P_802_3_MIN,则返回以太网协议即可 ...
skb->pkt_type =PACKET_OTHERHOST; } }/** Some variants of DSA tagging don't have an ethertype field * at all, so we check here whether one of those tagging * variants has been configured on the receiving interface, * and if so, set skb->protocol without looking at the packet. ...
//注意:在此网桥模块里初始化 skb->pkt_type 为 PACKET_HOST、PACKET_OTHERHOST skb =handle_bridge(skb, &pt_prev, &ret, orig_dev); if (!skb) goto out; //第三步:编译内核时选上MAC_VLAN模块,下面才会执行 //调用 macvlan_handle_frame_hook(skb), 在动态模块linux_2_6_24/drivers/net/macvlan...
hci_skb_pkt_type(skb) = HCI_VENDOR_PKT; skb_put_u8(skb,0xff); skb_put_u8(skb, opcode); put_unaligned_le16(hdev->id, skb_put(skb,2)); skb_queue_tail(&data->readq, skb); wake_up_interruptible(&data->read_wait);return0; ...
skb->pkt_type = PACKET_HOST; //表明是发往本机的包 skb->dev = &can_control; //此处很重要,如果没有这条语句,则内核跑死。至少在我板子上是这样的。can_control是我的net_device结构体变量。 netif_rx(skb); } 注意:当调用skb_copy_expand或者修改了skb的数据域后,一定要更新udph->len和ipv6h-...
首先,交换IP地址,并且sk_buff数据结构中描述数据包类型的域(pkt_type)应当被换成PACKET_OUTGOING,这些宏在linux/if_packet.h中定义。接下来应当小心的是确定包含了任意的链路层头。我们接收到的数据包的sk_buff数据结构的数据域指向链路层头之后,并且它是指向被发送的数据包的数据的开始的数据域。那么对于需要链路...