1__be16 eth_type_trans(structsk_buff *skb,structnet_device *dev)2{3structethhdr *eth;45skb->dev =dev;6eth =eth_hdr(skb);78if(netdev_uses_dsa_tags(dev))9returnhtons(ETH_P_DSA);1011if(netdev_uses_trailer_tags(dev))12returnhtons(ETH_P_TRAILER);1314if( ntohs(eth->h_proto) >=...
arp_rt->arp.oper = htons(2); // ARP响应 str2mac(arp_rt->arp.smac, mac);//arp报文填入源mac arp_rt->arp.sip = arp->arp.dip; // arp报文填入发送端 ip memcpy(arp_rt->arp.dmac, arp->arp.smac, ETH_ADDR_LENGTH);//arp报文填入目的 mac arp_rt->arp.dip = arp->arp.sip; // ...
__be16eth_type_trans(structsk_buff*skb,structnet_device*dev){structethhdr*eth;skb->dev=dev;eth=eth_hdr(skb);if(netdev_uses_dsa_tags(dev))returnhtons(ETH_P_DSA);if(netdev_uses_trailer_tags(dev))returnhtons(ETH_P_TRAILER);if(ntohs(eth->h_proto)>=1536)returneth->h_proto;} 1. 2...
struct tcphdr *th; struct udphdr *uh; struct icmphdr *icmph; struct igmphdr *igmph; struct iphdr *ipiph; struct spxhdr *spxh; unsigned char *raw; } h; union { struct iphdr *iph; struct ipv6hdr *ipv6h; struct arphdr *arph; struct ipxhdr *ipxh; unsigned char *raw; } nh...
structarphdr*arph; unsigned char *raw; } nh;@nh: Network layer header网络层头标(ip,ipv6,arp,ipx,raw) union { structethhdr*ethernet; unsigned char *raw; }mac;@mac: Link layer header链路层头标 structdst_entry*dst;@dst: FIXME: Describe this field目的地 structsec_path*sp;every layer....
pppoe_hdr { ifdef CFG_LITTLEENDIAN u_int8_t ver :4; u_int8_t type : 4; # u_int8_t type: 4; u_int8_t ver 4; # u_int8_t code u_int16_t sid; _int16_ length; structpppoe_tag tag; }; #endif typedefstruct _mac_t { u_int_ mact_octet6]; } ...
loeitfrheottefiempsflfroieicswi(teτindnavceegyc)T.afTiyoOarlbi2pflNeerti Fi3smtsiisneanteihsdTe1HisO.4u:T52m NinOmsF2aasNrnaydnFodstfhdHteehi:preTiccmiOotser2ratNhessuaFptrseot.dhnFedfoaihrnsyttgdhdraeeomcpgarpeyinlsittatiiutmnededeeTs(pτiraO1or)e-2, 54.4% and ...
static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) { return (struct ethhdr *)skb_mac_header(skb); } //MAC地址的输出格式。 "%02x"所表示的意思是:以16进制的形式输出,每一个16进制字符占一个字节 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" ...
1enum{2NFPROTO_UNSPEC =0,3NFPROTO_IPV4 =2,4NFPROTO_ARP =3,5NFPROTO_BRIDGE =7,6NFPROTO_IPV6 =10,7NFPROTO_DECNET =12,8NFPROTO_NUMPROTO,9}; //能在协议/地址簇相关(#include <linux/socket.h>)找到对应值 5、NF_MAX_HOOKS表示勾子应用的位置,可选值在每个协议模块内部定义,这些值代表了勾...