Discussion:
libnet seems to write to the wrong interface
Chris Nelson
2004-10-22 15:46:55 UTC
Permalink
I'm trying to write a little program that acts like an IGMPv2 host, sending IGMP Reports at startup, listening for IGMP Query messages, and sending IGMP Reports in response after a random delay (unless another host beats it to the punch). If I get it working -- and can figure out where to post it -- I'll be glad to add it to the libnet samples.

I've heavily adapted icmp_echo_cq.c and added code from a pcap sample to listen for IGMP messages then use libnet to respond. I'm initializing libnet and libpcat with the same device string. However, my system has two interfaces and I'm seeing Query messages on eth1 (the device I specified) but sending Report messages out eth0 (as confirmed by Ethereal).

Can someone explain to me why libnet would send on an interface other than the device passed to libnet_init()? I'll be glad to show you my code but I don't see anyway to attach it here and 300 lines is a bit much to paste into this message.

TIA.

Chris
Aaron Turner
2004-10-22 16:40:57 UTC
Permalink
Hey Chris,

Uhm, I've never seen that before. Perhaps if you could just pick out
the relevant parts of your code??

-Aaron
Post by Chris Nelson
I'm trying to write a little program that acts like an IGMPv2 host,
sending IGMP Reports at startup, listening for IGMP Query messages,
and sending IGMP Reports in response after a random delay (unless
another host beats it to the punch). If I get it working -- and can
figure out where to post it -- I'll be glad to add it to the libnet
samples.
I've heavily adapted icmp_echo_cq.c and added code from a pcap sample
to listen for IGMP messages then use libnet to respond. I'm
initializing libnet and libpcat with the same device string. However,
my system has two interfaces and I'm seeing Query messages on eth1
(the device I specified) but sending Report messages out eth0 (as
confirmed by Ethereal).
Can someone explain to me why libnet would send on an interface other
than the device passed to libnet_init()? I'll be glad to show you my
code but I don't see anyway to attach it here and 300 lines is a bit
much to paste into this message.
TIA.
Chris
--
Aaron Turner <aturner at pobox.com|synfin.net> http://synfin.net/
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety. -- Benjamin Franklin
All emails are PGP signed; a lack of a signature indicates a forgery.
Frédéric Raynal
2004-10-22 16:45:36 UTC
Permalink
Post by Chris Nelson
I'm trying to write a little program that acts like an IGMPv2 host,
sending IGMP Reports at startup, listening for IGMP Query messages,
and sending IGMP Reports in response after a random delay (unless
another host beats it to the punch). If I get it working -- and can
figure out where to post it -- I'll be glad to add it to the libnet
samples.
I've heavily adapted icmp_echo_cq.c and added code from a pcap
sample to listen for IGMP messages then use libnet to respond. I'm
initializing libnet and libpcat with the same device string.
However, my system has two interfaces and I'm seeing Query messages
on eth1 (the device I specified) but sending Report messages out
eth0 (as confirmed by Ethereal).
Can someone explain to me why libnet would send on an interface
other than the device passed to libnet_init()? I'll be glad to show
you my code but I don't see anyway to attach it here and 300 lines
is a bit much to paste into this message.
First, you shouldn't use the context_queue unless you really need it.
It is deprecated in the next release.

Second, what kind of interface are you using: raw or link?
If you are using the raw API, routing is done by your kernel, and for
whatever reason, it can select the bad device. If you are using hte
link API, that is not normal ... and is probably a bug. Can you send
me your code ?

Fred Raynal

Loading...