Skip to contentSkip to conversation

promiscuous mode

DISCUSSION [email protected] 3 participants 5 messages Jun 3, 2005 – Jun 6, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,
I set up my wireless card in promiscuous mode. I want to capture all unicast packets using the hook NF_IP_PRE_ROUTING but packets other then the ones destined for my machine are been dropped.
I found this link, which talks about a NF_IP_PROMISC hook This seems to be exactly what I want

https://lists.netfilter.org/pipermail/netfilter-devel/2001-November.txt

The only think is it refers to modifying netfilter/userspace/libiptc/libip4tc.c which doesn't seem to exist on the version of linux I'm running.

I'm currently using
Fedora Core 2 (2.6.5-1.358)
and iptables v1.2.9

I was wondering does the latest version of netfilter support promiscuous mode or is there a patch available out there somewhere ??

Thanks very much for your help,

Kevin

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoting [email protected] on 2005-06-03 09:09 UTC:

Quoted 1 line

Hello,

Hi :)

Quoted 3 lines

I set up my wireless card in promiscuous mode. I want to capture all unicast packets using the hook NF_IP_PRE_ROUTING but packets other then the ones destined for my machine are been dropped.

Could it be that you have rp_filter turned on?

Try doing this:

echo 0 > /proc/sys/net/ipv4/conf/eth1/rp_filter

(replace eth1 with whatever your wlan interface is)

Here's some more info (chapter 13.1):

http://www.linuxguruz.com/iptables/howto/2.4routing-13.html

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCoWsCxyF48ZTvn+4RAui4AJ4422QWePo6mfZ1AixtXjDGKAdvSQCgx2jR gbBwczPHtnuIDrePPyaq/6k=
=+Kry
-----END PGP SIGNATURE-----

#2 lore raw

Jonas,
Thanks for the info :-). I tried what you suggested by changing the
rp_filter setting but this does not appear to effect the packets I see at the NF_IP_PRE_ROUTING hook.

Does this mean that rp_filter comes into effect after the NF_IP_PRE_ROUTING hook and before the NF_IP_LOCAL_IN hook?.

I also set up a socket using the PF_PACKET protocol to make sure that my network card is in promiscuous mode. This is the case and I can see unicast packets going to and from one of my other linux boxes.

I've just started working with the linux network protocol stack so my understanding is fairly limited (and I might have got this wrong) but this is what I think is happening:

All the IP packets picked up by my network card are revceived at the ip_rcv() function (in net/ipv4/ip_input.c)

The very first thing ip_rcv does is check whether the packet is destinted for another host and if so drops it

/*
* Main IP Receive routine.
*/
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)

{
        struct iphdr *iph;

/* When the interface is in promisc. mode, drop all the crap

    * that it receives, do not try to analyse it.
    */
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop;

At the end of the ip_rcv() function the NF_IP_PRE_ROUTING hook is called

return NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, dev, NULL,
ip_rcv_finish);

By this stage the packets which I want to look at have already been dropped. So what I need is a hook which can grab these packets received in promiscuous mode before they are dropped,

Thanks,
Kevin

Quoted 35 lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoting [email protected] on 2005-06-03 09:09 UTC:

Quoted 1 line

Hello,

Hi :)

Quoted 3 lines

I set up my wireless card in promiscuous mode. I want to capture all unicast packets using the hook NF_IP_PRE_ROUTING but packets other then the ones destined for my machine are been dropped.

Could it be that you have rp_filter turned on?

Try doing this:

echo 0 > /proc/sys/net/ipv4/conf/eth1/rp_filter

(replace eth1 with whatever your wlan interface is)

Here's some more info (chapter 13.1):

http://www.linuxguruz.com/iptables/howto/2.4routing-13.html

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCoWsCxyF48ZTvn+4RAui4AJ4422QWePo6mfZ1AixtXjDGKAdvSQCgx2jR gbBwczPHtnuIDrePPyaq/6k=
=+Kry
-----END PGP SIGNATURE-----

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoting [email protected] on 2005-06-05 16:00 UTC:

Quoted 7 lines

Jonas,
Thanks for the info :-). I tried what you suggested by changing the
rp_filter setting but this does not appear to effect the packets I see at the NF_IP_PRE_ROUTING hook.

Does this mean that rp_filter comes into effect after the NF_IP_PRE_ROUTING hook and before the NF_IP_LOCAL_IN hook?.

Sorry, I really have no idea about that.. I just hoped that rp_filter would have helped :P

Hopefully somebody else can help out, you could also come to #netfilter on freenode ircnet and ask..

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCo17CxyF48ZTvn+4RAqDEAKC3pJzDh7lS46qhM1csQI9VUls6hgCg0CF1 lP0k9XEHZnmD5E+LXQII4lE=
=/Nnt
-----END PGP SIGNATURE-----

#4 lore raw
In reply to [email protected]

Hi,

2005-06-03, p keltezéssel 10.09-kor [email protected] ezt írta:

Quoted 11 lines

I set up my wireless card in promiscuous mode. I want to capture all unicast packets using the hook NF_IP_PRE_ROUTING but packets other then the ones destined for my machine are been dropped.
I found this link, which talks about a NF_IP_PROMISC hook This seems to be exactly what I want

https://lists.netfilter.org/pipermail/netfilter-devel/2001-November.txt

The only think is it refers to modifying netfilter/userspace/libiptc/libip4tc.c which doesn't seem to exist on the version of linux I'm running.

The patch is a combined one containing userspace and kernelspace
modifications as well (patches files in iptables and adds files to the old patch-o-matic). You probably won't be able to apply it easily, hand-editing files seems to be necessary.

BTW, Neither of the Netfilter hooks sees promisc packets, they are
dropped very early in the IP stack. If you take a look at that patch, you can even see the comment describing this:

+-	/* When the interface is in promisc. mode, drop all the crap
+-	 * that it receives, do not try to analyse it.
+-	 */
+-	if (skb->pkt_type == PACKET_OTHERHOST)
+-		goto drop;

Gianni's patch seems to create a new NF_IP_PROMISC hook which receives
exactly these packets.

Signature · 1 line
KOVACS Krisztian <[email protected]>