aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-13 21:20:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-13 21:20:16 -0400
commit2918cd81f58aa9748acf961240c006394f474047 (patch)
treec50c63a99c70766d83c561d018ffe29b775c0e53
parent8a065975c1c00d1ab3293c1adf6f89988bb1b03b (diff)
parent49688c843101ba6275756505e81af45ef50f87d7 (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] arp_tables: Fix unaligned accesses. [IPV6] SNMP: Fix {In,Out}NoRoutes statistics. [IPSEC] XFRM_USER: kernel panic when large security contexts in ACQUIRE [VLAN]: Allow VLAN interface on top of bridge interface [PKTGEN]: Add try_to_freeze() [NETFILTER]: ipt_ULOG: use put_unaligned
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/core/pktgen.c3
-rw-r--r--net/ipv4/netfilter/arp_tables.c10
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c7
-rw-r--r--net/ipv6/route.c31
-rw-r--r--net/xfrm/xfrm_user.c7
6 files changed, 36 insertions, 25 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 2fc8fe2cb366..b6e0eea1e39e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -380,6 +380,9 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
380 } else { 380 } else {
381 vhdr->h_vlan_encapsulated_proto = htons(len); 381 vhdr->h_vlan_encapsulated_proto = htons(len);
382 } 382 }
383
384 skb->protocol = htons(ETH_P_8021Q);
385 skb->nh.raw = skb->data;
383 } 386 }
384 387
385 /* Before delegating work to the lower layer, enter our MAC-address */ 388 /* Before delegating work to the lower layer, enter our MAC-address */
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 74a9a32b906d..4b01496dc33d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -129,6 +129,7 @@
129#include <linux/ioport.h> 129#include <linux/ioport.h>
130#include <linux/interrupt.h> 130#include <linux/interrupt.h>
131#include <linux/capability.h> 131#include <linux/capability.h>
132#include <linux/freezer.h>
132#include <linux/delay.h> 133#include <linux/delay.h>
133#include <linux/timer.h> 134#include <linux/timer.h>
134#include <linux/list.h> 135#include <linux/list.h>
@@ -3333,6 +3334,8 @@ static int pktgen_thread_worker(void *arg)
3333 t->control &= ~(T_REMDEV); 3334 t->control &= ~(T_REMDEV);
3334 } 3335 }
3335 3336
3337 try_to_freeze();
3338
3336 set_current_state(TASK_INTERRUPTIBLE); 3339 set_current_state(TASK_INTERRUPTIBLE);
3337 } 3340 }
3338 3341
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 5170f5c75f9d..57b0221f9e24 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -166,13 +166,9 @@ static inline int arp_packet_match(const struct arphdr *arphdr,
166 return 0; 166 return 0;
167 } 167 }
168 168
169 for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { 169 for (i = 0, ret = 0; i < IFNAMSIZ; i++) {
170 unsigned long odev; 170 ret |= (outdev[i] ^ arpinfo->outiface[i])
171 memcpy(&odev, outdev + i*sizeof(unsigned long), 171 & arpinfo->outiface_mask[i];
172 sizeof(unsigned long));
173 ret |= (odev
174 ^ ((const unsigned long *)arpinfo->outiface)[i])
175 & ((const unsigned long *)arpinfo->outiface_mask)[i];
176 } 172 }
177 173
178 if (FWINV(ret != 0, ARPT_INV_VIA_OUT)) { 174 if (FWINV(ret != 0, ARPT_INV_VIA_OUT)) {
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index a26404dbe212..9acc018766f2 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -61,6 +61,7 @@
61#include <linux/netfilter_ipv4/ipt_ULOG.h> 61#include <linux/netfilter_ipv4/ipt_ULOG.h>
62#include <net/sock.h> 62#include <net/sock.h>
63#include <linux/bitops.h> 63#include <linux/bitops.h>
64#include <asm/unaligned.h>
64 65
65MODULE_LICENSE("GPL"); 66MODULE_LICENSE("GPL");
66MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); 67MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
@@ -236,9 +237,9 @@ static void ipt_ulog_packet(unsigned int hooknum,
236 237
237 /* copy hook, prefix, timestamp, payload, etc. */ 238 /* copy hook, prefix, timestamp, payload, etc. */
238 pm->data_len = copy_len; 239 pm->data_len = copy_len;
239 pm->timestamp_sec = skb->tstamp.off_sec; 240 put_unaligned(skb->tstamp.off_sec, &pm->timestamp_sec);
240 pm->timestamp_usec = skb->tstamp.off_usec; 241 put_unaligned(skb->tstamp.off_usec, &pm->timestamp_usec);
241 pm->mark = skb->mark; 242 put_unaligned(skb->mark, &pm->mark);
242 pm->hook = hooknum; 243 pm->hook = hooknum;
243 if (prefix != NULL) 244 if (prefix != NULL)
244 strncpy(pm->prefix, prefix, sizeof(pm->prefix)); 245 strncpy(pm->prefix, prefix, sizeof(pm->prefix));
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad9b285692ba..aebb4e2d5ae3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1766,13 +1766,22 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
1766 * Drop the packet on the floor 1766 * Drop the packet on the floor
1767 */ 1767 */
1768 1768
1769static inline int ip6_pkt_drop(struct sk_buff *skb, int code) 1769static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
1770{ 1770 int ipstats_mib_noroutes)
1771 int type = ipv6_addr_type(&skb->nh.ipv6h->daddr); 1771{
1772 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) 1772 int type;
1773 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); 1773 switch (ipstats_mib_noroutes) {
1774 1774 case IPSTATS_MIB_INNOROUTES:
1775 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_OUTNOROUTES); 1775 type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
1776 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
1777 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
1778 break;
1779 }
1780 /* FALLTHROUGH */
1781 case IPSTATS_MIB_OUTNOROUTES:
1782 IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes);
1783 break;
1784 }
1776 icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); 1785 icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
1777 kfree_skb(skb); 1786 kfree_skb(skb);
1778 return 0; 1787 return 0;
@@ -1780,26 +1789,26 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code)
1780 1789
1781static int ip6_pkt_discard(struct sk_buff *skb) 1790static int ip6_pkt_discard(struct sk_buff *skb)
1782{ 1791{
1783 return ip6_pkt_drop(skb, ICMPV6_NOROUTE); 1792 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES);
1784} 1793}
1785 1794
1786static int ip6_pkt_discard_out(struct sk_buff *skb) 1795static int ip6_pkt_discard_out(struct sk_buff *skb)
1787{ 1796{
1788 skb->dev = skb->dst->dev; 1797 skb->dev = skb->dst->dev;
1789 return ip6_pkt_discard(skb); 1798 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
1790} 1799}
1791 1800
1792#ifdef CONFIG_IPV6_MULTIPLE_TABLES 1801#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1793 1802
1794static int ip6_pkt_prohibit(struct sk_buff *skb) 1803static int ip6_pkt_prohibit(struct sk_buff *skb)
1795{ 1804{
1796 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED); 1805 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);
1797} 1806}
1798 1807
1799static int ip6_pkt_prohibit_out(struct sk_buff *skb) 1808static int ip6_pkt_prohibit_out(struct sk_buff *skb)
1800{ 1809{
1801 skb->dev = skb->dst->dev; 1810 skb->dev = skb->dst->dev;
1802 return ip6_pkt_prohibit(skb); 1811 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
1803} 1812}
1804 1813
1805static int ip6_pkt_blk_hole(struct sk_buff *skb) 1814static int ip6_pkt_blk_hole(struct sk_buff *skb)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index e81e2fb3d429..816e3690b60f 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -272,9 +272,8 @@ static int attach_encap_tmpl(struct xfrm_encap_tmpl **encapp, struct rtattr *u_a
272} 272}
273 273
274 274
275static inline int xfrm_user_sec_ctx_size(struct xfrm_policy *xp) 275static inline int xfrm_user_sec_ctx_size(struct xfrm_sec_ctx *xfrm_ctx)
276{ 276{
277 struct xfrm_sec_ctx *xfrm_ctx = xp->security;
278 int len = 0; 277 int len = 0;
279 278
280 if (xfrm_ctx) { 279 if (xfrm_ctx) {
@@ -2170,7 +2169,7 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt,
2170 2169
2171 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); 2170 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
2172 len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire)); 2171 len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire));
2173 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); 2172 len += RTA_SPACE(xfrm_user_sec_ctx_size(x->security));
2174#ifdef CONFIG_XFRM_SUB_POLICY 2173#ifdef CONFIG_XFRM_SUB_POLICY
2175 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); 2174 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2176#endif 2175#endif
@@ -2280,7 +2279,7 @@ static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, struct km_eve
2280 2279
2281 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); 2280 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
2282 len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); 2281 len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire));
2283 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); 2282 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp->security));
2284#ifdef CONFIG_XFRM_SUB_POLICY 2283#ifdef CONFIG_XFRM_SUB_POLICY
2285 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); 2284 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2286#endif 2285#endif