diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_output.c | 4 | ||||
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 27 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 33 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_ULOG.c | 5 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_hashlimit.c | 11 | ||||
-rw-r--r-- | net/ipv4/route.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 3 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 12 | ||||
-rw-r--r-- | net/ipv4/tcp_probe.c | 3 |
9 files changed, 70 insertions, 30 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 9bf307a29783..4c20f5546893 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -947,7 +947,7 @@ alloc_new_skb: | |||
947 | skb_prev->csum = csum_sub(skb_prev->csum, | 947 | skb_prev->csum = csum_sub(skb_prev->csum, |
948 | skb->csum); | 948 | skb->csum); |
949 | data += fraggap; | 949 | data += fraggap; |
950 | skb_trim(skb_prev, maxfraglen); | 950 | pskb_trim_unique(skb_prev, maxfraglen); |
951 | } | 951 | } |
952 | 952 | ||
953 | copy = datalen - transhdrlen - fraggap; | 953 | copy = datalen - transhdrlen - fraggap; |
@@ -1142,7 +1142,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1142 | data, fraggap, 0); | 1142 | data, fraggap, 0); |
1143 | skb_prev->csum = csum_sub(skb_prev->csum, | 1143 | skb_prev->csum = csum_sub(skb_prev->csum, |
1144 | skb->csum); | 1144 | skb->csum); |
1145 | skb_trim(skb_prev, maxfraglen); | 1145 | pskb_trim_unique(skb_prev, maxfraglen); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | /* | 1148 | /* |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 80c73ca90116..df4854cf598b 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1170,21 +1170,34 @@ static int __init arp_tables_init(void) | |||
1170 | { | 1170 | { |
1171 | int ret; | 1171 | int ret; |
1172 | 1172 | ||
1173 | xt_proto_init(NF_ARP); | 1173 | ret = xt_proto_init(NF_ARP); |
1174 | if (ret < 0) | ||
1175 | goto err1; | ||
1174 | 1176 | ||
1175 | /* Noone else will be downing sem now, so we won't sleep */ | 1177 | /* Noone else will be downing sem now, so we won't sleep */ |
1176 | xt_register_target(&arpt_standard_target); | 1178 | ret = xt_register_target(&arpt_standard_target); |
1177 | xt_register_target(&arpt_error_target); | 1179 | if (ret < 0) |
1180 | goto err2; | ||
1181 | ret = xt_register_target(&arpt_error_target); | ||
1182 | if (ret < 0) | ||
1183 | goto err3; | ||
1178 | 1184 | ||
1179 | /* Register setsockopt */ | 1185 | /* Register setsockopt */ |
1180 | ret = nf_register_sockopt(&arpt_sockopts); | 1186 | ret = nf_register_sockopt(&arpt_sockopts); |
1181 | if (ret < 0) { | 1187 | if (ret < 0) |
1182 | duprintf("Unable to register sockopts.\n"); | 1188 | goto err4; |
1183 | return ret; | ||
1184 | } | ||
1185 | 1189 | ||
1186 | printk("arp_tables: (C) 2002 David S. Miller\n"); | 1190 | printk("arp_tables: (C) 2002 David S. Miller\n"); |
1187 | return 0; | 1191 | return 0; |
1192 | |||
1193 | err4: | ||
1194 | xt_unregister_target(&arpt_error_target); | ||
1195 | err3: | ||
1196 | xt_unregister_target(&arpt_standard_target); | ||
1197 | err2: | ||
1198 | xt_proto_fini(NF_ARP); | ||
1199 | err1: | ||
1200 | return ret; | ||
1188 | } | 1201 | } |
1189 | 1202 | ||
1190 | static void __exit arp_tables_fini(void) | 1203 | static void __exit arp_tables_fini(void) |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index fc5bdd5eb7d3..f316ff5fd8a6 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -2239,22 +2239,39 @@ static int __init ip_tables_init(void) | |||
2239 | { | 2239 | { |
2240 | int ret; | 2240 | int ret; |
2241 | 2241 | ||
2242 | xt_proto_init(AF_INET); | 2242 | ret = xt_proto_init(AF_INET); |
2243 | if (ret < 0) | ||
2244 | goto err1; | ||
2243 | 2245 | ||
2244 | /* Noone else will be downing sem now, so we won't sleep */ | 2246 | /* Noone else will be downing sem now, so we won't sleep */ |
2245 | xt_register_target(&ipt_standard_target); | 2247 | ret = xt_register_target(&ipt_standard_target); |
2246 | xt_register_target(&ipt_error_target); | 2248 | if (ret < 0) |
2247 | xt_register_match(&icmp_matchstruct); | 2249 | goto err2; |
2250 | ret = xt_register_target(&ipt_error_target); | ||
2251 | if (ret < 0) | ||
2252 | goto err3; | ||
2253 | ret = xt_register_match(&icmp_matchstruct); | ||
2254 | if (ret < 0) | ||
2255 | goto err4; | ||
2248 | 2256 | ||
2249 | /* Register setsockopt */ | 2257 | /* Register setsockopt */ |
2250 | ret = nf_register_sockopt(&ipt_sockopts); | 2258 | ret = nf_register_sockopt(&ipt_sockopts); |
2251 | if (ret < 0) { | 2259 | if (ret < 0) |
2252 | duprintf("Unable to register sockopts.\n"); | 2260 | goto err5; |
2253 | return ret; | ||
2254 | } | ||
2255 | 2261 | ||
2256 | printk("ip_tables: (C) 2000-2006 Netfilter Core Team\n"); | 2262 | printk("ip_tables: (C) 2000-2006 Netfilter Core Team\n"); |
2257 | return 0; | 2263 | return 0; |
2264 | |||
2265 | err5: | ||
2266 | xt_unregister_match(&icmp_matchstruct); | ||
2267 | err4: | ||
2268 | xt_unregister_target(&ipt_error_target); | ||
2269 | err3: | ||
2270 | xt_unregister_target(&ipt_standard_target); | ||
2271 | err2: | ||
2272 | xt_proto_fini(AF_INET); | ||
2273 | err1: | ||
2274 | return ret; | ||
2258 | } | 2275 | } |
2259 | 2276 | ||
2260 | static void __exit ip_tables_fini(void) | 2277 | static void __exit ip_tables_fini(void) |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index d7dd7fe7051c..d46fd677fa11 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -115,6 +115,11 @@ static void ulog_send(unsigned int nlgroupnum) | |||
115 | del_timer(&ub->timer); | 115 | del_timer(&ub->timer); |
116 | } | 116 | } |
117 | 117 | ||
118 | if (!ub->skb) { | ||
119 | DEBUGP("ipt_ULOG: ulog_send: nothing to send\n"); | ||
120 | return; | ||
121 | } | ||
122 | |||
118 | /* last nlmsg needs NLMSG_DONE */ | 123 | /* last nlmsg needs NLMSG_DONE */ |
119 | if (ub->qlen > 1) | 124 | if (ub->qlen > 1) |
120 | ub->lastnlh->nlmsg_type = NLMSG_DONE; | 125 | ub->lastnlh->nlmsg_type = NLMSG_DONE; |
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index 6b662449e825..3bd2368e1fc9 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -454,15 +454,12 @@ hashlimit_match(const struct sk_buff *skb, | |||
454 | dh->rateinfo.credit_cap = user2credits(hinfo->cfg.avg * | 454 | dh->rateinfo.credit_cap = user2credits(hinfo->cfg.avg * |
455 | hinfo->cfg.burst); | 455 | hinfo->cfg.burst); |
456 | dh->rateinfo.cost = user2credits(hinfo->cfg.avg); | 456 | dh->rateinfo.cost = user2credits(hinfo->cfg.avg); |
457 | 457 | } else { | |
458 | spin_unlock_bh(&hinfo->lock); | 458 | /* update expiration timeout */ |
459 | return 1; | 459 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); |
460 | rateinfo_recalc(dh, now); | ||
460 | } | 461 | } |
461 | 462 | ||
462 | /* update expiration timeout */ | ||
463 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); | ||
464 | |||
465 | rateinfo_recalc(dh, now); | ||
466 | if (dh->rateinfo.credit >= dh->rateinfo.cost) { | 463 | if (dh->rateinfo.credit >= dh->rateinfo.cost) { |
467 | /* We're underlimit. */ | 464 | /* We're underlimit. */ |
468 | dh->rateinfo.credit -= dh->rateinfo.cost; | 465 | dh->rateinfo.credit -= dh->rateinfo.cost; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 19bd49d69d9f..b873cbcdd0b8 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3157,7 +3157,7 @@ int __init ip_rt_init(void) | |||
3157 | rhash_entries, | 3157 | rhash_entries, |
3158 | (num_physpages >= 128 * 1024) ? | 3158 | (num_physpages >= 128 * 1024) ? |
3159 | 15 : 17, | 3159 | 15 : 17, |
3160 | HASH_HIGHMEM, | 3160 | 0, |
3161 | &rt_hash_log, | 3161 | &rt_hash_log, |
3162 | &rt_hash_mask, | 3162 | &rt_hash_mask, |
3163 | 0); | 3163 | 0); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 738dad9f7d49..104af5d5bcbc 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3541,7 +3541,8 @@ void tcp_cwnd_application_limited(struct sock *sk) | |||
3541 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && | 3541 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && |
3542 | sk->sk_socket && !test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { | 3542 | sk->sk_socket && !test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { |
3543 | /* Limited by application or receiver window. */ | 3543 | /* Limited by application or receiver window. */ |
3544 | u32 win_used = max(tp->snd_cwnd_used, 2U); | 3544 | u32 init_win = tcp_init_cwnd(tp, __sk_dst_get(sk)); |
3545 | u32 win_used = max(tp->snd_cwnd_used, init_win); | ||
3545 | if (win_used < tp->snd_cwnd) { | 3546 | if (win_used < tp->snd_cwnd) { |
3546 | tp->snd_ssthresh = tcp_current_ssthresh(sk); | 3547 | tp->snd_ssthresh = tcp_current_ssthresh(sk); |
3547 | tp->snd_cwnd = (tp->snd_cwnd + win_used) >> 1; | 3548 | tp->snd_cwnd = (tp->snd_cwnd + win_used) >> 1; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5c08ea20a18d..507adefbc17c 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -466,7 +466,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
466 | if (skb->len != tcp_header_size) | 466 | if (skb->len != tcp_header_size) |
467 | tcp_event_data_sent(tp, skb, sk); | 467 | tcp_event_data_sent(tp, skb, sk); |
468 | 468 | ||
469 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 469 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
470 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | ||
470 | 471 | ||
471 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); | 472 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
472 | if (likely(err <= 0)) | 473 | if (likely(err <= 0)) |
@@ -2157,10 +2158,9 @@ int tcp_connect(struct sock *sk) | |||
2157 | skb_shinfo(buff)->gso_size = 0; | 2158 | skb_shinfo(buff)->gso_size = 0; |
2158 | skb_shinfo(buff)->gso_type = 0; | 2159 | skb_shinfo(buff)->gso_type = 0; |
2159 | buff->csum = 0; | 2160 | buff->csum = 0; |
2161 | tp->snd_nxt = tp->write_seq; | ||
2160 | TCP_SKB_CB(buff)->seq = tp->write_seq++; | 2162 | TCP_SKB_CB(buff)->seq = tp->write_seq++; |
2161 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; | 2163 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; |
2162 | tp->snd_nxt = tp->write_seq; | ||
2163 | tp->pushed_seq = tp->write_seq; | ||
2164 | 2164 | ||
2165 | /* Send it off. */ | 2165 | /* Send it off. */ |
2166 | TCP_SKB_CB(buff)->when = tcp_time_stamp; | 2166 | TCP_SKB_CB(buff)->when = tcp_time_stamp; |
@@ -2170,6 +2170,12 @@ int tcp_connect(struct sock *sk) | |||
2170 | sk_charge_skb(sk, buff); | 2170 | sk_charge_skb(sk, buff); |
2171 | tp->packets_out += tcp_skb_pcount(buff); | 2171 | tp->packets_out += tcp_skb_pcount(buff); |
2172 | tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); | 2172 | tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); |
2173 | |||
2174 | /* We change tp->snd_nxt after the tcp_transmit_skb() call | ||
2175 | * in order to make this packet get counted in tcpOutSegs. | ||
2176 | */ | ||
2177 | tp->snd_nxt = tp->write_seq; | ||
2178 | tp->pushed_seq = tp->write_seq; | ||
2173 | TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); | 2179 | TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); |
2174 | 2180 | ||
2175 | /* Timer for repeating the SYN until an answer. */ | 2181 | /* Timer for repeating the SYN until an answer. */ |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index b3435324b573..dab37d2f65fc 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -130,11 +130,12 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf, | |||
130 | error = wait_event_interruptible(tcpw.wait, | 130 | error = wait_event_interruptible(tcpw.wait, |
131 | __kfifo_len(tcpw.fifo) != 0); | 131 | __kfifo_len(tcpw.fifo) != 0); |
132 | if (error) | 132 | if (error) |
133 | return error; | 133 | goto out_free; |
134 | 134 | ||
135 | cnt = kfifo_get(tcpw.fifo, tbuf, len); | 135 | cnt = kfifo_get(tcpw.fifo, tbuf, len); |
136 | error = copy_to_user(buf, tbuf, cnt); | 136 | error = copy_to_user(buf, tbuf, cnt); |
137 | 137 | ||
138 | out_free: | ||
138 | vfree(tbuf); | 139 | vfree(tbuf); |
139 | 140 | ||
140 | return error ? error : cnt; | 141 | return error ? error : cnt; |