All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] net,man - IP_NODEFRAG option for IPv4 socket
@ 2010-06-15 11:07 Jiri Olsa
       [not found] ` <1276600052-16499-1-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jiri Olsa @ 2010-06-15 11:07 UTC (permalink / raw)
  To: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	jengelh-nopoi9nDyk+ELgA04lAiVw, kaber-dcUjhNyLwpNeoWH0uzbU5w
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	linux-man-u79uwXL29TY76Z2rM5mHXA

hi,

this series contains patch for IP_NODEFRAG option for RAW sockets,
and changes for man pages.

I'm sending this together, hope it's ok.

1/2 - net - IP_NODEFRAG option for IPv4 socket
2/2 - man - IP_NODEFRAG option for IPv4 socket

wbr,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/2] net - IP_NODEFRAG option for IPv4 socket
       [not found] ` <1276600052-16499-1-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-06-15 11:07   ` Jiri Olsa
  2010-06-23 19:31     ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2010-06-15 11:07 UTC (permalink / raw)
  To: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	jengelh-nopoi9nDyk+ELgA04lAiVw, kaber-dcUjhNyLwpNeoWH0uzbU5w
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	linux-man-u79uwXL29TY76Z2rM5mHXA, Jiri Olsa

hi,

this patch is implementing IP_NODEFRAG option for IPv4 socket.
The reason is, there's no other way to send out the packet with user
customized header of the reassembly part.

wbr,
jirka

Signed-off-by: Jiri Olsa <jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 include/linux/in.h                  |    1 +
 include/net/inet_sock.h             |    3 ++-
 net/ipv4/af_inet.c                  |    2 ++
 net/ipv4/ip_sockglue.c              |    9 ++++++++-
 net/ipv4/netfilter/nf_defrag_ipv4.c |    5 +++++
 5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/linux/in.h b/include/linux/in.h
index 583c76f..41d88a4 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -85,6 +85,7 @@ struct in_addr {
 #define IP_RECVORIGDSTADDR   IP_ORIGDSTADDR
 
 #define IP_MINTTL       21
+#define IP_NODEFRAG     22
 
 /* IP_MTU_DISCOVER values */
 #define IP_PMTUDISC_DONT		0	/* Never send DF frames */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1653de5..1989cfd 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -137,7 +137,8 @@ struct inet_sock {
 				hdrincl:1,
 				mc_loop:1,
 				transparent:1,
-				mc_all:1;
+				mc_all:1,
+				nodefrag:1;
 	int			mc_index;
 	__be32			mc_addr;
 	struct ip_mc_socklist	*mc_list;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 551ce56..84d2c8e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -355,6 +355,8 @@ lookup_protocol:
 	inet = inet_sk(sk);
 	inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;
 
+	inet->nodefrag = 0;
+
 	if (SOCK_RAW == sock->type) {
 		inet->inet_num = protocol;
 		if (IPPROTO_RAW == protocol)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index ce23178..d8196e1 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -449,7 +449,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
 			     (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) |
 			     (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
 			     (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) |
-			     (1<<IP_MINTTL))) ||
+			     (1<<IP_MINTTL) | (1<<IP_NODEFRAG))) ||
 	    optname == IP_MULTICAST_TTL ||
 	    optname == IP_MULTICAST_ALL ||
 	    optname == IP_MULTICAST_LOOP ||
@@ -572,6 +572,13 @@ static int do_ip_setsockopt(struct sock *sk, int level,
 		}
 		inet->hdrincl = val ? 1 : 0;
 		break;
+	case IP_NODEFRAG:
+		if (sk->sk_type != SOCK_RAW) {
+			err = -ENOPROTOOPT;
+			break;
+		}
+		inet->nodefrag = val ? 1 : 0;
+		break;
 	case IP_MTU_DISCOVER:
 		if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
 			goto e_inval;
diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c
index cb763ae..eab8de3 100644
--- a/net/ipv4/netfilter/nf_defrag_ipv4.c
+++ b/net/ipv4/netfilter/nf_defrag_ipv4.c
@@ -66,6 +66,11 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
 					  const struct net_device *out,
 					  int (*okfn)(struct sk_buff *))
 {
+	struct inet_sock *inet = inet_sk(skb->sk);
+
+	if (inet && inet->nodefrag)
+		return NF_ACCEPT;
+
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
 #if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE)
 	/* Previously seen (loopback)?  Ignore.  Do this before
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2] man - IP_NODEFRAG option for IPv4 socket
  2010-06-15 11:07 [PATCH 0/2] net,man - IP_NODEFRAG option for IPv4 socket Jiri Olsa
       [not found] ` <1276600052-16499-1-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-06-15 11:07 ` Jiri Olsa
  2010-06-26 13:01   ` Michael Kerrisk
  2010-06-19 23:32 ` [PATCH 0/2] net,man " Jiri Olsa
  2 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2010-06-15 11:07 UTC (permalink / raw)
  To: eric.dumazet, jengelh, kaber
  Cc: netdev, netfilter-devel, linux-man, Jiri Olsa

hi,

this patch adds description for IP_NODEFRAG option for IPv4 socket.

wbr,
jirka


Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 man7/ip.7 |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/man7/ip.7 b/man7/ip.7
index 34f7e80..12c0d5b 100644
--- a/man7/ip.7
+++ b/man7/ip.7
@@ -705,6 +705,12 @@ socket option (see
 .BR IP_TTL " (since Linux 1.0)"
 Set or retrieve the current time-to-live field that is used in every packet
 sent from this socket.
+.TP
+.BR IP_NODEFRAG " (since Linux 2.6)"
+If enabled, the reassembly of outgoing packets is disabled in the netfilter layer.
+Only valid for
+.B SOCK_RAW
+sockets.
 .\" FIXME Document IP_XFRM_POLICY
 .\" Since Linux 2.5.48
 .\" Needs CAP_NET_ADMIN

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

* Re: [PATCH 0/2] net,man - IP_NODEFRAG option for IPv4 socket
  2010-06-15 11:07 [PATCH 0/2] net,man - IP_NODEFRAG option for IPv4 socket Jiri Olsa
       [not found] ` <1276600052-16499-1-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2010-06-15 11:07 ` [PATCH 2/2] man " Jiri Olsa
@ 2010-06-19 23:32 ` Jiri Olsa
  2010-06-22  6:21   ` Patrick McHardy
  2 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2010-06-19 23:32 UTC (permalink / raw)
  To: eric.dumazet, jengelh, kaber; +Cc: netdev, netfilter-devel, linux-man

hi,
any feedback?

thanks,
jirka

On Tue, Jun 15, 2010 at 01:07:30PM +0200, Jiri Olsa wrote:
> hi,
> 
> this series contains patch for IP_NODEFRAG option for RAW sockets,
> and changes for man pages.
> 
> I'm sending this together, hope it's ok.
> 
> 1/2 - net - IP_NODEFRAG option for IPv4 socket
> 2/2 - man - IP_NODEFRAG option for IPv4 socket
> 
> wbr,
> jirka
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/2] net,man - IP_NODEFRAG option for IPv4 socket
  2010-06-19 23:32 ` [PATCH 0/2] net,man " Jiri Olsa
