diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-26 17:47:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-26 17:47:05 -0500 |
commit | d312c8f81c9810d669cdf13b28f1a5d474738eaf (patch) | |
tree | aa7adbb2bdf84717bc6ac5c0a3bc936b9bc19116 /net | |
parent | 08eacc3157baf5d14c8e2c4ffc77c13a0ac8a85b (diff) | |
parent | 7399072a7348d025e7bcb5eb5d5e9be941d490b7 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[NETFILTER]: nf_conntrack_pptp: fix NAT setup of expected GRE connections
[NETFILTER]: nf_nat_pptp: fix expectation removal
[NETFILTER]: nf_nat: fix ICMP translation with statically linked conntrack
[TCP]: Restore SKB socket owner setting in tcp_transmit_skb().
[AF_PACKET]: Check device down state before hard header callbacks.
[DECNET]: Handle a failure in neigh_parms_alloc (take 2)
[BNX2]: Fix 2nd port's MAC address.
[TCP]: Fix sorting of SACK blocks.
[AF_PACKET]: Fix BPF handling.
[IPV4]: Fix the fib trie iterator to work with a single entry routing tables
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/output.c | 4 | ||||
-rw-r--r-- | net/decnet/dn_dev.c | 11 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 21 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 3 | ||||
-rw-r--r-- | net/ipv4/netfilter/Makefile | 20 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_pptp.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 3 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_pptp.c | 2 | ||||
-rw-r--r-- | net/packet/af_packet.c | 46 | ||||
-rw-r--r-- | net/sctp/protocol.c | 2 |
12 files changed, 75 insertions, 53 deletions
diff --git a/net/dccp/output.c b/net/dccp/output.c index 824569659083..3435542e9652 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -124,7 +124,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
124 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); | 124 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); |
125 | 125 | ||
126 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 126 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
127 | err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0); | 127 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
128 | return net_xmit_eval(err); | 128 | return net_xmit_eval(err); |
129 | } | 129 | } |
130 | return -ENOBUFS; | 130 | return -ENOBUFS; |
@@ -396,7 +396,7 @@ int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code) | |||
396 | code); | 396 | code); |
397 | if (skb != NULL) { | 397 | if (skb != NULL) { |
398 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 398 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
399 | err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, sk, 0); | 399 | err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, 0); |
400 | return net_xmit_eval(err); | 400 | return net_xmit_eval(err); |
401 | } | 401 | } |
402 | } | 402 | } |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index fc6f3c023a54..ed083ab455b7 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -1145,16 +1145,23 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err) | |||
1145 | init_timer(&dn_db->timer); | 1145 | init_timer(&dn_db->timer); |
1146 | 1146 | ||
1147 | dn_db->uptime = jiffies; | 1147 | dn_db->uptime = jiffies; |
1148 | |||
1149 | dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table); | ||
1150 | if (!dn_db->neigh_parms) { | ||
1151 | dev->dn_ptr = NULL; | ||
1152 | kfree(dn_db); | ||
1153 | return NULL; | ||
1154 | } | ||
1155 | |||
1148 | if (dn_db->parms.up) { | 1156 | if (dn_db->parms.up) { |
1149 | if (dn_db->parms.up(dev) < 0) { | 1157 | if (dn_db->parms.up(dev) < 0) { |
1158 | neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms); | ||
1150 | dev->dn_ptr = NULL; | 1159 | dev->dn_ptr = NULL; |
1151 | kfree(dn_db); | 1160 | kfree(dn_db); |
1152 | return NULL; | 1161 | return NULL; |
1153 | } | 1162 | } |
1154 | } | 1163 | } |
1155 | 1164 | ||
1156 | dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table); | ||
1157 | |||
1158 | dn_dev_sysctl_register(dev, &dn_db->parms); | 1165 | dn_dev_sysctl_register(dev, &dn_db->parms); |
1159 | 1166 | ||
1160 | dn_dev_set_timer(dev); | 1167 | dn_dev_set_timer(dev); |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index cfb249cc0a58..13307c04d5a1 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1989,6 +1989,10 @@ static struct node *fib_trie_get_next(struct fib_trie_iter *iter) | |||
1989 | unsigned cindex = iter->index; | 1989 | unsigned cindex = iter->index; |
1990 | struct tnode *p; | 1990 | struct tnode *p; |
1991 | 1991 | ||
1992 | /* A single entry routing table */ | ||
1993 | if (!tn) | ||
1994 | return NULL; | ||
1995 | |||
1992 | pr_debug("get_next iter={node=%p index=%d depth=%d}\n", | 1996 | pr_debug("get_next iter={node=%p index=%d depth=%d}\n", |
1993 | iter->tnode, iter->index, iter->depth); | 1997 | iter->tnode, iter->index, iter->depth); |
1994 | rescan: | 1998 | rescan: |
@@ -2037,11 +2041,18 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter, | |||
2037 | if(!iter) | 2041 | if(!iter) |
2038 | return NULL; | 2042 | return NULL; |
2039 | 2043 | ||
2040 | if (n && IS_TNODE(n)) { | 2044 | if (n) { |
2041 | iter->tnode = (struct tnode *) n; | 2045 | if (IS_TNODE(n)) { |
2042 | iter->trie = t; | 2046 | iter->tnode = (struct tnode *) n; |
2043 | iter->index = 0; | 2047 | iter->trie = t; |
2044 | iter->depth = 1; | 2048 | iter->index = 0; |
2049 | iter->depth = 1; | ||
2050 | } else { | ||
2051 | iter->tnode = NULL; | ||
2052 | iter->trie = t; | ||
2053 | iter->index = 0; | ||
2054 | iter->depth = 0; | ||
2055 | } | ||
2045 | return n; | 2056 | return n; |
2046 | } | 2057 | } |
2047 | return NULL; | 2058 | return NULL; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index f071f84808fa..a0f2008584bc 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -281,8 +281,9 @@ int ip_output(struct sk_buff *skb) | |||
281 | !(IPCB(skb)->flags & IPSKB_REROUTED)); | 281 | !(IPCB(skb)->flags & IPSKB_REROUTED)); |
282 | } | 282 | } |
283 | 283 | ||
284 | int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok) | 284 | int ip_queue_xmit(struct sk_buff *skb, int ipfragok) |
285 | { | 285 | { |
286 | struct sock *sk = skb->sk; | ||
286 | struct inet_sock *inet = inet_sk(sk); | 287 | struct inet_sock *inet = inet_sk(sk); |
287 | struct ip_options *opt = inet->opt; | 288 | struct ip_options *opt = inet->opt; |
288 | struct rtable *rt; | 289 | struct rtable *rt; |
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 15e741aeb291..16d177b71bf8 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
@@ -4,6 +4,14 @@ | |||
4 | 4 | ||
5 | # objects for the standalone - connection tracking / NAT | 5 | # objects for the standalone - connection tracking / NAT |
6 | ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o | 6 | ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o |
7 | # objects for l3 independent conntrack | ||
8 | nf_conntrack_ipv4-objs := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o | ||
9 | ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y) | ||
10 | ifeq ($(CONFIG_PROC_FS),y) | ||
11 | nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o | ||
12 | endif | ||
13 | endif | ||
14 | |||
7 | ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o | 15 | ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o |
8 | nf_nat-objs := nf_nat_core.o nf_nat_helper.o nf_nat_proto_unknown.o nf_nat_proto_tcp.o nf_nat_proto_udp.o nf_nat_proto_icmp.o | 16 | nf_nat-objs := nf_nat_core.o nf_nat_helper.o nf_nat_proto_unknown.o nf_nat_proto_tcp.o nf_nat_proto_udp.o nf_nat_proto_icmp.o |
9 | ifneq ($(CONFIG_NF_NAT),) | 17 | ifneq ($(CONFIG_NF_NAT),) |
@@ -20,6 +28,8 @@ ip_nat_h323-objs := ip_nat_helper_h323.o | |||
20 | 28 | ||
21 | # connection tracking | 29 | # connection tracking |
22 | obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o | 30 | obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o |
31 | obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o | ||
32 | |||
23 | obj-$(CONFIG_IP_NF_NAT) += ip_nat.o | 33 | obj-$(CONFIG_IP_NF_NAT) += ip_nat.o |
24 | obj-$(CONFIG_NF_NAT) += nf_nat.o | 34 | obj-$(CONFIG_NF_NAT) += nf_nat.o |
25 | 35 | ||
@@ -106,13 +116,3 @@ obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o | |||
106 | 116 | ||
107 | obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o | 117 | obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o |
108 | 118 | ||
109 | # objects for l3 independent conntrack | ||
110 | nf_conntrack_ipv4-objs := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o | ||
111 | ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y) | ||
112 | ifeq ($(CONFIG_PROC_FS),y) | ||
113 | nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o | ||
114 | endif | ||
115 | endif | ||
116 | |||
117 | # l3 independent conntrack | ||
118 | obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o | ||
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c index 0ae45b79a4eb..5df4fcae3ab6 100644 --- a/net/ipv4/netfilter/nf_nat_pptp.c +++ b/net/ipv4/netfilter/nf_nat_pptp.c | |||
@@ -72,9 +72,9 @@ static void pptp_nat_expected(struct nf_conn *ct, | |||
72 | DEBUGP("we are PAC->PNS\n"); | 72 | DEBUGP("we are PAC->PNS\n"); |
73 | /* build tuple for PNS->PAC */ | 73 | /* build tuple for PNS->PAC */ |
74 | t.src.l3num = AF_INET; | 74 | t.src.l3num = AF_INET; |
75 | t.src.u3.ip = master->tuplehash[exp->dir].tuple.src.u3.ip; | 75 | t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip; |
76 | t.src.u.gre.key = nat_pptp_info->pns_call_id; | 76 | t.src.u.gre.key = nat_pptp_info->pns_call_id; |
77 | t.dst.u3.ip = master->tuplehash[exp->dir].tuple.dst.u3.ip; | 77 | t.dst.u3.ip = master->tuplehash[!exp->dir].tuple.dst.u3.ip; |
78 | t.dst.u.gre.key = nat_pptp_info->pac_call_id; | 78 | t.dst.u.gre.key = nat_pptp_info->pac_call_id; |
79 | t.dst.protonum = IPPROTO_GRE; | 79 | t.dst.protonum = IPPROTO_GRE; |
80 | } | 80 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 5c16e24a6061..c26076fb890e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1011,10 +1011,11 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1011 | for (j = 0; j < i; j++){ | 1011 | for (j = 0; j < i; j++){ |
1012 | if (after(ntohl(sp[j].start_seq), | 1012 | if (after(ntohl(sp[j].start_seq), |
1013 | ntohl(sp[j+1].start_seq))){ | 1013 | ntohl(sp[j+1].start_seq))){ |
1014 | sp[j].start_seq = htonl(tp->recv_sack_cache[j+1].start_seq); | 1014 | struct tcp_sack_block_wire tmp; |
1015 | sp[j].end_seq = htonl(tp->recv_sack_cache[j+1].end_seq); | 1015 | |
1016 | sp[j+1].start_seq = htonl(tp->recv_sack_cache[j].start_seq); | 1016 | tmp = sp[j]; |
1017 | sp[j+1].end_seq = htonl(tp->recv_sack_cache[j].end_seq); | 1017 | sp[j] = sp[j+1]; |
1018 | sp[j+1] = tmp; | ||
1018 | } | 1019 | } |
1019 | 1020 | ||
1020 | } | 1021 | } |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 23e32c806916..975f4472af29 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -467,6 +467,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
467 | 467 | ||
468 | th = (struct tcphdr *) skb_push(skb, tcp_header_size); | 468 | th = (struct tcphdr *) skb_push(skb, tcp_header_size); |
469 | skb->h.th = th; | 469 | skb->h.th = th; |
470 | skb_set_owner_w(skb, sk); | ||
470 | 471 | ||
471 | /* Build TCP header and checksum it. */ | 472 | /* Build TCP header and checksum it. */ |
472 | th->source = inet->sport; | 473 | th->source = inet->sport; |
@@ -540,7 +541,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
540 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) | 541 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
541 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 542 | TCP_INC_STATS(TCP_MIB_OUTSEGS); |
542 | 543 | ||
543 | err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0); | 544 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
544 | if (likely(err <= 0)) | 545 | if (likely(err <= 0)) |
545 | return err; | 546 | return err; |
546 | 547 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index c700302ad51a..116f94a49071 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -139,8 +139,9 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr) | |||
139 | 139 | ||
140 | EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); | 140 | EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); |
141 | 141 | ||
142 | int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok) | 142 | int inet6_csk_xmit(struct sk_buff *skb, int ipfragok) |
143 | { | 143 | { |
144 | struct sock *sk = skb->sk; | ||
144 | struct inet_sock *inet = inet_sk(sk); | 145 | struct inet_sock *inet = inet_sk(sk); |
145 | struct ipv6_pinfo *np = inet6_sk(sk); | 146 | struct ipv6_pinfo *np = inet6_sk(sk); |
146 | struct flowi fl; | 147 | struct flowi fl; |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index f0ff00e0d052..c59df3bc2bbd 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
@@ -113,7 +113,7 @@ static void pptp_expectfn(struct nf_conn *ct, | |||
113 | 113 | ||
114 | rcu_read_lock(); | 114 | rcu_read_lock(); |
115 | nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); | 115 | nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); |
116 | if (nf_nat_pptp_expectfn && ct->status & IPS_NAT_MASK) | 116 | if (nf_nat_pptp_expectfn && ct->master->status & IPS_NAT_MASK) |
117 | nf_nat_pptp_expectfn(ct, exp); | 117 | nf_nat_pptp_expectfn(ct, exp); |
118 | else { | 118 | else { |
119 | struct nf_conntrack_tuple inv_t; | 119 | struct nf_conntrack_tuple inv_t; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index da73e8a8c18d..6dc01bdeb76b 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -359,6 +359,10 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
359 | if (dev == NULL) | 359 | if (dev == NULL) |
360 | goto out_unlock; | 360 | goto out_unlock; |
361 | 361 | ||
362 | err = -ENETDOWN; | ||
363 | if (!(dev->flags & IFF_UP)) | ||
364 | goto out_unlock; | ||
365 | |||
362 | /* | 366 | /* |
363 | * You may not queue a frame bigger than the mtu. This is the lowest level | 367 | * You may not queue a frame bigger than the mtu. This is the lowest level |
364 | * raw protocol and you must do your own fragmentation at this level. | 368 | * raw protocol and you must do your own fragmentation at this level. |
@@ -407,10 +411,6 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
407 | if (err) | 411 | if (err) |
408 | goto out_free; | 412 | goto out_free; |
409 | 413 | ||
410 | err = -ENETDOWN; | ||
411 | if (!(dev->flags & IFF_UP)) | ||
412 | goto out_free; | ||
413 | |||
414 | /* | 414 | /* |
415 | * Now send it | 415 | * Now send it |
416 | */ | 416 | */ |
@@ -428,24 +428,18 @@ out_unlock: | |||
428 | } | 428 | } |
429 | #endif | 429 | #endif |
430 | 430 | ||
431 | static inline int run_filter(struct sk_buff *skb, struct sock *sk, | 431 | static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, |
432 | unsigned *snaplen) | 432 | unsigned int res) |
433 | { | 433 | { |
434 | struct sk_filter *filter; | 434 | struct sk_filter *filter; |
435 | int err = 0; | ||
436 | 435 | ||
437 | rcu_read_lock_bh(); | 436 | rcu_read_lock_bh(); |
438 | filter = rcu_dereference(sk->sk_filter); | 437 | filter = rcu_dereference(sk->sk_filter); |
439 | if (filter != NULL) { | 438 | if (filter != NULL) |
440 | err = sk_run_filter(skb, filter->insns, filter->len); | 439 | res = sk_run_filter(skb, filter->insns, filter->len); |
441 | if (!err) | ||
442 | err = -EPERM; | ||
443 | else if (*snaplen > err) | ||
444 | *snaplen = err; | ||
445 | } | ||
446 | rcu_read_unlock_bh(); | 440 | rcu_read_unlock_bh(); |
447 | 441 | ||
448 | return err; | 442 | return res; |
449 | } | 443 | } |
450 | 444 | ||
451 | /* | 445 | /* |
@@ -467,7 +461,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
467 | struct packet_sock *po; | 461 | struct packet_sock *po; |
468 | u8 * skb_head = skb->data; | 462 | u8 * skb_head = skb->data; |
469 | int skb_len = skb->len; | 463 | int skb_len = skb->len; |
470 | unsigned snaplen; | 464 | unsigned int snaplen, res; |
471 | 465 | ||
472 | if (skb->pkt_type == PACKET_LOOPBACK) | 466 | if (skb->pkt_type == PACKET_LOOPBACK) |
473 | goto drop; | 467 | goto drop; |
@@ -495,8 +489,11 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
495 | 489 | ||
496 | snaplen = skb->len; | 490 | snaplen = skb->len; |
497 | 491 | ||
498 | if (run_filter(skb, sk, &snaplen) < 0) | 492 | res = run_filter(skb, sk, snaplen); |
493 | if (!res) | ||
499 | goto drop_n_restore; | 494 | goto drop_n_restore; |
495 | if (snaplen > res) | ||
496 | snaplen = res; | ||
500 | 497 | ||
501 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 498 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
502 | (unsigned)sk->sk_rcvbuf) | 499 | (unsigned)sk->sk_rcvbuf) |
@@ -568,7 +565,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
568 | struct tpacket_hdr *h; | 565 | struct tpacket_hdr *h; |
569 | u8 * skb_head = skb->data; | 566 | u8 * skb_head = skb->data; |
570 | int skb_len = skb->len; | 567 | int skb_len = skb->len; |
571 | unsigned snaplen; | 568 | unsigned int snaplen, res; |
572 | unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; | 569 | unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; |
573 | unsigned short macoff, netoff; | 570 | unsigned short macoff, netoff; |
574 | struct sk_buff *copy_skb = NULL; | 571 | struct sk_buff *copy_skb = NULL; |
@@ -592,8 +589,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
592 | 589 | ||
593 | snaplen = skb->len; | 590 | snaplen = skb->len; |
594 | 591 | ||
595 | if (run_filter(skb, sk, &snaplen) < 0) | 592 | res = run_filter(skb, sk, snaplen); |
593 | if (!res) | ||
596 | goto drop_n_restore; | 594 | goto drop_n_restore; |
595 | if (snaplen > res) | ||
596 | snaplen = res; | ||
597 | 597 | ||
598 | if (sk->sk_type == SOCK_DGRAM) { | 598 | if (sk->sk_type == SOCK_DGRAM) { |
599 | macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; | 599 | macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; |
@@ -738,6 +738,10 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
738 | if (sock->type == SOCK_RAW) | 738 | if (sock->type == SOCK_RAW) |
739 | reserve = dev->hard_header_len; | 739 | reserve = dev->hard_header_len; |
740 | 740 | ||
741 | err = -ENETDOWN; | ||
742 | if (!(dev->flags & IFF_UP)) | ||
743 | goto out_unlock; | ||
744 | |||
741 | err = -EMSGSIZE; | 745 | err = -EMSGSIZE; |
742 | if (len > dev->mtu+reserve) | 746 | if (len > dev->mtu+reserve) |
743 | goto out_unlock; | 747 | goto out_unlock; |
@@ -770,10 +774,6 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
770 | skb->dev = dev; | 774 | skb->dev = dev; |
771 | skb->priority = sk->sk_priority; | 775 | skb->priority = sk->sk_priority; |
772 | 776 | ||
773 | err = -ENETDOWN; | ||
774 | if (!(dev->flags & IFF_UP)) | ||
775 | goto out_free; | ||
776 | |||
777 | /* | 777 | /* |
778 | * Now send it | 778 | * Now send it |
779 | */ | 779 | */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 225f39b5d595..0ef48126b117 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -804,7 +804,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
804 | NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); | 804 | NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); |
805 | 805 | ||
806 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); | 806 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); |
807 | return ip_queue_xmit(skb, skb->sk, ipfragok); | 807 | return ip_queue_xmit(skb, ipfragok); |
808 | } | 808 | } |
809 | 809 | ||
810 | static struct sctp_af sctp_ipv4_specific; | 810 | static struct sctp_af sctp_ipv4_specific; |