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 | |
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
-rw-r--r-- | drivers/net/bnx2.c | 12 | ||||
-rw-r--r-- | include/net/inet6_connection_sock.h | 2 | ||||
-rw-r--r-- | include/net/inet_connection_sock.h | 3 | ||||
-rw-r--r-- | include/net/ip.h | 2 | ||||
-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 |
16 files changed, 85 insertions, 62 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index ca5acc4736d..953808efe55 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -57,8 +57,8 @@ | |||
57 | 57 | ||
58 | #define DRV_MODULE_NAME "bnx2" | 58 | #define DRV_MODULE_NAME "bnx2" |
59 | #define PFX DRV_MODULE_NAME ": " | 59 | #define PFX DRV_MODULE_NAME ": " |
60 | #define DRV_MODULE_VERSION "1.5.3" | 60 | #define DRV_MODULE_VERSION "1.5.4" |
61 | #define DRV_MODULE_RELDATE "January 8, 2007" | 61 | #define DRV_MODULE_RELDATE "January 24, 2007" |
62 | 62 | ||
63 | #define RUN_AT(x) (jiffies + (x)) | 63 | #define RUN_AT(x) (jiffies + (x)) |
64 | 64 | ||
@@ -5845,9 +5845,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5845 | reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); | 5845 | reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); |
5846 | 5846 | ||
5847 | if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == | 5847 | if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == |
5848 | BNX2_SHM_HDR_SIGNATURE_SIG) | 5848 | BNX2_SHM_HDR_SIGNATURE_SIG) { |
5849 | bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0); | 5849 | u32 off = PCI_FUNC(pdev->devfn) << 2; |
5850 | else | 5850 | |
5851 | bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0 + off); | ||
5852 | } else | ||
5851 | bp->shmem_base = HOST_VIEW_SHMEM_BASE; | 5853 | bp->shmem_base = HOST_VIEW_SHMEM_BASE; |
5852 | 5854 | ||
5853 | /* Get the permanent MAC address. First we need to make sure the | 5855 | /* Get the permanent MAC address. First we need to make sure the |
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h index 16aa96a6a53..f13ddc2543b 100644 --- a/include/net/inet6_connection_sock.h +++ b/include/net/inet6_connection_sock.h | |||
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, | |||
38 | 38 | ||
39 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); | 39 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); |
40 | 40 | ||
41 | extern int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok); | 41 | extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); |
42 | #endif /* _INET6_CONNECTION_SOCK_H */ | 42 | #endif /* _INET6_CONNECTION_SOCK_H */ |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index bf16d98d372..133cf30d2d7 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -37,8 +37,7 @@ struct tcp_congestion_ops; | |||
37 | * (i.e. things that depend on the address family) | 37 | * (i.e. things that depend on the address family) |
38 | */ | 38 | */ |
39 | struct inet_connection_sock_af_ops { | 39 | struct inet_connection_sock_af_ops { |
40 | int (*queue_xmit)(struct sk_buff *skb, struct sock *sk, | 40 | int (*queue_xmit)(struct sk_buff *skb, int ipfragok); |
41 | int ipfragok); | ||
42 | void (*send_check)(struct sock *sk, int len, | 41 | void (*send_check)(struct sock *sk, int len, |
43 | struct sk_buff *skb); | 42 | struct sk_buff *skb); |
44 | int (*rebuild_header)(struct sock *sk); | 43 | int (*rebuild_header)(struct sock *sk); |
diff --git a/include/net/ip.h b/include/net/ip.h index 053f02b5cb8..e79c3e3aa4f 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -97,7 +97,7 @@ extern int ip_mc_output(struct sk_buff *skb); | |||
97 | extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 97 | extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); |
98 | extern int ip_do_nat(struct sk_buff *skb); | 98 | extern int ip_do_nat(struct sk_buff *skb); |
99 | extern void ip_send_check(struct iphdr *ip); | 99 | extern void ip_send_check(struct iphdr *ip); |
100 | extern int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok); | 100 | extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); |
101 | extern void ip_init(void); | 101 | extern void ip_init(void); |
102 | extern int ip_append_data(struct sock *sk, | 102 | extern int ip_append_data(struct sock *sk, |
103 | int getfrag(void *from, char *to, int offset, int len, | 103 | int getfrag(void *from, char *to, int offset, int len, |
diff --git a/net/dccp/output.c b/net/dccp/output.c index 82456965908..3435542e965 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 fc6f3c023a5..ed083ab455b 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 cfb249cc0a5..13307c04d5a 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 f071f84808f..a0f2008584b 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 15e741aeb29..16d177b71bf 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 0ae45b79a4e..5df4fcae3ab 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 5c16e24a606..c26076fb890 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 23e32c80691..975f4472af2 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 c700302ad51..116f94a4907 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 f0ff00e0d05..c59df3bc2bb 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 da73e8a8c18..6dc01bdeb76 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 225f39b5d59..0ef48126b11 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; |