@ 2010-06-22  6:21   ` Patrick McHardy
  0 siblings, 0 replies; 10+ messages in thread
From: Patrick McHardy @ 2010-06-22  6:21 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: eric.dumazet, jengelh, netdev, netfilter-devel, linux-man

Jiri Olsa wrote:
> hi,
> any feedback?
>   

Your patch seems fine to me.

Acked-by: Patrick McHardy <kaber@trash.net>

> thanks,
> jirka
>
> On Tue, Jun 15, 2010 at 01:07:30PM +0200, Jiri Olsa wrote:
>   
>> hi,
>>
>> this series contains patch for IP_NODEFRAG option for RAW sockets,
>> and changes for man pages.
>>
>> I'm sending this together, hope it's ok.
>>
>> 1/2 - net - IP_NODEFRAG option for IPv4 socket
>> 2/2 - man - IP_NODEFRAG option for IPv4 socket
>>     


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

* Re: [PATCH 1/2] net - IP_NODEFRAG option for IPv4 socket
  2010-06-15 11:07   ` [PATCH 1/2] net " Jiri Olsa
@ 2010-06-23 19:31     ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2010-06-23 19:31 UTC (permalink / raw)
  To: jolsa; +Cc: eric.dumazet, jengelh, kaber, netdev, netfilter-devel, linux-man

