Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

path of packets through network stack

23 views
Skip to first unread message

Mark

unread,
Nov 10, 2012, 12:23:16 PM11/10/12
to
Hello

I'm trying to study and understand operations of the Linux tcp/ip stack,
specifically how 'ping' sends packets down and receives them.
Ping creates raw socket in AF_INET family, therefore I placed printk in
inet_sendmsg() at net/ipv4/af_inet.c to print out the socket protocol name
(RAW, UDP etc.) and the address of protocol specific sendmsg function which
correctly appears to be raw_sendmsg() from net/ipv4/raw.c

Now, I'm sending a single packet and observe that I'm getting printk form
inet_sendmsg() twice.This puzzles me -- is it normal (has something to do
with interrupts etc. ?) or there's something broken in the kernel?

Platform - ARM5te, kernel 2.6.31.8

Looking forward to hearing from you !

Mark


Rainer Weikusat

unread,
Nov 12, 2012, 11:32:34 AM11/12/12
to
"Mark" <mark_cruz...@hotmail.com> writes:

[...]

> I placed printk in inet_sendmsg() at net/ipv4/af_inet.c to print
> out the socket protocol name (RAW, UDP etc.) and the address of
> protocol specific sendmsg function which correctly appears to be
> raw_sendmsg() from net/ipv4/raw.c
>
> Now, I'm sending a single packet and observe that I'm getting printk form
> inet_sendmsg() twice.This puzzles me -- is it normal (has something to do
> with interrupts etc. ?) or there's something broken in the kernel?

Presumably, the phenomenon you observed is 'normal' and it is
certainly not related to 'interrupts'. Interrupts are used for
controlling/ driving devices. This happens 'below' the network
stack. sendmsg is something which happens at the top of the latter.

Tauno Voipio

unread,
Nov 12, 2012, 1:22:43 PM11/12/12
to
The first sendmsg() may be for name resolution of the target.
Try again with a numeric target address.

--

Tauno Voipio

Rick Jones

unread,
Nov 12, 2012, 8:34:37 PM11/12/12
to
Mark <mark_cruz...@hotmail.com> wrote:
> Hello

> I'm trying to study and understand operations of the Linux tcp/ip stack,

I'm not certain, but http://www.amazon.com/Linux-Programming-Interface-System-Handbook/dp/1593272200 may get into a bit of that.

rick jones
--
The glass is neither half-empty nor half-full. The glass has a leak.
The real question is "Can it be patched?"
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

Mark

unread,
Nov 13, 2012, 8:31:41 AM11/13/12
to

"Rainer Weikusat" <rwei...@mssgmbh.com> wrote in message
news:87sj8e2...@sapphire.mobileactivedefense.com...
> Presumably, the phenomenon you observed is 'normal' and it is
> certainly not related to 'interrupts'. Interrupts are used for
> controlling/ driving devices. This happens 'below' the network
> stack. sendmsg is something which happens at the top of the latter.
>

I was assuming it may haev something to do with "soft" interrupts.

Mark


Mark

unread,
Nov 13, 2012, 8:34:03 AM11/13/12
to

"Tauno Voipio" <tauno....@notused.fi.invalid> wrote in message
news:k7repj$s89$1...@dont-email.me...
>> Now, I'm sending a single packet and observe that I'm getting printk form
>> inet_sendmsg() twice.This puzzles me -- is it normal (has something to do
>> with interrupts etc. ?) or there's something broken in the kernel?
>>
>> Platform - ARM5te, kernel 2.6.31.8
>>
>> Looking forward to hearing from you !
>>
>> Mark
>
>
> The first sendmsg() may be for name resolution of the target.
> Try again with a numeric target address.

Well, to avoid any name resolution whatsoever, I'm pinging with numeric
addresses. Also I've checked ping with strace, it's calling send exactly
once (ping -c1 10.10.10.1), so it's unlikely a bug of busybox's ping.

Mark


Rainer Weikusat

unread,
Nov 13, 2012, 9:29:05 AM11/13/12
to
"Mark" <mark_cruz...@hotmail.com> writes:
> "Rainer Weikusat" <rwei...@mssgmbh.com> wrote in message
>> Presumably, the phenomenon you observed is 'normal' and it is
>> certainly not related to 'interrupts'. Interrupts are used for
>> controlling/ driving devices. This happens 'below' the network
>> stack. sendmsg is something which happens at the top of the latter.
>
> I was assuming it may haev something to do with "soft" interrupts.

This doesn't make any more sense.

Mark

unread,
Nov 14, 2012, 9:41:49 AM11/14/12
to

"Rainer Weikusat" <rwei...@mssgmbh.com> wrote in message
news:87sj8e2...@sapphire.mobileactivedefense.com...

[skip]
>> Now, I'm sending a single packet and observe that I'm getting printk form
>> inet_sendmsg() twice.This puzzles me -- is it normal (has something to do
>> with interrupts etc. ?) or there's something broken in the kernel?
>
> Presumably, the phenomenon you observed is 'normal' and it is
> certainly not related to 'interrupts'.

Could you elaborate on why you believe this phenomenon is normal ?

Mark


Rainer Weikusat

unread,
Nov 15, 2012, 11:12:58 AM11/15/12
to
"Mark" <mark_cruz...@hotmail.com> writes:
> "Rainer Weikusat" <rwei...@mssgmbh.com> wrote in message
>
> [skip]
>>> Now, I'm sending a single packet and observe that I'm getting printk form
>>> inet_sendmsg() twice.This puzzles me -- is it normal (has something to do
>>> with interrupts etc. ?) or there's something broken in the kernel?
>>
>> Presumably, the phenomenon you observed is 'normal' and it is
>> certainly not related to 'interrupts'.
>
> Could you elaborate on why you believe this phenomenon is normal ?

Considering the following possible explanations:

- you found an unknown, major kernel error in the interface
parts of the networking stack which can be triggered in an
extremely simple way

- your code doesn't really do what you think it does

- this is either coincidence or part of the 'normal'
processing but the exact reason for it is unknown

the first seems the least likely to me. This doesn't mean that I'm
necessarily right but I'm not going to investigate this phenomenon in
the kernels I'm responsible for because I'm afraid that it could be
something serious which could affect other stuff I'm also responsible
for in some negative way.

BTW: You aren't per chance doing this on a system you're acessing over
the network?
0 new messages