From: "time" Subject: Recoed destination IP in userspace before DNAT ?? Date: Tue, 20 May 2003 23:37:27 +0800 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <001d01c31ee5$b9cba160$3702a8c0@MICROSOFT> Reply-To: "time" Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001A_01C31F28.C61E4010" Return-path: To: Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_001A_01C31F28.C61E4010 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi my dear friend, I am an engineer , and I am developing a special system need to = record the destination IP before doing DNAT, and the Application will = use the destination IP to do something in user space. I have choose the ip_queue to mangle the packet to userspace, And use = the sharememory to record all destination IP of the connections( sync ). I hvave tried to extend my netlink recieve buffer, I have tried to copy = a shorter length to userspace, I also tried to minize my userspace = application to handle the packet from kernel..... In a normal condition ( not too many connections ) , it works, and the = flow just like this ( I use printk and printf ) 1. nf_hook: Verdict =3D QUEUE. 2. enqueue! 3. going to send=20 4. status > 0=20 5. ipq receive 6. com! 7. Dequeue a packet if matched by cmp! 8. user space receive here But when I use some test tool to make a lot of connections in a short = time ( maybe 500 or 1000 connections ), I found that the flow changed. = It looks like this 1. nf_hook: Verdict =3D QUEUE. 2. enqueue! 3. going to send 4. nf_hook: Verdict =3D QUEUE. 5. enqueue! 6. going to send 7. .... 8. .... 9. .... (all the same as 1->2->3) .... n. user space receive here n+1. read(): Failed to receive netlink message: No buffer space = available the queue will not send one by one ..... and will send at one time to = make my netlink buffer full .... I have setsockoption to 655350, <- it's quite huge ! May I ask you.... Is the ip_queue working like this ? Where can I tune in the ip_queue ? Or, is there any other method to record the destination IP before DNAT = in userspace ? If I parse the /proc/net/ip_conntrack, will it make sense ? I hope someone can help me, My god, It makes me mad ! By the way, thanks you at first , when you can be patient to read this = letter. Thanks !! = = time ------=_NextPart_000_001A_01C31F28.C61E4010 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable
Hi my dear friend,
    I am an engineer , and I am = developing a=20 special system need to record the destination IP before doing DNAT, and = the=20 Application will use the destination IP to do something in user=20 space.
I have choose the ip_queue to mangle the packet to = userspace,=20 And use the sharememory to record all destination IP of the connections( = sync=20 ).
I hvave tried to extend my netlink recieve buffer, I = have=20 tried to copy a shorter length to userspace, I also tried to minize my = userspace=20 application to handle the packet from kernel.....
In a normal condition ( not too many = connections ) ,=20 it works, and the flow just like this ( I use printk and printf=20 )
 
1. nf_hook: Verdict =3D QUEUE.
2. enqueue!
3. = going to=20 send
4. status > 0
5. ipq receive
6. com!
7. Dequeue a = packet=20 if matched by cmp!
8. user space receive here
 
But when I use some test tool to make a lot of = connections in=20 a short time ( maybe 500 or 1000 connections ), I found that the flow = changed.=20 It looks like this
 
1. nf_hook: Verdict =3D QUEUE.
2. enqueue!
3. = going to=20 send
4. nf_hook: Verdict =3D QUEUE.
5. enqueue!
6. going to=20 send
7.  ....
8.  ....
9.  .... (all the same as = 1->2->3)
....
n.  user space receive = here
n+1.=20 read(): Failed to receive netlink message: No buffer space=20 available
 
the queue will not send one by one ..... and will = send at one=20 time to make my netlink buffer full ....
I have setsockoption  to  655350, = <- it's=20 quite huge !
 
May I ask you.... Is the ip_queue working = like this=20 ?
Where can I tune in the ip_queue ?
Or, is there any other method to record the = destination IP=20 before DNAT in userspace ?
 
If I parse the /proc/net/ip_conntrack, will it make = sense=20 ?
 
I hope someone can help me, My god, It makes me mad=20 !
 
By the way, thanks you at first , when you can be = patient to=20 read this letter. Thanks !!
 
        =    =20             =    =20             =    =20             =    =20             =    =20             =    =20             =    =20             =    =20             =    =20     time
 
 
------=_NextPart_000_001A_01C31F28.C61E4010--