linux-kernel – 绑定驱动程序如何从奴役接口获取RX数据包
发布时间:2020-12-05 03:50:47 所属栏目:Linux 来源:互联网
导读:我有一个关于如何绑定驱动程序从受奴役的接口获取RX数据包的问题.我发现绑定使用dev_add_pack()来设置LACPDU和ARP数据包的处理程序,但我没有找到其他处理程序(对于其他数据包类型). 你能帮我解决一下这个问题吗? 绑定驱动程序注册自己的Rx处理程序,当奴隶接
|
我有一个关于如何绑定驱动程序从受奴役的接口获取RX数据包的问题.我发现绑定使用dev_add_pack()来设置LACPDU和ARP数据包的处理程序,但我没有找到其他处理程序(对于其他数据包类型). 你能帮我解决一下这个问题吗? 解决方法绑定驱动程序注册自己的Rx处理程序,当奴隶接口被奴役到债券主数据时,在bond_enslave()中你可以看到:res = netdev_rx_handler_register(slave_dev,bond_handle_frame,new_slave); 因此在bond_handle_frame()中,它会劫持从接口接收的数据包,因此绑定主机将接收数据包: static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
{
struct sk_buff *skb = *pskb;
struct slave *slave;
struct bonding *bond;
int (*recv_probe)(const struct sk_buff *,struct bonding *,struct slave *);
int ret = RX_HANDLER_ANOTHER;
skb = skb_share_check(skb,GFP_ATOMIC);
if (unlikely(!skb))
return RX_HANDLER_CONSUMED;
*pskb = skb;
slave = bond_slave_get_rcu(skb->dev);
bond = slave->bond;
if (bond->params.arp_interval)
slave->dev->last_rx = jiffies;
recv_probe = ACCESS_ONCE(bond->recv_probe);
if (recv_probe) {
ret = recv_probe(skb,bond,slave);
if (ret == RX_HANDLER_CONSUMED) {
consume_skb(skb);
return ret;
}
}
if (bond_should_deliver_exact_match(skb,slave,bond)) {
return RX_HANDLER_EXACT;
}
skb->dev = bond->dev;
if (bond->params.mode == BOND_MODE_ALB &&
bond->dev->priv_flags & IFF_BRIDGE_PORT &&
skb->pkt_type == PACKET_HOST) {
if (unlikely(skb_cow_head(skb,skb->data - skb_mac_header(skb)))) {
kfree_skb(skb);
return RX_HANDLER_CONSUMED;
}
memcpy(eth_hdr(skb)->h_dest,bond->dev->dev_addr,ETH_ALEN);
}
return ret;
} (编辑:日照站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 休息 – 是否无法使用curl来使用Google Cloud Speech API识
- qemu – “xx-softmmu”和“xx-linux-user”之间有什么区别
- linux – 从终端历史记录中搜索和替换命令
- Linux主机上的邻居表溢出与桥接和ipv6相关
- linux – 如何在eclipse中输入unicode字符?
- linux – 如何找到ubuntu框的默认网关
- linux – 要重启服务(例如httpd),我应该使用/etc/init.d ht
- linux – 用apt-get,apache2-mpm-prefork安装apache2?
- linux – 在QT应用程序中嵌入应用程序(在本例中为终端)
- linux – 如何检查iptables中每条规则的命中数?