From: Jiri Olsa <jolsa@redhat.com>
Date: Tue, 15 Jun 2010 13:07:31 +0200

> this patch is implementing IP_NODEFRAG option for IPv4 socket.
> The reason is, there's no other way to send out the packet with user
> customized header of the reassembly part.
> 
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>

Applied to net-next-2.6, thanks!

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

* Re: [PATCH 2/2] man - IP_NODEFRAG option for IPv4 socket
  2010-06-15 11:07 ` [PATCH 2/2] man " Jiri Olsa
@ 2010-06-26 13:01   ` Michael Kerrisk
       [not found]     ` <AANLkTim4N5rc8Sn_uo5bXsb9vjvKd3GTQD3p-1uApbB8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Kerrisk @ 2010-06-26 13:01 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: eric.dumazet, jengelh, kaber, netdev, netfilter-devel, linux-man

Hi Jiri,

Thanks for this patch. See below.

On Tue, Jun 15, 2010 at 1:07 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> hi,
>
> this patch adds description for IP_NODEFRAG option for IPv4 socket.
>
> wbr,
> jirka
>
>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
>  man7/ip.7 |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/man7/ip.7 b/man7/ip.7
> index 34f7e80..12c0d5b 100644
> --- a/man7/ip.7
> +++ b/man7/ip.7
> @@ -705,6 +705,12 @@ socket option (see
>  .BR IP_TTL " (since Linux 1.0)"
>  Set or retrieve the current time-to-live field that is used in every packet
>  sent from this socket.
> +.TP
> +.BR IP_NODEFRAG " (since Linux 2.6)"

here, we'd write the exact version in which the flag is added. It
looks like that might be 2.36, right?

Otherwise, this patch looks fine.

Cheers,

Michael



> +If enabled, the reassembly of outgoing packets is disabled in the netfilter layer.
> +Only valid for
> +.B SOCK_RAW
> +sockets.
>  .\" FIXME Document IP_XFRM_POLICY
>  .\" Since Linux 2.5.48
>  .\" Needs CAP_NET_ADMIN
> --
> To unsubscribe from this list: send the line "unsubscribe linux-man" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface" http://blog.man7.org/
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] man - IP_NODEFRAG option for IPv4 socket
       [not found]     ` <AANLkTim4N5rc8Sn_uo5bXsb9vjvKd3GTQD3p-1uApbB8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-06-26 16:58       ` David Miller
  2010-06-26 19:13         ` [PATCH 2/2 v2] " Jiri Olsa
  0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2010-06-26 16:58 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: jolsa-H+wXaHxf7aLQT0dZR+AlfA,
	eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	jengelh-nopoi9nDyk+ELgA04lAiVw, kaber-dcUjhNyLwpNeoWH0uzbU5w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	linux-man-u79uwXL29TY76Z2rM5mHXA

From: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Sat, 26 Jun 2010 15:01:03 +0200

>>  sent from this socket.
>> +.TP
>> +.BR IP_NODEFRAG " (since Linux 2.6)"
> 
> here, we'd write the exact version in which the flag is added. It
> looks like that might be 2.36, right?

It'll show up in 2.6.36

