public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* Kernel sends ICMP unreachable for GRE packets even if there is a listening socket
@ 2015-02-10 15:24 Steinar H. Gunderson
  2015-02-10 16:09 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Steinar H. Gunderson @ 2015-02-10 15:24 UTC (permalink / raw)
  To: netdev

[Resent from Bugzilla]

Hi,

I have a userspace GRE listener, which opens a raw socket (error handling removed):

        int gresock = socket(AF_INET6, SOCK_RAW, IPPROTO_GRE);
        bind(gresock, (sockaddr *)&my_addr, sizeof(my_addr));

and then select()s and recvfrom()s on it, as well as sendto().

This works great. I can send and receive GRE packets. However, Linux _also_
sends ICMPv6 unreachables when the other end sends to me. I assume this is
because I don't have a corresponding kernel GRE tunnel interface. (I don't use
the kernel GRE because I want, among others, stronger reordering functionality
and possibly error correction, which is not in any standard.)

Can this be suppressed when I have such a socket giong? ip6tables -A OUTPUT can
stop them, but it seems very hacky and kludgy.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel sends ICMP unreachable for GRE packets even if there is a listening socket
  2015-02-10 15:24 Kernel sends ICMP unreachable for GRE packets even if there is a listening socket Steinar H. Gunderson
@ 2015-02-10 16:09 ` Eric Dumazet
  2015-02-10 16:16   ` Steinar H. Gunderson
  2015-02-10 16:18   ` Eric Dumazet
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2015-02-10 16:09 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: netdev

On Tue, 2015-02-10 at 16:24 +0100, Steinar H. Gunderson wrote:
> [Resent from Bugzilla]
> 
> Hi,
> 
> I have a userspace GRE listener, which opens a raw socket (error handling removed):
> 
>         int gresock = socket(AF_INET6, SOCK_RAW, IPPROTO_GRE);
>         bind(gresock, (sockaddr *)&my_addr, sizeof(my_addr));
> 
> and then select()s and recvfrom()s on it, as well as sendto().
> 
> This works great. I can send and receive GRE packets. However, Linux _also_
> sends ICMPv6 unreachables when the other end sends to me. I assume this is
> because I don't have a corresponding kernel GRE tunnel interface. (I don't use
> the kernel GRE because I want, among others, stronger reordering functionality
> and possibly error correction, which is not in any standard.)
> 
> Can this be suppressed when I have such a socket giong? ip6tables -A OUTPUT can
> stop them, but it seems very hacky and kludgy.

Thats because you loaded ip6_gre maybe ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel sends ICMP unreachable for GRE packets even if there is a listening socket
  2015-02-10 16:09 ` Eric Dumazet
@ 2015-02-10 16:16   ` Steinar H. Gunderson
  2015-02-10 16:18   ` Eric Dumazet
  1 sibling, 0 replies; 4+ messages in thread
From: Steinar H. Gunderson @ 2015-02-10 16:16 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev

On Tue, Feb 10, 2015 at 08:09:56AM -0800, Eric Dumazet wrote:
>> Can this be suppressed when I have such a socket giong? ip6tables -A OUTPUT can
>> stop them, but it seems very hacky and kludgy.
> Thats because you loaded ip6_gre maybe ?

I have loaded ip6_gre, yes. But I might need the kernel variant for other
tunnels, so unloading it is a suboptimal workaround.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel sends ICMP unreachable for GRE packets even if there is a listening socket
  2015-02-10 16:09 ` Eric Dumazet
  2015-02-10 16:16   ` Steinar H. Gunderson
@ 2015-02-10 16:18   ` Eric Dumazet
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2015-02-10 16:18 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: netdev

On Tue, 2015-02-10 at 08:09 -0800, Eric Dumazet wrote:
> On Tue, 2015-02-10 at 16:24 +0100, Steinar H. Gunderson wrote:
> > [Resent from Bugzilla]
> > 
> > Hi,
> > 
> > I have a userspace GRE listener, which opens a raw socket (error handling removed):
> > 
> >         int gresock = socket(AF_INET6, SOCK_RAW, IPPROTO_GRE);
> >         bind(gresock, (sockaddr *)&my_addr, sizeof(my_addr));
> > 
> > and then select()s and recvfrom()s on it, as well as sendto().
> > 
> > This works great. I can send and receive GRE packets. However, Linux _also_
> > sends ICMPv6 unreachables when the other end sends to me. I assume this is
> > because I don't have a corresponding kernel GRE tunnel interface. (I don't use
> > the kernel GRE because I want, among others, stronger reordering functionality
> > and possibly error correction, which is not in any standard.)
> > 
> > Can this be suppressed when I have such a socket giong? ip6tables -A OUTPUT can
> > stop them, but it seems very hacky and kludgy.
> 
> Thats because you loaded ip6_gre maybe ?

Not clear why we even bother sending ICMP in ipv6, while we do nothing
in ipv4 similar case

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bc28b7d42a6dab05abee80d4fa84c102d92ca91f..8ff364b93bc2909253a6a0ef7268fc2dfb92c77c 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -572,7 +572,6 @@ static int ip6gre_rcv(struct sk_buff *skb)
 
 		return 0;
 	}
-	icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
 
 drop:
 	kfree_skb(skb);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-10 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 15:24 Kernel sends ICMP unreachable for GRE packets even if there is a listening socket Steinar H. Gunderson
2015-02-10 16:09 ` Eric Dumazet
2015-02-10 16:16   ` Steinar H. Gunderson
2015-02-10 16:18   ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox