??????bug?????????
???????????? ???????[ 2012/6/7 13:16:27 ] ????????
????????
??????????????????????Щlinux?汾???libpcap(unix/linux????????????????)?з??????????????bug??
??????????????????
?????λ???????????棬???Щ?????Debian Lenny???????????????????????μ???????????????????????????????????????κ???????????????????????????????????????????????????????????顣
????????????????????ping????????????????????????????tcpdump???(sniff ?????????????????????)??????????ICMP????
% sudo tcpdump -i bond0 dst 172.16.209.136 and proto 1
12:57:26.275660 IP 172.16.209.1 > 172.16.209.136: ICMP echo request?? id 62831?? seq 54?? length 64
12:57:27.275731 IP 172.16.209.1 > 172.16.209.136: ICMP echo request?? id 62831?? seq 55?? length 64
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel
???????????????????????????eth0???eth0??????????????????
% sudo tcpdump -i eth0 dst 172.16.209.136 and proto 1
^C
0 packets captured
2 packets received by filter
0 packets dropped by kernel
?????????bond0????????????ICMP????????eth0????????????????κ???????????????????????????????????????????????????м???????!
????????????????
?????豸????
????????????????????????????????Э??????豸????????pcap????????????????????????豸????????????豸?????netif_receive_skb????????????粶???????????
??????λ??net/core/dev.c????е?netif_receive_skb????(????????????????????)??
int netif_receive_skb(struct sk_buff *skb)
{
/* ... */
orig_dev = skb_bond(skb);
if (!orig_dev)
return NET_RX_DROP;
/* ... */
????skb_bond???????ж?skb???????bond???????????????????skb????bond??????????豸??????????????????Э??????bond??????????÷??????skb???????Щ??飬skb??dev???????????bond???豸?????netif_receive_skb??????????豸???
????????????????????????????????????α????
???????????
orig_dev = NULL
skb->dev = "eth0"
orig_dev = skb->dev
if skb->dev ??bond????????
if skb->dev ??bond??????豸
skb->dev = bond
????????????
orig_dev = "eth0"
skb->dev = bond
?????????????skb???????????????bond?е??豸???????????豸??
??????????????????netif_receive_skb?????????????????skb?????pcap?????
list_for_each_entry_rcu(ptype?? &ptype_all?? list) {
if (!ptype->dev || ptype->dev == skb->dev) {
if (pt_prev)
ret = deliver_skb(skb?? pt_prev?? orig_dev);
pt_prev = ptype;
}
}
??????δ????洢??????pcap?????????б?ptype_all???б????? ?ж?pcap??????豸????????skb?????豸??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11