I doubt I'll be alive when we make it to 2.36 :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2 v2] man - IP_NODEFRAG option for IPv4 socket
  2010-06-26 16:58       ` David Miller
@ 2010-06-26 19:13         ` Jiri Olsa
       [not found]           ` <20100626191315.GA2076-Wm2NNL2RFAC1BuvyT83C0lrZeV2/+9ztveTR/H6W3zQlvuHqEAARLw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2010-06-26 19:13 UTC (permalink / raw)
  To: David Miller
  Cc: mtk.manpages, eric.dumazet, jengelh, kaber, netdev,
	netfilter-devel, linux-man

On Sat, Jun 26, 2010 at 09:58:57AM -0700, David Miller wrote:
> From: Michael Kerrisk <mtk.manpages@gmail.com>
> Date: Sat, 26 Jun 2010 15:01:03 +0200
> 
> >>  sent from this socket.
> >> +.TP
> >> +.BR IP_NODEFRAG " (since Linux 2.6)"
> > 
> > here, we'd write the exact version in which the flag is added. It
> > looks like that might be 2.36, right?
> 
> It'll show up in 2.6.36
> 
> I doubt I'll be alive when we make it to 2.36 :-)

:) ok, attaching changed patch

thanks,
jirka

---
hi,

this patch adds description for IP_NODEFRAG option for IPv4 socket.

wbr,
jirka


Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 man7/ip.7 |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/man7/ip.7 b/man7/ip.7
index 34f7e80..12c0d5b 100644
--- a/man7/ip.7
+++ b/man7/ip.7
@@ -705,6 +705,12 @@ socket option (see
 .BR IP_TTL " (since Linux 1.0)"
 Set or retrieve the current time-to-live field that is used in every packet
 sent from this socket.
+.TP
+.BR IP_NODEFRAG " (since Linux 2.6.36)"
+If enabled, the reassembly of outgoing packets is disabled in the netfilter layer.
+Only valid for
+.B SOCK_RAW
+sockets.
 .\" FIXME Document IP_XFRM_POLICY
 .\" Since Linux 2.5.48
 .\" Needs CAP_NET_ADMIN

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

* Re: [PATCH 2/2 v2] man - IP_NODEFRAG option for IPv4 socket
       [not found]           ` <20100626191315.GA2076-Wm2NNL2RFAC1BuvyT83C0lrZeV2/+9ztveTR/H6W3zQlvuHqEAARLw@public.gmane.org>
@ 2010-09-11  5:36             ` Michael Kerrisk
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Kerrisk @ 2010-09-11  5:36 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: David Miller, eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	jengelh-nopoi9nDyk+ELgA04lAiVw, kaber-dcUjhNyLwpNeoWH0uzbU5w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Jiri

On Sat, Jun 26, 2010 at 9:13 PM, Jiri Olsa <jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On Sat, Jun 26, 2010 at 09:58:57AM -0700, David Miller wrote:
>> From: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Date: Sat, 26 Jun 2010 15:01:03 +0200
>>
>> >>  sent from this socket.
>> >> +.TP
>> >> +.BR IP_NODEFRAG " (since Linux 2.6)"
>> >
>> > here, we'd write the exact version in which the flag is added. It
>> > looks like that might be 2.36, right?
>>
>> It'll show up in 2.6.36
>>
>> I doubt I'll be alive when we make it to 2.36 :-)
>
> :) ok, attaching changed patch

I tweaked that slightly, and applied the below for man-pages-3.27.

Thanks,

Michael

--- a/man7/ip.7
+++ b/man7/ip.7
@@ -399,6 +399,14 @@ The default is 1 which means that multicast
packets don't leave the local
 network unless the user program explicitly requests it.
 Argument is an integer.
 .TP
+.BR IP_NODEFRAG " (since Linux 2.6.36)"
+If enabled (argument is nonzero),
+the reassembly of outgoing packets is disabled in the netfilter layer.
+This option is only valid for
+.B SOCK_RAW
+sockets.
+The argument is an integer.
+.TP
 .BR IP_OPTIONS " (since Linux 2.0)"
 .\" Precisely: 1.3.30
 Set or get the IP options to be sent with every packet from this socket.
-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-09-11  5:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-15 11:07 [PATCH 0/2] net,man - IP_NODEFRAG option for IPv4 socket Jiri Olsa
     [not found] ` <1276600052-16499-1-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-15 11:07   ` [PATCH 1/2] net " Jiri Olsa
2010-06-23 19:31     ` David Miller
2010-06-15 11:07 ` [PATCH 2/2] man " Jiri Olsa
2010-06-26 13:01   ` Michael Kerrisk
     [not found]     ` <AANLkTim4N5rc8Sn_uo5bXsb9vjvKd3GTQD3p-1uApbB8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-26 16:58       ` David Miller
2010-06-26 19:13         ` [PATCH 2/2 v2] " Jiri Olsa
     [not found]           ` <20100626191315.GA2076-Wm2NNL2RFAC1BuvyT83C0lrZeV2/+9ztveTR/H6W3zQlvuHqEAARLw@public.gmane.org>
2010-09-11  5:36             ` Michael Kerrisk
2010-06-19 23:32 ` [PATCH 0/2] net,man " Jiri Olsa
2010-06-22  6:21   ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.