diff options
Diffstat (limited to 'net/ipv4')
| -rw-r--r-- | net/ipv4/cipso_ipv4.c | 7 | ||||
| -rw-r--r-- | net/ipv4/ip_input.c | 10 | ||||
| -rw-r--r-- | net/ipv4/proc.c | 58 | ||||
| -rw-r--r-- | net/ipv4/tcp.c | 3 | ||||
| -rw-r--r-- | net/ipv4/tcp_htcp.c | 14 | ||||
| -rw-r--r-- | net/ipv4/tcp_output.c | 10 | ||||
| -rw-r--r-- | net/ipv4/udp.c | 12 | ||||
| -rw-r--r-- | net/ipv4/xfrm4_state.c | 1 |
8 files changed, 67 insertions, 48 deletions
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 490e035c6d90..2e78f6bd9775 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
| @@ -2063,9 +2063,10 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb, | |||
| 2063 | u32 opt_len; | 2063 | u32 opt_len; |
| 2064 | int len_delta; | 2064 | int len_delta; |
| 2065 | 2065 | ||
| 2066 | buf_len = cipso_v4_genopt(buf, buf_len, doi_def, secattr); | 2066 | ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); |
| 2067 | if (buf_len < 0) | 2067 | if (ret_val < 0) |
| 2068 | return buf_len; | 2068 | return ret_val; |
| 2069 | buf_len = ret_val; | ||
| 2069 | opt_len = (buf_len + 3) & ~3; | 2070 | opt_len = (buf_len + 3) & ~3; |
| 2070 | 2071 | ||
| 2071 | /* we overwrite any existing options to ensure that we have enough | 2072 | /* we overwrite any existing options to ensure that we have enough |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 861978a4f1a8..cfb38ac9d698 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
| @@ -209,9 +209,17 @@ static int ip_local_deliver_finish(struct sk_buff *skb) | |||
| 209 | 209 | ||
| 210 | hash = protocol & (MAX_INET_PROTOS - 1); | 210 | hash = protocol & (MAX_INET_PROTOS - 1); |
| 211 | ipprot = rcu_dereference(inet_protos[hash]); | 211 | ipprot = rcu_dereference(inet_protos[hash]); |
| 212 | if (ipprot != NULL && (net == &init_net || ipprot->netns_ok)) { | 212 | if (ipprot != NULL) { |
| 213 | int ret; | 213 | int ret; |
| 214 | 214 | ||
| 215 | if (!net_eq(net, &init_net) && !ipprot->netns_ok) { | ||
| 216 | if (net_ratelimit()) | ||
| 217 | printk("%s: proto %d isn't netns-ready\n", | ||
| 218 | __func__, protocol); | ||
| 219 | kfree_skb(skb); | ||
| 220 | goto out; | ||
| 221 | } | ||
| 222 | |||
| 215 | if (!ipprot->no_policy) { | 223 | if (!ipprot->no_policy) { |
| 216 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 224 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
| 217 | kfree_skb(skb); | 225 | kfree_skb(skb); |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 8f5a403f6f6b..a631a1f110ca 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
| @@ -237,43 +237,45 @@ static const struct snmp_mib snmp4_net_list[] = { | |||
| 237 | SNMP_MIB_SENTINEL | 237 | SNMP_MIB_SENTINEL |
| 238 | }; | 238 | }; |
| 239 | 239 | ||
| 240 | static void icmpmsg_put_line(struct seq_file *seq, unsigned long *vals, | ||
| 241 | unsigned short *type, int count) | ||
| 242 | { | ||
| 243 | int j; | ||
| 244 | |||
| 245 | if (count) { | ||
| 246 | seq_printf(seq, "\nIcmpMsg:"); | ||
| 247 | for (j = 0; j < count; ++j) | ||
| 248 | seq_printf(seq, " %sType%u", | ||
| 249 | type[j] & 0x100 ? "Out" : "In", | ||
| 250 | type[j] & 0xff); | ||
| 251 | seq_printf(seq, "\nIcmpMsg:"); | ||
| 252 | for (j = 0; j < count; ++j) | ||
| 253 | seq_printf(seq, " %lu", vals[j]); | ||
| 254 | } | ||
| 255 | } | ||
| 256 | |||
| 240 | static void icmpmsg_put(struct seq_file *seq) | 257 | static void icmpmsg_put(struct seq_file *seq) |
| 241 | { | 258 | { |
| 242 | #define PERLINE 16 | 259 | #define PERLINE 16 |
| 243 | 260 | ||
| 244 | int j, i, count; | 261 | int i, count; |
| 245 | static int out[PERLINE]; | 262 | unsigned short type[PERLINE]; |
| 263 | unsigned long vals[PERLINE], val; | ||
| 246 | struct net *net = seq->private; | 264 | struct net *net = seq->private; |
| 247 | 265 | ||
| 248 | count = 0; | 266 | count = 0; |
| 249 | for (i = 0; i < ICMPMSG_MIB_MAX; i++) { | 267 | for (i = 0; i < ICMPMSG_MIB_MAX; i++) { |
| 250 | 268 | val = snmp_fold_field((void **) net->mib.icmpmsg_statistics, i); | |
| 251 | if (snmp_fold_field((void **) net->mib.icmpmsg_statistics, i)) | 269 | if (val) { |
| 252 | out[count++] = i; | 270 | type[count] = i; |
| 253 | if (count < PERLINE) | 271 | vals[count++] = val; |
| 254 | continue; | 272 | } |
| 255 | 273 | if (count == PERLINE) { | |
| 256 | seq_printf(seq, "\nIcmpMsg:"); | 274 | icmpmsg_put_line(seq, vals, type, count); |
| 257 | for (j = 0; j < PERLINE; ++j) | 275 | count = 0; |
| 258 | seq_printf(seq, " %sType%u", i & 0x100 ? "Out" : "In", | 276 | } |
| 259 | i & 0xff); | ||
| 260 | seq_printf(seq, "\nIcmpMsg: "); | ||
| 261 | for (j = 0; j < PERLINE; ++j) | ||
| 262 | seq_printf(seq, " %lu", | ||
| 263 | snmp_fold_field((void **) net->mib.icmpmsg_statistics, | ||
| 264 | out[j])); | ||
| 265 | seq_putc(seq, '\n'); | ||
| 266 | } | ||
| 267 | if (count) { | ||
| 268 | seq_printf(seq, "\nIcmpMsg:"); | ||
| 269 | for (j = 0; j < count; ++j) | ||
| 270 | seq_printf(seq, " %sType%u", out[j] & 0x100 ? "Out" : | ||
| 271 | "In", out[j] & 0xff); | ||
| 272 | seq_printf(seq, "\nIcmpMsg:"); | ||
| 273 | for (j = 0; j < count; ++j) | ||
| 274 | seq_printf(seq, " %lu", snmp_fold_field((void **) | ||
| 275 | net->mib.icmpmsg_statistics, out[j])); | ||
| 276 | } | 277 | } |
| 278 | icmpmsg_put_line(seq, vals, type, count); | ||
| 277 | 279 | ||
| 278 | #undef PERLINE | 280 | #undef PERLINE |
| 279 | } | 281 | } |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index eccb7165a80c..c5aca0bb116a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -1374,8 +1374,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 1374 | sk->sk_state == TCP_CLOSE || | 1374 | sk->sk_state == TCP_CLOSE || |
| 1375 | (sk->sk_shutdown & RCV_SHUTDOWN) || | 1375 | (sk->sk_shutdown & RCV_SHUTDOWN) || |
| 1376 | !timeo || | 1376 | !timeo || |
| 1377 | signal_pending(current) || | 1377 | signal_pending(current)) |
| 1378 | (flags & MSG_PEEK)) | ||
| 1379 | break; | 1378 | break; |
| 1380 | } else { | 1379 | } else { |
| 1381 | if (sock_flag(sk, SOCK_DONE)) | 1380 | if (sock_flag(sk, SOCK_DONE)) |
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c index af99776146ff..937549b8a921 100644 --- a/net/ipv4/tcp_htcp.c +++ b/net/ipv4/tcp_htcp.c | |||
| @@ -69,9 +69,12 @@ static u32 htcp_cwnd_undo(struct sock *sk) | |||
| 69 | const struct tcp_sock *tp = tcp_sk(sk); | 69 | const struct tcp_sock *tp = tcp_sk(sk); |
| 70 | struct htcp *ca = inet_csk_ca(sk); | 70 | struct htcp *ca = inet_csk_ca(sk); |
| 71 | 71 | ||
| 72 | ca->last_cong = ca->undo_last_cong; | 72 | if (ca->undo_last_cong) { |
| 73 | ca->maxRTT = ca->undo_maxRTT; | 73 | ca->last_cong = ca->undo_last_cong; |
| 74 | ca->old_maxB = ca->undo_old_maxB; | 74 | ca->maxRTT = ca->undo_maxRTT; |
| 75 | ca->old_maxB = ca->undo_old_maxB; | ||
| 76 | ca->undo_last_cong = 0; | ||
| 77 | } | ||
| 75 | 78 | ||
| 76 | return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); | 79 | return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); |
| 77 | } | 80 | } |
| @@ -268,7 +271,10 @@ static void htcp_state(struct sock *sk, u8 new_state) | |||
| 268 | case TCP_CA_Open: | 271 | case TCP_CA_Open: |
| 269 | { | 272 | { |
| 270 | struct htcp *ca = inet_csk_ca(sk); | 273 | struct htcp *ca = inet_csk_ca(sk); |
| 271 | ca->last_cong = jiffies; | 274 | if (ca->undo_last_cong) { |
| 275 | ca->last_cong = jiffies; | ||
| 276 | ca->undo_last_cong = 0; | ||
| 277 | } | ||
| 272 | } | 278 | } |
| 273 | break; | 279 | break; |
| 274 | case TCP_CA_CWR: | 280 | case TCP_CA_CWR: |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index e4c5ac9fe89b..ba85d8831893 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -2279,6 +2279,11 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
| 2279 | } | 2279 | } |
| 2280 | 2280 | ||
| 2281 | memset(&opts, 0, sizeof(opts)); | 2281 | memset(&opts, 0, sizeof(opts)); |
| 2282 | #ifdef CONFIG_SYN_COOKIES | ||
| 2283 | if (unlikely(req->cookie_ts)) | ||
| 2284 | TCP_SKB_CB(skb)->when = cookie_init_timestamp(req); | ||
| 2285 | else | ||
| 2286 | #endif | ||
| 2282 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 2287 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
| 2283 | tcp_header_size = tcp_synack_options(sk, req, mss, | 2288 | tcp_header_size = tcp_synack_options(sk, req, mss, |
| 2284 | skb, &opts, &md5) + | 2289 | skb, &opts, &md5) + |
| @@ -2304,11 +2309,6 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
| 2304 | 2309 | ||
| 2305 | /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ | 2310 | /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ |
| 2306 | th->window = htons(min(req->rcv_wnd, 65535U)); | 2311 | th->window = htons(min(req->rcv_wnd, 65535U)); |
| 2307 | #ifdef CONFIG_SYN_COOKIES | ||
| 2308 | if (unlikely(req->cookie_ts)) | ||
| 2309 | TCP_SKB_CB(skb)->when = cookie_init_timestamp(req); | ||
| 2310 | else | ||
| 2311 | #endif | ||
| 2312 | tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location); | 2312 | tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location); |
| 2313 | th->doff = (tcp_header_size >> 2); | 2313 | th->doff = (tcp_header_size >> 2); |
| 2314 | TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTSEGS); | 2314 | TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTSEGS); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 2095abc3caba..cf02701ced48 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -284,7 +284,7 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | |||
| 284 | } | 284 | } |
| 285 | EXPORT_SYMBOL_GPL(udp4_lib_lookup); | 285 | EXPORT_SYMBOL_GPL(udp4_lib_lookup); |
| 286 | 286 | ||
| 287 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, | 287 | static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk, |
| 288 | __be16 loc_port, __be32 loc_addr, | 288 | __be16 loc_port, __be32 loc_addr, |
| 289 | __be16 rmt_port, __be32 rmt_addr, | 289 | __be16 rmt_port, __be32 rmt_addr, |
| 290 | int dif) | 290 | int dif) |
| @@ -296,7 +296,8 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk, | |||
| 296 | sk_for_each_from(s, node) { | 296 | sk_for_each_from(s, node) { |
| 297 | struct inet_sock *inet = inet_sk(s); | 297 | struct inet_sock *inet = inet_sk(s); |
| 298 | 298 | ||
| 299 | if (s->sk_hash != hnum || | 299 | if (!net_eq(sock_net(s), net) || |
| 300 | s->sk_hash != hnum || | ||
| 300 | (inet->daddr && inet->daddr != rmt_addr) || | 301 | (inet->daddr && inet->daddr != rmt_addr) || |
| 301 | (inet->dport != rmt_port && inet->dport) || | 302 | (inet->dport != rmt_port && inet->dport) || |
| 302 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || | 303 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || |
| @@ -1079,15 +1080,16 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | |||
| 1079 | read_lock(&udp_hash_lock); | 1080 | read_lock(&udp_hash_lock); |
| 1080 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); | 1081 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); |
| 1081 | dif = skb->dev->ifindex; | 1082 | dif = skb->dev->ifindex; |
| 1082 | sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); | 1083 | sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); |
| 1083 | if (sk) { | 1084 | if (sk) { |
| 1084 | struct sock *sknext = NULL; | 1085 | struct sock *sknext = NULL; |
| 1085 | 1086 | ||
| 1086 | do { | 1087 | do { |
| 1087 | struct sk_buff *skb1 = skb; | 1088 | struct sk_buff *skb1 = skb; |
| 1088 | 1089 | ||
| 1089 | sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr, | 1090 | sknext = udp_v4_mcast_next(net, sk_next(sk), uh->dest, |
| 1090 | uh->source, saddr, dif); | 1091 | daddr, uh->source, saddr, |
| 1092 | dif); | ||
| 1091 | if (sknext) | 1093 | if (sknext) |
| 1092 | skb1 = skb_clone(skb, GFP_ATOMIC); | 1094 | skb1 = skb_clone(skb, GFP_ATOMIC); |
| 1093 | 1095 | ||
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index 07735ed280d7..55dc6beab9aa 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
| @@ -33,6 +33,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl, | |||
| 33 | x->sel.dport_mask = htons(0xffff); | 33 | x->sel.dport_mask = htons(0xffff); |
| 34 | x->sel.sport = xfrm_flowi_sport(fl); | 34 | x->sel.sport = xfrm_flowi_sport(fl); |
| 35 | x->sel.sport_mask = htons(0xffff); | 35 | x->sel.sport_mask = htons(0xffff); |
| 36 | x->sel.family = AF_INET; | ||
| 36 | x->sel.prefixlen_d = 32; | 37 | x->sel.prefixlen_d = 32; |
| 37 | x->sel.prefixlen_s = 32; | 38 | x->sel.prefixlen_s = 32; |
| 38 | x->sel.proto = fl->proto; | 39 | x->sel.proto = fl->proto; |
