diff options
-rw-r--r-- | include/linux/in.h | 1 | ||||
-rw-r--r-- | include/net/inet_sock.h | 3 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 9 | ||||
-rw-r--r-- | 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 583c76f9c30f..41d88a4689af 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -85,6 +85,7 @@ struct in_addr { | |||
85 | #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR | 85 | #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR |
86 | 86 | ||
87 | #define IP_MINTTL 21 | 87 | #define IP_MINTTL 21 |
88 | #define IP_NODEFRAG 22 | ||
88 | 89 | ||
89 | /* IP_MTU_DISCOVER values */ | 90 | /* IP_MTU_DISCOVER values */ |
90 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ | 91 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 1653de515cee..1989cfd7405f 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -137,7 +137,8 @@ struct inet_sock { | |||
137 | hdrincl:1, | 137 | hdrincl:1, |
138 | mc_loop:1, | 138 | mc_loop:1, |
139 | transparent:1, | 139 | transparent:1, |
140 | mc_all:1; | 140 | mc_all:1, |
141 | nodefrag:1; | ||
141 | int mc_index; | 142 | int mc_index; |
142 | __be32 mc_addr; | 143 | __be32 mc_addr; |
143 | struct ip_mc_socklist *mc_list; | 144 | struct ip_mc_socklist *mc_list; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index d99e7e020189..b4c0969137cb 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -355,6 +355,8 @@ lookup_protocol: | |||
355 | inet = inet_sk(sk); | 355 | inet = inet_sk(sk); |
356 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; | 356 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; |
357 | 357 | ||
358 | inet->nodefrag = 0; | ||
359 | |||
358 | if (SOCK_RAW == sock->type) { | 360 | if (SOCK_RAW == sock->type) { |
359 | inet->inet_num = protocol; | 361 | inet->inet_num = protocol; |
360 | if (IPPROTO_RAW == protocol) | 362 | if (IPPROTO_RAW == protocol) |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 47fff528ff39..6c40a8c46e79 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -465,7 +465,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
465 | (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) | | 465 | (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) | |
466 | (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | | 466 | (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | |
467 | (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) | | 467 | (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) | |
468 | (1<<IP_MINTTL))) || | 468 | (1<<IP_MINTTL) | (1<<IP_NODEFRAG))) || |
469 | optname == IP_MULTICAST_TTL || | 469 | optname == IP_MULTICAST_TTL || |
470 | optname == IP_MULTICAST_ALL || | 470 | optname == IP_MULTICAST_ALL || |
471 | optname == IP_MULTICAST_LOOP || | 471 | optname == IP_MULTICAST_LOOP || |
@@ -588,6 +588,13 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
588 | } | 588 | } |
589 | inet->hdrincl = val ? 1 : 0; | 589 | inet->hdrincl = val ? 1 : 0; |
590 | break; | 590 | break; |
591 | case IP_NODEFRAG: | ||
592 | if (sk->sk_type != SOCK_RAW) { | ||
593 | err = -ENOPROTOOPT; | ||
594 | break; | ||
595 | } | ||
596 | inet->nodefrag = val ? 1 : 0; | ||
597 | break; | ||
591 | case IP_MTU_DISCOVER: | 598 | case IP_MTU_DISCOVER: |
592 | if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE) | 599 | if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE) |
593 | goto e_inval; | 600 | goto e_inval; |
diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c index cb763ae9ed90..eab8de32f200 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, | |||
66 | const struct net_device *out, | 66 | const struct net_device *out, |
67 | int (*okfn)(struct sk_buff *)) | 67 | int (*okfn)(struct sk_buff *)) |
68 | { | 68 | { |
69 | struct inet_sock *inet = inet_sk(skb->sk); | ||
70 | |||
71 | if (inet && inet->nodefrag) | ||
72 | return NF_ACCEPT; | ||
73 | |||
69 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 74 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
70 | #if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE) | 75 | #if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE) |
71 | /* Previously seen (loopback)? Ignore. Do this before | 76 | /* Previously seen (loopback)? Ignore. Do this before |