diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ah4.c | 2 | ||||
-rw-r--r-- | net/ipv4/arp.c | 3 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 5 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 99 | ||||
-rw-r--r-- | net/ipv4/inet_hashtables.c | 3 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 5 |
6 files changed, 88 insertions, 29 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 9d4555ec0b59..8219b7e0968d 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -96,7 +96,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb) | |||
96 | 96 | ||
97 | ah->reserved = 0; | 97 | ah->reserved = 0; |
98 | ah->spi = x->id.spi; | 98 | ah->spi = x->id.spi; |
99 | ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); | 99 | ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output); |
100 | 100 | ||
101 | spin_lock_bh(&x->lock); | 101 | spin_lock_bh(&x->lock); |
102 | err = ah_mac_digest(ahp, skb, ah->auth_data); | 102 | err = ah_mac_digest(ahp, skb, ah->auth_data); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 8e17f65f4002..c663fa5339ee 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -368,7 +368,6 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
368 | if (!(neigh->nud_state&NUD_VALID)) | 368 | if (!(neigh->nud_state&NUD_VALID)) |
369 | printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n"); | 369 | printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n"); |
370 | dst_ha = neigh->ha; | 370 | dst_ha = neigh->ha; |
371 | read_lock_bh(&neigh->lock); | ||
372 | } else if ((probes -= neigh->parms->app_probes) < 0) { | 371 | } else if ((probes -= neigh->parms->app_probes) < 0) { |
373 | #ifdef CONFIG_ARPD | 372 | #ifdef CONFIG_ARPD |
374 | neigh_app_ns(neigh); | 373 | neigh_app_ns(neigh); |
@@ -378,8 +377,6 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
378 | 377 | ||
379 | arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, | 378 | arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, |
380 | dst_ha, dev->dev_addr, NULL); | 379 | dst_ha, dev->dev_addr, NULL); |
381 | if (dst_ha) | ||
382 | read_unlock_bh(&neigh->lock); | ||
383 | } | 380 | } |
384 | 381 | ||
385 | static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) | 382 | static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 258d17631b4b..091e6709f831 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -199,7 +199,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | esph->spi = x->id.spi; | 201 | esph->spi = x->id.spi; |
202 | esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq); | 202 | esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output); |
203 | 203 | ||
204 | sg_init_table(sg, nfrags); | 204 | sg_init_table(sg, nfrags); |
205 | skb_to_sgvec(skb, sg, | 205 | skb_to_sgvec(skb, sg, |
@@ -210,7 +210,8 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
210 | aead_givcrypt_set_callback(req, 0, esp_output_done, skb); | 210 | aead_givcrypt_set_callback(req, 0, esp_output_done, skb); |
211 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); | 211 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); |
212 | aead_givcrypt_set_assoc(req, asg, sizeof(*esph)); | 212 | aead_givcrypt_set_assoc(req, asg, sizeof(*esph)); |
213 | aead_givcrypt_set_giv(req, esph->enc_data, XFRM_SKB_CB(skb)->seq); | 213 | aead_givcrypt_set_giv(req, esph->enc_data, |
214 | XFRM_SKB_CB(skb)->seq.output); | ||
214 | 215 | ||
215 | ESP_SKB_CB(skb)->tmp = tmp; | 216 | ESP_SKB_CB(skb)->tmp = tmp; |
216 | err = crypto_aead_givencrypt(req); | 217 | err = crypto_aead_givencrypt(req); |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index f5fba3f71c06..1ff446d0fa8b 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1762,11 +1762,9 @@ static struct leaf *trie_leafindex(struct trie *t, int index) | |||
1762 | { | 1762 | { |
1763 | struct leaf *l = trie_firstleaf(t); | 1763 | struct leaf *l = trie_firstleaf(t); |
1764 | 1764 | ||
1765 | while (index-- > 0) { | 1765 | while (l && index-- > 0) |
1766 | l = trie_nextleaf(l); | 1766 | l = trie_nextleaf(l); |
1767 | if (!l) | 1767 | |
1768 | break; | ||
1769 | } | ||
1770 | return l; | 1768 | return l; |
1771 | } | 1769 | } |
1772 | 1770 | ||
@@ -2461,6 +2459,84 @@ static const struct file_operations fib_trie_fops = { | |||
2461 | .release = seq_release_net, | 2459 | .release = seq_release_net, |
2462 | }; | 2460 | }; |
2463 | 2461 | ||
2462 | struct fib_route_iter { | ||
2463 | struct seq_net_private p; | ||
2464 | struct trie *main_trie; | ||
2465 | loff_t pos; | ||
2466 | t_key key; | ||
2467 | }; | ||
2468 | |||
2469 | static struct leaf *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) | ||
2470 | { | ||
2471 | struct leaf *l = NULL; | ||
2472 | struct trie *t = iter->main_trie; | ||
2473 | |||
2474 | /* use cache location of last found key */ | ||
2475 | if (iter->pos > 0 && pos >= iter->pos && (l = fib_find_node(t, iter->key))) | ||
2476 | pos -= iter->pos; | ||
2477 | else { | ||
2478 | iter->pos = 0; | ||
2479 | l = trie_firstleaf(t); | ||
2480 | } | ||
2481 | |||
2482 | while (l && pos-- > 0) { | ||
2483 | iter->pos++; | ||
2484 | l = trie_nextleaf(l); | ||
2485 | } | ||
2486 | |||
2487 | if (l) | ||
2488 | iter->key = pos; /* remember it */ | ||
2489 | else | ||
2490 | iter->pos = 0; /* forget it */ | ||
2491 | |||
2492 | return l; | ||
2493 | } | ||
2494 | |||
2495 | static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos) | ||
2496 | __acquires(RCU) | ||
2497 | { | ||
2498 | struct fib_route_iter *iter = seq->private; | ||
2499 | struct fib_table *tb; | ||
2500 | |||
2501 | rcu_read_lock(); | ||
2502 | tb = fib_get_table(iter->p.net, RT_TABLE_MAIN); | ||
2503 | if (!tb) | ||
2504 | return NULL; | ||
2505 | |||
2506 | iter->main_trie = (struct trie *) tb->tb_data; | ||
2507 | if (*pos == 0) | ||
2508 | return SEQ_START_TOKEN; | ||
2509 | else | ||
2510 | return fib_route_get_idx(iter, *pos - 1); | ||
2511 | } | ||
2512 | |||
2513 | static void *fib_route_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
2514 | { | ||
2515 | struct fib_route_iter *iter = seq->private; | ||
2516 | struct leaf *l = v; | ||
2517 | |||
2518 | ++*pos; | ||
2519 | if (v == SEQ_START_TOKEN) { | ||
2520 | iter->pos = 0; | ||
2521 | l = trie_firstleaf(iter->main_trie); | ||
2522 | } else { | ||
2523 | iter->pos++; | ||
2524 | l = trie_nextleaf(l); | ||
2525 | } | ||
2526 | |||
2527 | if (l) | ||
2528 | iter->key = l->key; | ||
2529 | else | ||
2530 | iter->pos = 0; | ||
2531 | return l; | ||
2532 | } | ||
2533 | |||
2534 | static void fib_route_seq_stop(struct seq_file *seq, void *v) | ||
2535 | __releases(RCU) | ||
2536 | { | ||
2537 | rcu_read_unlock(); | ||
2538 | } | ||
2539 | |||
2464 | static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi) | 2540 | static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi) |
2465 | { | 2541 | { |
2466 | static unsigned type2flags[RTN_MAX + 1] = { | 2542 | static unsigned type2flags[RTN_MAX + 1] = { |
@@ -2484,7 +2560,6 @@ static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi) | |||
2484 | */ | 2560 | */ |
2485 | static int fib_route_seq_show(struct seq_file *seq, void *v) | 2561 | static int fib_route_seq_show(struct seq_file *seq, void *v) |
2486 | { | 2562 | { |
2487 | const struct fib_trie_iter *iter = seq->private; | ||
2488 | struct leaf *l = v; | 2563 | struct leaf *l = v; |
2489 | struct leaf_info *li; | 2564 | struct leaf_info *li; |
2490 | struct hlist_node *node; | 2565 | struct hlist_node *node; |
@@ -2496,12 +2571,6 @@ static int fib_route_seq_show(struct seq_file *seq, void *v) | |||
2496 | return 0; | 2571 | return 0; |
2497 | } | 2572 | } |
2498 | 2573 | ||
2499 | if (iter->trie == iter->trie_local) | ||
2500 | return 0; | ||
2501 | |||
2502 | if (IS_TNODE(l)) | ||
2503 | return 0; | ||
2504 | |||
2505 | hlist_for_each_entry_rcu(li, node, &l->list, hlist) { | 2574 | hlist_for_each_entry_rcu(li, node, &l->list, hlist) { |
2506 | struct fib_alias *fa; | 2575 | struct fib_alias *fa; |
2507 | __be32 mask, prefix; | 2576 | __be32 mask, prefix; |
@@ -2544,16 +2613,16 @@ static int fib_route_seq_show(struct seq_file *seq, void *v) | |||
2544 | } | 2613 | } |
2545 | 2614 | ||
2546 | static const struct seq_operations fib_route_seq_ops = { | 2615 | static const struct seq_operations fib_route_seq_ops = { |
2547 | .start = fib_trie_seq_start, | 2616 | .start = fib_route_seq_start, |
2548 | .next = fib_trie_seq_next, | 2617 | .next = fib_route_seq_next, |
2549 | .stop = fib_trie_seq_stop, | 2618 | .stop = fib_route_seq_stop, |
2550 | .show = fib_route_seq_show, | 2619 | .show = fib_route_seq_show, |
2551 | }; | 2620 | }; |
2552 | 2621 | ||
2553 | static int fib_route_seq_open(struct inode *inode, struct file *file) | 2622 | static int fib_route_seq_open(struct inode *inode, struct file *file) |
2554 | { | 2623 | { |
2555 | return seq_open_net(inode, file, &fib_route_seq_ops, | 2624 | return seq_open_net(inode, file, &fib_route_seq_ops, |
2556 | sizeof(struct fib_trie_iter)); | 2625 | sizeof(struct fib_route_iter)); |
2557 | } | 2626 | } |
2558 | 2627 | ||
2559 | static const struct file_operations fib_route_fops = { | 2628 | static const struct file_operations fib_route_fops = { |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 9cac6c034abd..1aba606f6bbb 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -120,8 +120,6 @@ void inet_listen_wlock(struct inet_hashinfo *hashinfo) | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | EXPORT_SYMBOL(inet_listen_wlock); | ||
124 | |||
125 | /* | 123 | /* |
126 | * Don't inline this cruft. Here are some nice properties to exploit here. The | 124 | * Don't inline this cruft. Here are some nice properties to exploit here. The |
127 | * BSD API does not allow a listening sock to specify the remote port nor the | 125 | * BSD API does not allow a listening sock to specify the remote port nor the |
@@ -494,7 +492,6 @@ out: | |||
494 | return ret; | 492 | return ret; |
495 | } | 493 | } |
496 | } | 494 | } |
497 | EXPORT_SYMBOL_GPL(__inet_hash_connect); | ||
498 | 495 | ||
499 | /* | 496 | /* |
500 | * Bind a port for a connect operation and hash it. | 497 | * Bind a port for a connect operation and hash it. |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 754b0a5bbfe9..de0572c88859 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -514,11 +514,6 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
514 | val &= ~3; | 514 | val &= ~3; |
515 | val |= inet->tos & 3; | 515 | val |= inet->tos & 3; |
516 | } | 516 | } |
517 | if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP && | ||
518 | !capable(CAP_NET_ADMIN)) { | ||
519 | err = -EPERM; | ||
520 | break; | ||
521 | } | ||
522 | if (inet->tos != val) { | 517 | if (inet->tos != val) { |
523 | inet->tos = val; | 518 | inet->tos = val; |
524 | sk->sk_priority = rt_tos2priority(val); | 519 | sk->sk_priority = rt_tos2priority(val); |