LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   group the outgoing skb's into single skb and then send grouped skb. (https://www.linuxquestions.org/questions/linux-networking-3/group-the-outgoing-skbs-into-single-skb-and-then-send-grouped-skb-439240/)

venkatesh111 04-27-2006 01:05 AM

group the outgoing skb's into single skb and then send grouped skb.
 
hi, every one

My task : im trying to group the outgoing skb's into single skb and then send grouped skb.

To achive grouping, i have written grouping code inside ip_output.c(/usr/src/linux-2.4.20-8/net/ipv4/ip_output.c) im calling this function in ip_finish_output2()

ie inside if (hh) condition

if (hh) {
read_lock_bh(&hh->hh_lock);

memcpy(skb->data - 16, hh->hh_data, 16);
read_unlock_bh(&hh->hh_lock);
//skb_push(skb, hh->hh_len);
grouping(skb); /*********** This is where im calling my function*****/
/********i have defined it before ip_finish_output2()***/
} else if (dst->neighbour)
return dst->neighbour->output(skb);

/* remaining ip_finish_output2() code continues here......*/

i have provide the actuall diff code of original ip_output() and my ip_output() at the end.

i put my ip_output.c in /usr/src/linux2.4.20-8/net/ipv4 then recompiled my kernel using fallowing commands:
1) make
2) make modules
3) make modules_install
4) make install

kernel compilation was successful!!!!!!!!!!!!!!!!

then i tried to boot my new kernel ie my custom kernel there was some error page while starting ip_tables but it continued..

finally,

actual PROBLEM what im facing is:

login screen appeares

i enterd as root

then i enterd my password

then 2 to three icons showed up indicating start up of my kernel but suddenly a window popedup saying GNOME could not start some of theams sounds could not b started..........
and many more msgs and it needs to b closed so i closed it and had to restart my previous kernel

i hope my problem statement is clear......


the diff code:

[root@localhost root]# diff -cbp ip_output.c.original ip_output.c
*** ip_output.c.original 2002-11-29 05:23:15.000000000 +0530
--- ip_output.c 2006-04-27 01:29:52.000000000 +0530
*************** int ip_build_and_send_pkt(struct sk_buff
*** 157,167 ****
output_maybe_reroute);
}

static inline int ip_finish_output2(struct sk_buff *skb)
{
struct dst_entry *dst = skb->dst;
struct hh_cache *hh = dst->hh;
!
#ifdef CONFIG_NETFILTER_DEBUG
nf_debug_ip_finish_output2(skb);
#endif /*CONFIG_NETFILTER_DEBUG*/
--- 157,202 ----
output_maybe_reroute);
}

+ static inline int grouping(struct sk_buff *skb)
+ {
+ struct sk_buff *skb_tmp=NULL;
+ static int i=1;
+ char *c;
+ struct dst_entry *dst = skb->dst;
+ struct hh_cache *hh = dst->hh;
+
+ if(i==1)
+ {
+ skb_tmp=skb;
+ i++;
+ printk("\n\n FIRST PACKET........");
+ return 0;
+ }else if(i==5)
+ {
+ read_lock_bh(&hh->hh_lock);
+ printk("\n\n FIFTH PACKET, LOCKED........");
+ memcpy(skb_tmp->data - 16, skb->data, 16);
+ read_unlock_bh(&hh->hh_lock);
+ printk("\n\n FIFTH PACKET, UNLOCKED........");
+ skb_push(skb_tmp, hh->hh_len);
+ return hh->hh_output(skb_tmp);
+ }
+ else {
+ printk("\n\n THIS IS PACKET NUMBER: %d",i);
+ c=skb_put(skb_tmp, skb->nh.iph->tot_len);
+ memcpy(c, skb, skb->nh.iph->tot_len);
+ printk("\n\n COPIED TO sbk_tmp........");
+ i++;
+ kfree_skb(skb);
+ return 0;
+ }
+
+ }
static inline int ip_finish_output2(struct sk_buff *skb)
{
struct dst_entry *dst = skb->dst;
struct hh_cache *hh = dst->hh;
! int i=0;
#ifdef CONFIG_NETFILTER_DEBUG
nf_debug_ip_finish_output2(skb);
#endif /*CONFIG_NETFILTER_DEBUG*/
*************** static inline int ip_finish_output2(stru
*** 170,178 ****
read_lock_bh(&hh->hh_lock);
memcpy(skb->data - 16, hh->hh_data, 16);
read_unlock_bh(&hh->hh_lock);
! skb_push(skb, hh->hh_len);
! return hh->hh_output(skb);
! } else if (dst->neighbour)
return dst->neighbour->output(skb);

if (net_ratelimit())
--- 205,213 ----
read_lock_bh(&hh->hh_lock);
memcpy(skb->data - 16, hh->hh_data, 16);
read_unlock_bh(&hh->hh_lock);
! //skb_push(skb, hh->hh_len);
! grouping(skb);
! }else if (dst->neighbour)
return dst->neighbour->output(skb);

if (net_ratelimit())
[root@localhost root]#


messages in /var/log/messages were:


Apr 27 00:41:33 localhost kernel: ip_tables: (C) 2000-2002 Netfilter core team
Apr 27 00:41:33 localhost kernel:
Apr 27 00:41:33 localhost kernel:
Apr 27 00:41:33 localhost kernel: FIRST PACKET........<7>ip_finish_output2: No header cache and no neighbour!
Apr 27 00:41:33 localhost kernel:
Apr 27 00:41:33 localhost kernel:
Apr 27 00:41:33 localhost kernel: THIS IS PACKET NUMBER: 2<1>Unable to handle kernel NULL pointer dereference at virtual address 00000060
Apr 27 00:41:33 localhost kernel: printing eip:
Apr 27 00:41:33 localhost kernel: c02202d8
Apr 27 00:41:33 localhost kernel: *pde = 00000000
Apr 27 00:41:33 localhost kernel: Oops: 0000
Apr 27 00:41:31 localhost sysctl: kernel.core_uses_pid = 1
Apr 27 00:41:31 localhost network: Setting network parameters: succeeded
Apr 27 00:41:31 localhost network: Bringing up loopback interface: succeeded
Apr 27 00:41:33 localhost kernel: sg sr_mod ide-scsi scsi_mod ide-cd cdrom nls_iso8859-1 nls_cp437 vfat fat keybdev mousedev hid input ehci-hcd usb-ohci usbcore ext3 jbd
Apr 27 00:41:33 localhost kernel: CPU: 0
Apr 27 00:41:33 localhost kernel: EIP: 0060:[<c02202d8>] Not tainted
Apr 27 00:41:33 localhost kernel: EFLAGS: 00010282
Apr 27 00:41:33 localhost kernel:
Apr 27 00:41:33 localhost kernel: EIP is at grouping [kernel] 0x38 (2.4.20-8custom)
Apr 27 00:41:33 localhost kernel: eax: 0000001b ebx: d6eac000 ecx: 00000001 edx: c032f96c
Apr 27 00:41:33 localhost kernel: esi: c1f81340 edi: d7c195c0 ebp: d7c195c0 esp: d6eadd2c
Apr 27 00:41:33 localhost kernel: ds: 0068 es: 0068 ss: 0068
Apr 27 00:41:33 localhost kernel: Process rpc.statd (pid: 2748, stackpage=d6ead000)
Apr 27 00:41:33 localhost kernel: Stack: c028d8cd 00000002 d79247ec d6eac000 c1f81340 d7c195c0 00000000 c021feff
Apr 27 00:41:33 localhost kernel: d7c195c0 c1f81358 00000010 d6e7bec0 d7c195c0 d7c195c0 c021ea89 d7c195c0
Apr 27 00:41:33 localhost kernel: d79247e4 d6eade1c 00000008 00000038 d6eade30 d79247d4 d79247d0 c021f611
Apr 27 00:41:33 localhost kernel: Call Trace: [<c021feff>] ip_finish_output2 [kernel] 0x8b (0xd6eadd48))
Apr 27 00:41:34 localhost kernel: [<c021ea89>] ip_output [kernel] 0x65 (0xd6eadd64))
Apr 27 00:41:34 localhost kernel: [<c021f611>] ip_build_xmit [kernel] 0x28d (0xd6eadd88))
Apr 27 00:41:34 localhost kernel: [<c023c46f>] udp_sendmsg [kernel] 0x277 (0xd6eaddc0))
Apr 27 00:41:34 localhost kernel: [<c023c060>] udp_getfrag [kernel] 0x0 (0xd6eaddc8))
Apr 27 00:41:34 localhost kernel: [<c0244116>] inet_sendmsg [kernel] 0x42 (0xd6eade5c))
Apr 27 00:41:34 localhost kernel: [<c01fbbb4>] sock_sendmsg [kernel] 0x78 (0xd6eade70))
Apr 27 00:41:34 localhost kernel: [<c01fcd3f>] sys_sendto [kernel] 0xe3 (0xd6eadeb4))
Apr 27 00:41:34 localhost kernel: [<c01fc5e8>] sock_create [kernel] 0xb0 (0xd6eadf28))
Apr 27 00:41:34 localhost kernel: [<c024301a>] inet_setsockopt [kernel] 0x36 (0xd6eadf3c))
Apr 27 00:41:34 localhost kernel: [<c01fcf54>] sys_setsockopt [kernel] 0x70 (0xd6eadf54))
Apr 27 00:41:34 localhost kernel: [<c01fd679>] sys_socketcall [kernel] 0x18d (0xd6eadf80))
Apr 27 00:41:34 localhost kernel: [<c010971b>] system_call [kernel] 0x33 (0xd6eadfc0))
Apr 27 00:41:34 localhost kernel:
Apr 27 00:41:34 localhost kernel:
Apr 27 00:41:34 localhost kernel: Code: 8b 1d 60 00 00 00 8b 4d 20 8b 3d 84 00 00 00 85 db 0f b7 51

there were other similar errors in /var/log/messages



thanks in advance

venkatesh


All times are GMT -5. The time now is 07:55 AM.