lkml.org 
[lkml]   [2011]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectQoS:tcphdr:using tcp_hdr() unabled network
From
Hi,

trying to modify source file net/sched/sch_generic.c in Linux Kernel
2.6.37.6, added code:
+ #include <linux/tcp.h>
+ #include <net/tcp.h>
static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc){
+ struct tcphdr *th = tcp_hdr(skb);
+ __be16 dport = th->dest;
}
I just want to get destination port of the transport header in the
socket buffer.
After recompiled the kernel and reboot, the network is unable to startup.

But when i exchange the code:
- #include <linux/tcp.h>
- #include <net/tcp.h>
static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc){
- struct tcphdr *th = tcp_hdr(skb);
- __be16 dport = th->dest;
+ __be16 dport = *(__be16 *)((unsigned char*)(skb->transport_header + 2));
}
after recompile, the network is up.

Where did i make mistake when using the function tcp_hdr()?

Thanks,
--
Gavin Ding


\
 
 \ /
  Last update: 2011-08-24 14:03    [W:2.185 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site