Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Vijay Tandeker <vijayt@india.tejasnetworks.com>
To: netfilter@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org
Subject: Locally transmitted Multicast packets are being looped back, even if IP_MULTICAST_LOOP option is set to zero
Date: Wed, 5 Jun 2013 16:17:08 +0530	[thread overview]
Message-ID: <51AF172C.9090803@india.tejasnetworks.com> (raw)

Hi,
   I am Vijay Tandeker working in TejasNetworks Bangalore, which works 
in a telecommunication domain. I have one query regarding 
IP_MULTICAST_LOOP option.

My configuration:
Kernel version: 2.6.32
One OSPF routing protocol deamon is running in my system. It has opened 
one raw socket with
- IP_HDRINCL option set to 1
- IP_MULTICAST_LOOP option set to 0

IP fragmentation logic is implemented in my application. Means if OSPF 
tries to send any packet which exceeds MTU of the transmitting 
interface, it fragments it and gives to the kernel using sendmsg(). In 
my case, I am getting all my fragmented packets back to the application 
(which should not happen if IP_MULTICAST_LOOP option is set to zero).

Following are my observations:
1) In ip_mc_output() function inside "net/ipv4/ip_output.c" file:


/*
  *  Multicasts are looped back for other local users
  */

     if (rt->rt_flags&RTCF_MULTICAST) {
         if ((!sk || inet_sk(sk)->mc_loop)
#ifdef CONFIG_IP_MROUTE
                 /* Small optimization: do not loopback not local frames,
                    which returned after forwarding; they will be  dropped
                    by ip_mr_input in any case.
                    Note, that local frames are looped back to be delivered
                    to local recipients.

                    This check is duplicated in ip_mr_input at the moment.
                  */
&& ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
#endif
            ) {
              }

  Here sk(or skb->sk) pointer is NULL and "((rt->rt_flags&RTCF_LOCAL) || 
!(IPCB(skb)->flags&IPSKB_FORWARDED))" condition is True. Because of this 
I am getting all my fragmented packets looped back to application.



  2) On further debugging I found that:
  In nf_ct_ipv4_gather_frags() function inside 
"ipv4/netfilter/nf_defrag_ipv4.c" file
  - skb_orphan(skb); is being called, which is setting skb->sk to NULL.
  - No call to restore skb->sk back to some valid value later on.

My questions:-
  - Is this done intentionally ?
  - If No, please suggest the solution to restore skb->sk pointer.
  - If Yes, please suggest the solution to restore skb->sk pointer.

Kindly let me know in case if the problem is not clear or you need any 
more data.

  Thanks & Regards,
  Vijay



             reply	other threads:[~2013-06-05 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 10:47 Vijay Tandeker [this message]
2013-06-05 13:46 ` Locally transmitted Multicast packets are being looped back, even if IP_MULTICAST_LOOP option is set to zero Eric Dumazet
2013-06-05 14:13   ` Vijay Tandeker
2013-06-05 14:20     ` Eric Dumazet

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=51AF172C.9090803@india.tejasnetworks.com \
    --to=vijayt@india.tejasnetworks.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@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