Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void print_debug_skb(struct sk_buff *skb){
- enum ip_conntrack_info ctinfo;
- struct nf_conn *ct;
- struct iphdr *iph;
- struct udphdr *udh;
- int sport,dport;
- unsigned int ctmark, opackets, rpackets;
- struct nf_conn_counter *acct = NULL;
- int dir = 0;
- uint8 ipver;
- ct = nf_ct_get( skb, &ctinfo );
- if( ct )
- acct = nf_conn_acct_find(ct);
- iph = ip_hdr(skb);
- if( !iph ){
- printk("IP header missing in print_debug_skb\n");
- return;
- }
- ipver = iph->version;
- if (ipver==4) //(1) //(out)
- {
- sport = dport = 0;
- if( iph->protocol == 6 || iph->protocol == 17 ){
- udh = udp_hdr(skb);
- if( udh ){
- sport = ntohs(udh->source);
- dport = ntohs(udh->dest);
- }
- }
- ctmark = opackets = rpackets = 0;
- if( ct && acct ){
- ctmark = ct->mark;
- opackets = acct[0].packets;
- rpackets = acct[1].packets;
- }
- dir = CTINFO2DIR(ctinfo);
- printk(KERN_INFO "dir=%d src=%08x dst=%08x protocol=%d sport=%d dport=%d fwmark=%d ct=%x,ctmark=%d acct[0]=%llu acct[1]=%llu\n",
- dir, htonl(iph->saddr), htonl(iph->daddr), iph->protocol, sport, dport, skb->mark, ct, ctmark, opackets, rpackets);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement