From: syedk <syedk@intotoinc.com>
To: linux-c-programming@vger.kernel.org
Subject: Socket listening listening on both interfaces
Date: 11 Feb 2004 17:55:30 +0530 [thread overview]
Message-ID: <1076502331.4523.38.camel@qa.intotoind.com> (raw)
Hi,
i wrote a utility to capture packets on an interface using PF_PACKET
socket(on 2.4 kernel)
int sock=socket(PF_PACKET,SOCK_RAW,htons(ETH_P_IP);
then i used ioctl to set the interface name for the socket:
struct ifreq ifinfo;
dev_name="eth1";
strncpy(ifinfo.ifr_name,dev_name,strlen(dev_name));
ioctl(sock,SIOCGIFFLAGS,&ifinfo);
But strangely i am able see packets from both eth0 and eth1 interfaces
present on my machine.Initially when i used eth0 it was ok.later when i
switched to eth1 then the socket is sniffing packets from both
interfaces.
How can the raw socket sniff packets from both eth1 and eth0 at the same
time even after i set interface name as either eth0 or eth1.
do i need to set somethings back to their original state before the
program terminates?
thanx in advance and regards
Syed SK
next reply other threads:[~2004-02-11 12:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-11 12:25 syedk [this message]
2004-02-11 18:15 ` Socket listening listening on both interfaces Glynn Clements
2004-02-12 6:33 ` syedk
2004-02-12 22:38 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1076502331.4523.38.camel@qa.intotoind.com \
--to=syedk@intotoinc.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).