Skip to contentSkip to conversation

Open vSwitch

GIT PULL New Jesse Gross 4 participants 11 messages Dec 3, 2011 – Dec 6, 2011 3 messages not in the archive

Subsystems (9)
lore
Share & tools
lore
#2 lore raw

PATCH v3 1/6 genetlink: Add genl_notify()

In reply to a message not in the archive

From: Pravin B Shelar <[email protected]>

Open vSwitch uses Generic Netlink interface for communication between userspace and kernel module. genl_notify() is used for sending notification back to userspace.

genl_notify() is analogous to rtnl_notify() but uses genl_sock instead of rtnl.

---
v2/v3: Unchanged.

---
 include/net/genetlink.h |    2 ++
 net/netlink/genetlink.c |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
include/net/genetlink.h +2 -0
index 82d8d09..7db3299 100644
@@ -128,6 +128,8 @@ extern int genl_register_mc_group(struct genl_family *family,
 				  struct genl_multicast_group *grp);
 extern void genl_unregister_mc_group(struct genl_family *family,
 				     struct genl_multicast_group *grp);
+extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
+			u32 group, struct nlmsghdr *nlh, gfp_t flags);
 
 /**
  * genlmsg_put - Add generic netlink header to netlink message
net/netlink/genetlink.c +13 -0
index 482fa57..8a36599 100644
@@ -946,3 +946,16 @@ int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, unsigned int group,
 	return genlmsg_mcast(skb, pid, group, flags);
 }
 EXPORT_SYMBOL(genlmsg_multicast_allns);
+
+void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
+		 struct nlmsghdr *nlh, gfp_t flags)
+{
+	struct sock *sk = net->genl_sock;
+	int report = 0;
+
+	if (nlh)
+		report = nlmsg_report(nlh);
+
+	nlmsg_notify(sk, skb, pid, group, report, flags);
+}
+EXPORT_SYMBOL(genl_notify);
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH v3 2/6 genetlink: Add lockdep_genl_is_held().

In reply to a message not in the archive

From: Pravin B Shelar <[email protected]>

Open vSwitch uses genl_mutex locking to protect datapath data-structures like flow-table, flow-actions. Following patch adds lockdep_genl_is_held() which is used for rcu annotation to prove locking.

---
v2/v3: Unchanged.

---
 include/linux/genetlink.h |    3 +++
 net/netlink/genetlink.c   |    8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
include/linux/genetlink.h +3 -0
index 61549b2..59311ad 100644
@@ -85,6 +85,9 @@ enum {
 /* All generic netlink requests are serialized by a global lock.  */
 extern void genl_lock(void);
 extern void genl_unlock(void);
+#ifdef CONFIG_PROVE_LOCKING
+extern int lockdep_genl_is_held(void);
+#endif
 
 #endif /* __KERNEL__ */
 
net/netlink/genetlink.c +8 -0
index 8a36599..28453ae 100644
@@ -33,6 +33,14 @@ void genl_unlock(void)
 }
 EXPORT_SYMBOL(genl_unlock);
 
+#ifdef CONFIG_PROVE_LOCKING
+int lockdep_genl_is_held(void)
+{
+	return lockdep_is_held(&genl_mutex);
+}
+EXPORT_SYMBOL(lockdep_genl_is_held);
+#endif
+
 #define GENL_FAM_TAB_SIZE	16
 #define GENL_FAM_TAB_MASK	(GENL_FAM_TAB_SIZE - 1)
 
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v3 3/6 genetlink: Add rcu_dereference_genl and genl_dereference.

In reply to a message not in the archive

This adds rcu_dereference_genl and genl_dereference, which are genl variants of the RTNL functions to enforce proper locking with lockdep and sparse.

---
v3: Unchanged.
v2: New patch.

---
 include/linux/genetlink.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
include/linux/genetlink.h +21 -0
index 59311ad..73c28de 100644
@@ -89,6 +89,27 @@ extern void genl_unlock(void);
 extern int lockdep_genl_is_held(void);
 #endif
 
+/**
+ * rcu_dereference_genl - rcu_dereference with debug checking
+ * @p: The pointer to read, prior to dereferencing
+ *
+ * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
+ * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
+ */
+#define rcu_dereference_genl(p)					\
+	rcu_dereference_check(p, lockdep_genl_is_held())
+
+/**
+ * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
+ * @p: The pointer to read, prior to dereferencing
+ *
+ * Return the value of the specified RCU-protected pointer, but omit
+ * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
+ * caller holds genl mutex.
+ */
+#define genl_dereference(p)					\
+	rcu_dereference_protected(p, lockdep_genl_is_held())
+
 #endif /* __KERNEL__ */
 
 #endif	/* __LINUX_GENERIC_NETLINK_H */
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH v3 4/6 vlan: Move vlan_set_encap_proto() to vlan header file

In reply to a message not in the archive

From: Pravin B Shelar <[email protected]>

Open vSwitch needs this function for vlan handling.

---
v2/v3: Unchanged.

---
 include/linux/if_vlan.h |   34 ++++++++++++++++++++++++++++++++++
 net/8021q/vlan_core.c   |   33 ---------------------------------
 2 files changed, 34 insertions(+), 33 deletions(-)
include/linux/if_vlan.h +34 -0
index 12d5543..070ac50 100644
@@ -310,6 +310,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
 
 	return protocol;
 }
+
+static inline void vlan_set_encap_proto(struct sk_buff *skb,
+					struct vlan_hdr *vhdr)
+{
+	__be16 proto;
+	unsigned char *rawp;
+
+	/*
+	 * Was a VLAN packet, grab the encapsulated protocol, which the layer
+	 * three protocols care about.
+	 */
+
+	proto = vhdr->h_vlan_encapsulated_proto;
+	if (ntohs(proto) >= 1536) {
+		skb->protocol = proto;
+		return;
+	}
+
+	rawp = skb->data;
+	if (*(unsigned short *) rawp == 0xFFFF)
+		/*
+		 * This is a magic hack to spot IPX packets. Older Novell
+		 * breaks the protocol design and runs IPX over 802.3 without
+		 * an 802.2 LLC layer. We look for FFFF which isn't a used
+		 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
+		 * but does for the rest.
+		 */
+		skb->protocol = htons(ETH_P_802_3);
+	else
+		/*
+		 * Real 802.2 LLC
+		 */
+		skb->protocol = htons(ETH_P_802_2);
+}
 #endif /* __KERNEL__ */
 
 /* VLAN IOCTLs are found in sockios.h */
net/8021q/vlan_core.c +0 -33
index f5ffc02..9c95e8e 100644
@@ -110,39 +110,6 @@ static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
 	return skb;
 }
 
-static void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
-{
-	__be16 proto;
-	unsigned char *rawp;
-
-	/*
-	 * Was a VLAN packet, grab the encapsulated protocol, which the layer
-	 * three protocols care about.
-	 */
-
-	proto = vhdr->h_vlan_encapsulated_proto;
-	if (ntohs(proto) >= 1536) {
-		skb->protocol = proto;
-		return;
-	}
-
-	rawp = skb->data;
-	if (*(unsigned short *) rawp == 0xFFFF)
-		/*
-		 * This is a magic hack to spot IPX packets. Older Novell
-		 * breaks the protocol design and runs IPX over 802.3 without
-		 * an 802.2 LLC layer. We look for FFFF which isn't a used
-		 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
-		 * but does for the rest.
-		 */
-		skb->protocol = htons(ETH_P_802_3);
-	else
-		/*
-		 * Real 802.2 LLC
-		 */
-		skb->protocol = htons(ETH_P_802_2);
-}
-
 struct sk_buff *vlan_untag(struct sk_buff *skb)
 {
 	struct vlan_hdr *vhdr;
Signature · 1 line
1.7.5.4
#6 lore raw

PATCH v3 5/6 ipv6: Add fragment reporting to ipv6_skip_exthdr().

In reply to a message not in the archive

While parsing through IPv6 extension headers, fragment headers are skipped making them invisible to the caller. This reports the fragment offset of the last header in order to make it possible to determine whether the packet is fragmented and, if so whether it is a first or last fragment.

---
v3: New patch.

---
 include/net/ipv6.h                   |    2 +-
 net/bridge/br_multicast.c            |    3 ++-
 net/bridge/netfilter/ebt_ip6.c       |    3 ++-
 net/bridge/netfilter/ebt_log.c       |    3 ++-
 net/ipv6/exthdrs_core.c              |   11 +++++++++--
 net/ipv6/icmp.c                      |    7 +++++--
 net/ipv6/ip6_input.c                 |    3 ++-
 net/ipv6/ip6_output.c                |    3 ++-
 net/ipv6/netfilter/ip6t_REJECT.c     |    3 ++-
 net/netfilter/ipset/ip_set_getport.c |    4 +++-
 net/netfilter/xt_AUDIT.c             |    3 ++-
 net/netfilter/xt_TCPMSS.c            |    3 ++-
 net/netfilter/xt_TCPOPTSTRIP.c       |    3 ++-
 net/netfilter/xt_hashlimit.c         |    3 ++-
 net/netfilter/xt_socket.c            |    4 +++-
 security/lsm_audit.c                 |    3 ++-
 security/selinux/hooks.c             |    3 ++-
 17 files changed, 45 insertions(+), 19 deletions(-)
include/net/ipv6.h +1 -1
index f35188e..e4170a2 100644
@@ -558,7 +558,7 @@ extern void			ipv6_push_frag_opts(struct sk_buff *skb,
 						    u8 *proto);
 
 extern int			ipv6_skip_exthdr(const struct sk_buff *, int start,
-					         u8 *nexthdrp);
+					         u8 *nexthdrp, __be16 *frag_offp);
 
 extern int 			ipv6_ext_hdr(u8 nexthdr);
 
net/bridge/br_multicast.c +2 -1
index 7743e0d..375417e 100644
@@ -1458,6 +1458,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
 	const struct ipv6hdr *ip6h;
 	u8 icmp6_type;
 	u8 nexthdr;
+	__be16 frag_off;
 	unsigned len;
 	int offset;
 	int err;
@@ -1483,7 +1484,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
 		return -EINVAL;
 
 	nexthdr = ip6h->nexthdr;
-	offset = ipv6_skip_exthdr(skb, sizeof(*ip6h), &nexthdr);
+	offset = ipv6_skip_exthdr(skb, sizeof(*ip6h), &nexthdr, &frag_off);
 
 	if (offset < 0 || nexthdr != IPPROTO_ICMPV6)
 		return 0;
net/bridge/netfilter/ebt_ip6.c +2 -1
index 2ed0056..99c8566 100644
@@ -55,9 +55,10 @@ ebt_ip6_mt(const struct sk_buff *skb, struct xt_action_param *par)
 		return false;
 	if (info->bitmask & EBT_IP6_PROTO) {
 		uint8_t nexthdr = ih6->nexthdr;
+		__be16 frag_off;
 		int offset_ph;
 
-		offset_ph = ipv6_skip_exthdr(skb, sizeof(_ip6h), &nexthdr);
+		offset_ph = ipv6_skip_exthdr(skb, sizeof(_ip6h), &nexthdr, &frag_off);
 		if (offset_ph == -1)
 			return false;
 		if (FWINV(info->protocol != nexthdr, EBT_IP6_PROTO))
net/bridge/netfilter/ebt_log.c +2 -1
index 6e5a8bb..88d7d1d 100644
@@ -113,6 +113,7 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
 		const struct ipv6hdr *ih;
 		struct ipv6hdr _iph;
 		uint8_t nexthdr;
+		__be16 frag_off;
 		int offset_ph;
 
 		ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
@@ -123,7 +124,7 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
 		printk(" IPv6 SRC=%pI6 IPv6 DST=%pI6, IPv6 priority=0x%01X, Next Header=%d",
 		       &ih->saddr, &ih->daddr, ih->priority, ih->nexthdr);
 		nexthdr = ih->nexthdr;
-		offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr);
+		offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr, &frag_off);
 		if (offset_ph == -1)
 			goto out;
 		print_ports(skb, nexthdr, offset_ph);
net/ipv6/exthdrs_core.c +9 -2
index 37f548b..72957f4 100644
@@ -57,6 +57,9 @@ int ipv6_ext_hdr(u8 nexthdr)
  *	    it returns NULL.
  *	  - First fragment header is skipped, not-first ones
  *	    are considered as unparsable.
+ *	  - Reports the offset field of the final fragment header so it is
+ *	    possible to tell whether this is a first fragment, later fragment,
+ *	    or not fragmented.
  *	  - ESP is unparsable for now and considered like
  *	    normal payload protocol.
  *	  - Note also special handling of AUTH header. Thanks to IPsec wizards.
@@ -64,10 +67,13 @@ int ipv6_ext_hdr(u8 nexthdr)
  * --ANK (980726)
  */
 
-int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp)
+int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,
+		     __be16 *frag_offp)
 {
 	u8 nexthdr = *nexthdrp;
 
+	*frag_offp = 0;
+
 	while (ipv6_ext_hdr(nexthdr)) {
 		struct ipv6_opt_hdr _hdr, *hp;
 		int hdrlen;
@@ -87,7 +93,8 @@ int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp)
 			if (fp == NULL)
 				return -1;
 
-			if (ntohs(*fp) & ~0x7)
+			*frag_offp = *fp;
+			if (ntohs(*frag_offp) & ~0x7)
 				break;
 			hdrlen = 8;
 		} else if (nexthdr == NEXTHDR_AUTH)
net/ipv6/icmp.c +5 -2
index 9e2bdcc..01d46bf 100644
@@ -135,11 +135,12 @@ static int is_ineligible(struct sk_buff *skb)
 	int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
 	int len = skb->len - ptr;
 	__u8 nexthdr = ipv6_hdr(skb)->nexthdr;
+	__be16 frag_off;
 
 	if (len < 0)
 		return 1;
 
-	ptr = ipv6_skip_exthdr(skb, ptr, &nexthdr);
+	ptr = ipv6_skip_exthdr(skb, ptr, &nexthdr, &frag_off);
 	if (ptr < 0)
 		return 0;
 	if (nexthdr == IPPROTO_ICMPV6) {
@@ -596,6 +597,7 @@ static void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info)
 	int inner_offset;
 	int hash;
 	u8 nexthdr;
+	__be16 frag_off;
 
 	if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
 		return;
@@ -603,7 +605,8 @@ static void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info)
 	nexthdr = ((struct ipv6hdr *)skb->data)->nexthdr;
 	if (ipv6_ext_hdr(nexthdr)) {
 		/* now skip over extension headers */
-		inner_offset = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
+		inner_offset = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr),
+						&nexthdr, &frag_off);
 		if (inner_offset<0)
 			return;
 	} else {
net/ipv6/ip6_input.c +2 -1
index a46c64e..1ca5d45 100644
@@ -280,6 +280,7 @@ int ip6_mc_input(struct sk_buff *skb)
 			u8 *ptr = skb_network_header(skb) + opt->ra;
 			struct icmp6hdr *icmp6;
 			u8 nexthdr = hdr->nexthdr;
+			__be16 frag_off;
 			int offset;
 
 			/* Check if the value of Router Alert
@@ -293,7 +294,7 @@ int ip6_mc_input(struct sk_buff *skb)
 					goto out;
 				}
 				offset = ipv6_skip_exthdr(skb, sizeof(*hdr),
-							  &nexthdr);
+							  &nexthdr, &frag_off);
 				if (offset < 0)
 					goto out;
 
net/ipv6/ip6_output.c +2 -1
index a24e155..3221bc6 100644
@@ -329,10 +329,11 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
 {
 	struct ipv6hdr *hdr = ipv6_hdr(skb);
 	u8 nexthdr = hdr->nexthdr;
+	__be16 frag_off;
 	int offset;
 
 	if (ipv6_ext_hdr(nexthdr)) {
-		offset = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr);
+		offset = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr, &frag_off);
 		if (offset < 0)
 			return 0;
 	} else
net/ipv6/netfilter/ip6t_REJECT.c +2 -1
index b5a2aa5..aad2fa4 100644
@@ -49,6 +49,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
 	const __u8 tclass = DEFAULT_TOS_VALUE;
 	struct dst_entry *dst = NULL;
 	u8 proto;
+	__be16 frag_off;
 	struct flowi6 fl6;
 
 	if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) ||
@@ -58,7 +59,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
 	}
 
 	proto = oip6h->nexthdr;
-	tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto);
+	tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto, &frag_off);
 
 	if ((tcphoff < 0) || (tcphoff > oldskb->len)) {
 		pr_debug("Cannot get TCP header.\n");
net/netfilter/ipset/ip_set_getport.c +3 -1
index 052579f..b71a6e7 100644
@@ -116,9 +116,11 @@ ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
 {
 	int protoff;
 	u8 nexthdr;
+	__be16 frag_off;
 
 	nexthdr = ipv6_hdr(skb)->nexthdr;
-	protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
+	protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
+				   &frag_off);
 	if (protoff < 0)
 		return false;
 
net/netfilter/xt_AUDIT.c +2 -1
index 4bca15a..ba92824 100644
@@ -98,6 +98,7 @@ static void audit_ip6(struct audit_buffer *ab, struct sk_buff *skb)
 	struct ipv6hdr _ip6h;
 	const struct ipv6hdr *ih;
 	u8 nexthdr;
+	__be16 frag_off;
 	int offset;
 
 	ih = skb_header_pointer(skb, skb_network_offset(skb), sizeof(_ip6h), &_ip6h);
@@ -108,7 +109,7 @@ static void audit_ip6(struct audit_buffer *ab, struct sk_buff *skb)
 
 	nexthdr = ih->nexthdr;
 	offset = ipv6_skip_exthdr(skb, skb_network_offset(skb) + sizeof(_ip6h),
-				  &nexthdr);
+				  &nexthdr, &frag_off);
 
 	audit_log_format(ab, " saddr=%pI6c daddr=%pI6c proto=%hhu",
 			 &ih->saddr, &ih->daddr, nexthdr);
net/netfilter/xt_TCPMSS.c +2 -1
index 3ecade3..ba72262 100644
@@ -204,11 +204,12 @@ tcpmss_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 {
 	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 	u8 nexthdr;
+	__be16 frag_off;
 	int tcphoff;
 	int ret;
 
 	nexthdr = ipv6h->nexthdr;
-	tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr);
+	tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr, &frag_off);
 	if (tcphoff < 0)
 		return NF_DROP;
 	ret = tcpmss_mangle_packet(skb, par->targinfo,
net/netfilter/xt_TCPOPTSTRIP.c +2 -1
index 9dc9ecf..3a295cc 100644
@@ -87,9 +87,10 @@ tcpoptstrip_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 	int tcphoff;
 	u_int8_t nexthdr;
+	__be16 frag_off;
 
 	nexthdr = ipv6h->nexthdr;
-	tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr);
+	tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr, &frag_off);
 	if (tcphoff < 0)
 		return NF_DROP;
 
net/netfilter/xt_hashlimit.c +2 -1
index dfd52ba..068698f 100644
@@ -445,6 +445,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
 {
 	__be16 _ports[2], *ports;
 	u8 nexthdr;
+	__be16 frag_off;
 	int poff;
 
 	memset(dst, 0, sizeof(*dst));
@@ -480,7 +481,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
 		      (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT)))
 			return 0;
 		nexthdr = ipv6_hdr(skb)->nexthdr;
-		protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
+		protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr, &frag_off);
 		if ((int)protoff < 0)
 			return -1;
 		break;
net/netfilter/xt_socket.c +3 -1
index fe39f7e..c302e30 100644
@@ -214,6 +214,7 @@ extract_icmp6_fields(const struct sk_buff *skb,
 	struct icmp6hdr *icmph, _icmph;
 	__be16 *ports, _ports[2];
 	u8 inside_nexthdr;
+	__be16 inside_fragoff;
 	int inside_hdrlen;
 
 	icmph = skb_header_pointer(skb, outside_hdrlen,
@@ -229,7 +230,8 @@ extract_icmp6_fields(const struct sk_buff *skb,
 		return 1;
 	inside_nexthdr = inside_iph->nexthdr;
 
-	inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph), &inside_nexthdr);
+	inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph),
+					 &inside_nexthdr, &inside_fragoff);
 	if (inside_hdrlen < 0)
 		return 1; /* hjm: Packet has no/incomplete transport layer headers. */
 
security/lsm_audit.c +2 -1
index 199616b..7bd6f13 100644
@@ -114,6 +114,7 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
 	int offset, ret = 0;
 	struct ipv6hdr *ip6;
 	u8 nexthdr;
+	__be16 frag_off;
 
 	ip6 = ipv6_hdr(skb);
 	if (ip6 == NULL)
@@ -126,7 +127,7 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
 	offset = skb_network_offset(skb);
 	offset += sizeof(*ip6);
 	nexthdr = ip6->nexthdr;
-	offset = ipv6_skip_exthdr(skb, offset, &nexthdr);
+	offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off);
 	if (offset < 0)
 		return 0;
 	if (proto)
security/selinux/hooks.c +2 -1
index 7e6c256..cca09bb 100644
@@ -3561,6 +3561,7 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb,
 	u8 nexthdr;
 	int ret = -EINVAL, offset;
 	struct ipv6hdr _ipv6h, *ip6;
+	__be16 frag_off;
 
 	offset = skb_network_offset(skb);
 	ip6 = skb_header_pointer(skb, offset, sizeof(_ipv6h), &_ipv6h);
@@ -3573,7 +3574,7 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb,
 
 	nexthdr = ip6->nexthdr;
 	offset += sizeof(_ipv6h);
-	offset = ipv6_skip_exthdr(skb, offset, &nexthdr);
+	offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off);
 	if (offset < 0)
 		goto out;
 
Signature · 1 line
1.7.5.4
#7 lore raw

PATCH v3 6/6 net: Add Open vSwitch kernel components.

In reply to a message not in the archive

Open vSwitch is a multilayer Ethernet switch targeted at virtualized environments. In addition to supporting a variety of features expected in a traditional hardware switch, it enables fine-grained programmatic extension and flow-based control of the network. This control is useful in a wide variety of applications but is particularly important in multi-server virtualization deployments, which are often characterized by highly dynamic endpoints and the need to maintain logical abstractions for multiple tenants.

The Open vSwitch datapath provides an in-kernel fast path for packet forwarding. It is complemented by a userspace daemon, ovs-vswitchd, which is able to accept configuration from a variety of sources and translate it into packet processing rules.

See http://openvswitch.org for more information and userspace utilities.

---
v3:
- Rename global symbols to have "ovs_" prefix.
- Move IPv6 extension header parsing into generic code.
- Periodically rehash flow table to avoid attacks.
v2:
- Use u64_stats_sync instead of seqcount directly.
- Always send port deleted notifications to correct namespace.
- Remove unused variable in dp_notify.c
- Drop wrappers for accessing data protected by RCU/genl/RTNL locks in favor of more general lockdep/sparse checking.

---
 Documentation/networking/00-INDEX        |    2 +
 Documentation/networking/openvswitch.txt |  195 +++
 MAINTAINERS                              |    8 +
 include/linux/openvswitch.h              |  452 +++++++
 net/Kconfig                              |    1 +
 net/Makefile                             |    1 +
 net/openvswitch/Kconfig                  |   28 +
 net/openvswitch/Makefile                 |   14 +
 net/openvswitch/actions.c                |  415 +++++++
 net/openvswitch/datapath.c               | 1912 ++++++++++++++++++++++++++++++
 net/openvswitch/datapath.h               |  125 ++
 net/openvswitch/dp_notify.c              |   66 +
 net/openvswitch/flow.c                   | 1346 +++++++++++++++++++++
 net/openvswitch/flow.h                   |  199 ++++
 net/openvswitch/vport-internal_dev.c     |  241 ++++
 net/openvswitch/vport-internal_dev.h     |   28 +
 net/openvswitch/vport-netdev.c           |  198 +++
 net/openvswitch/vport-netdev.h           |   42 +
 net/openvswitch/vport.c                  |  396 ++++++
 net/openvswitch/vport.h                  |  205 ++++
 20 files changed, 5874 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/networking/openvswitch.txt
 create mode 100644 include/linux/openvswitch.h
 create mode 100644 net/openvswitch/Kconfig
 create mode 100644 net/openvswitch/Makefile
 create mode 100644 net/openvswitch/actions.c
 create mode 100644 net/openvswitch/datapath.c
 create mode 100644 net/openvswitch/datapath.h
 create mode 100644 net/openvswitch/dp_notify.c
 create mode 100644 net/openvswitch/flow.c
 create mode 100644 net/openvswitch/flow.h
 create mode 100644 net/openvswitch/vport-internal_dev.c
 create mode 100644 net/openvswitch/vport-internal_dev.h
 create mode 100644 net/openvswitch/vport-netdev.c
 create mode 100644 net/openvswitch/vport-netdev.h
 create mode 100644 net/openvswitch/vport.c
 create mode 100644 net/openvswitch/vport.h
Documentation/networking/00-INDEX +2 -0
index bbce121..9ad9dde 100644
@@ -144,6 +144,8 @@ nfc.txt
 	- The Linux Near Field Communication (NFS) subsystem.
 olympic.txt
 	- IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info.
+openvswitch.txt
+	- Open vSwitch developer documentation.
 operstates.txt
 	- Overview of network interface operational states.
 packet_mmap.txt
Documentation/networking/openvswitch.txt new file +195 -0

195 lines not on this page · raw message

MAINTAINERS +8 -0
index c88eb7b..209ad06 100644
@@ -4868,6 +4868,14 @@ S:	Maintained
 T:	git git://openrisc.net/~jonas/linux
 F:	arch/openrisc
 
+OPENVSWITCH
+M:	Jesse Gross <[email protected]>
+L:	[email protected]
+W:	http://openvswitch.org
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git
+S:	Maintained
+F:	net/openvswitch/
+
 OPL4 DRIVER
 M:	Clemens Ladisch <clemens-P6GI/[email protected]>
 L:	alsa-devel-K7yf7f+aM1XWsZ/[email protected] (moderated for non-subscribers)
include/linux/openvswitch.h new file +452 -0

452 lines not on this page · raw message

net/Kconfig +1 -0
index 2d99873..e07272d 100644
@@ -215,6 +215,7 @@ source "net/sched/Kconfig"
 source "net/dcb/Kconfig"
 source "net/dns_resolver/Kconfig"
 source "net/batman-adv/Kconfig"
+source "net/openvswitch/Kconfig"
 
 config RPS
 	boolean
net/Makefile +1 -0
index acdde49..ad432fa 100644
@@ -69,3 +69,4 @@ obj-$(CONFIG_DNS_RESOLVER)	+= dns_resolver/
 obj-$(CONFIG_CEPH_LIB)		+= ceph/
 obj-$(CONFIG_BATMAN_ADV)	+= batman-adv/
 obj-$(CONFIG_NFC)		+= nfc/
+obj-$(CONFIG_OPENVSWITCH)	+= openvswitch/
net/openvswitch/Kconfig new file +28 -0
new file mode 100644
index 0000000..d9ea33c
@@ -0,0 +1,28 @@
+#
+# Open vSwitch
+#
+
+config OPENVSWITCH
+	tristate "Open vSwitch"
+	---help---
+	  Open vSwitch is a multilayer Ethernet switch targeted at virtualized
+	  environments.  In addition to supporting a variety of features
+	  expected in a traditional hardware switch, it enables fine-grained
+	  programmatic extension and flow-based control of the network.  This
+	  control is useful in a wide variety of applications but is
+	  particularly important in multi-server virtualization deployments,
+	  which are often characterized by highly dynamic endpoints and the
+	  need to maintain logical abstractions for multiple tenants.
+
+	  The Open vSwitch datapath provides an in-kernel fast path for packet
+	  forwarding.  It is complemented by a userspace daemon, ovs-vswitchd,
+	  which is able to accept configuration from a variety of sources and
+	  translate it into packet processing rules.
+
+	  See http://openvswitch.org for more information and userspace
+	  utilities.
+
+	  To compile this code as a module, choose M here: the module will be
+	  called openvswitch.
+
+	  If unsure, say N.
net/openvswitch/Makefile new file +14 -0
new file mode 100644
index 0000000..15e7384
@@ -0,0 +1,14 @@
+#
+# Makefile for Open vSwitch.
+#
+
+obj-$(CONFIG_OPENVSWITCH) += openvswitch.o
+
+openvswitch-y := \
+	actions.o \
+	datapath.o \
+	dp_notify.o \
+	flow.o \
+	vport.o \
+	vport-internal_dev.o \
+	vport-netdev.o \
net/openvswitch/actions.c new file +415 -0

415 lines not on this page · raw message

net/openvswitch/datapath.c new file +1912 -0

1,863 lines not on this page · raw message

net/openvswitch/datapath.h new file +125 -0

125 lines not on this page · raw message

net/openvswitch/dp_notify.c new file +66 -0

66 lines not on this page · raw message

net/openvswitch/flow.c new file +1346 -0

1,346 lines not on this page · raw message

net/openvswitch/flow.h new file +199 -0

199 lines not on this page · raw message

net/openvswitch/vport-internal_dev.c new file +241 -0

241 lines not on this page · raw message

net/openvswitch/vport-internal_dev.h new file +28 -0
new file mode 100644
index 0000000..3454447

Lines of this file are not shown. View the raw message.

net/openvswitch/vport-netdev.c new file +198 -0

198 lines not on this page · raw message

net/openvswitch/vport-netdev.h new file +42 -0

42 lines not on this page · raw message

net/openvswitch/vport.c new file +396 -0

396 lines not on this page · raw message

net/openvswitch/vport.h new file +205 -0

205 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.5.4

Part of the diff is not shown here. View the raw message.

#0 lore raw

This series of patches proposes the Open vSwitch kernel components for upstream. Open vSwitch has existed as a separate project for several years and we now believe it to be mature enough for inclusion. The actual functionality is described more fully in the commit that adds the kernel code.

The following changes since commit 340e8dc1fb4032b6c8334c9bff20b2aec42ecfd8:

atm: clip: Remove code commented out since eternity. (2011-12-02 14:27:11 -0500)

are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git for-upstream

Jesse Gross (3):
genetlink: Add rcu_dereference_genl and genl_dereference.
ipv6: Add fragment reporting to ipv6_skip_exthdr().
net: Add Open vSwitch kernel components.

Pravin B Shelar (3):
genetlink: Add genl_notify()
genetlink: Add lockdep_genl_is_held().
vlan: Move vlan_set_encap_proto() to vlan header file

 Documentation/networking/00-INDEX        |    2 +
 Documentation/networking/openvswitch.txt |  195 +++
 MAINTAINERS                              |    8 +
 include/linux/genetlink.h                |   24 +
 include/linux/if_vlan.h                  |   34 +
 include/linux/openvswitch.h              |  452 +++++++
 include/net/genetlink.h                  |    2 +
 include/net/ipv6.h                       |    2 +-
 net/8021q/vlan_core.c                    |   33 -
 net/Kconfig                              |    1 +
 net/Makefile                             |    1 +
 net/bridge/br_multicast.c                |    3 +-
 net/bridge/netfilter/ebt_ip6.c           |    3 +-
 net/bridge/netfilter/ebt_log.c           |    3 +-
 net/ipv6/exthdrs_core.c                  |   11 +-
 net/ipv6/icmp.c                          |    7 +-
 net/ipv6/ip6_input.c                     |    3 +-
 net/ipv6/ip6_output.c                    |    3 +-
 net/ipv6/netfilter/ip6t_REJECT.c         |    3 +-
 net/netfilter/ipset/ip_set_getport.c     |    4 +-
 net/netfilter/xt_AUDIT.c                 |    3 +-
 net/netfilter/xt_TCPMSS.c                |    3 +-
 net/netfilter/xt_TCPOPTSTRIP.c           |    3 +-
 net/netfilter/xt_hashlimit.c             |    3 +-
 net/netfilter/xt_socket.c                |    4 +-
 net/netlink/genetlink.c                  |   21 +
 net/openvswitch/Kconfig                  |   28 +
 net/openvswitch/Makefile                 |   14 +
 net/openvswitch/actions.c                |  415 +++++++
 net/openvswitch/datapath.c               | 1912 ++++++++++++++++++++++++++++++
 net/openvswitch/datapath.h               |  125 ++
 net/openvswitch/dp_notify.c              |   66 +
 net/openvswitch/flow.c                   | 1346 +++++++++++++++++++++
 net/openvswitch/flow.h                   |  199 ++++
 net/openvswitch/vport-internal_dev.c     |  241 ++++
 net/openvswitch/vport-internal_dev.h     |   28 +
 net/openvswitch/vport-netdev.c           |  198 +++
 net/openvswitch/vport-netdev.h           |   42 +
 net/openvswitch/vport.c                  |  396 ++++++
 net/openvswitch/vport.h                  |  205 ++++
 security/lsm_audit.c                     |    3 +-
 security/selinux/hooks.c                 |    3 +-
 42 files changed, 6000 insertions(+), 52 deletions(-)
 create mode 100644 Documentation/networking/openvswitch.txt
 create mode 100644 include/linux/openvswitch.h
 create mode 100644 net/openvswitch/Kconfig
 create mode 100644 net/openvswitch/Makefile
 create mode 100644 net/openvswitch/actions.c
 create mode 100644 net/openvswitch/datapath.c
 create mode 100644 net/openvswitch/datapath.h
 create mode 100644 net/openvswitch/dp_notify.c
 create mode 100644 net/openvswitch/flow.c
 create mode 100644 net/openvswitch/flow.h
 create mode 100644 net/openvswitch/vport-internal_dev.c
 create mode 100644 net/openvswitch/vport-internal_dev.h
 create mode 100644 net/openvswitch/vport-netdev.c
 create mode 100644 net/openvswitch/vport-netdev.h
 create mode 100644 net/openvswitch/vport.c
 create mode 100644 net/openvswitch/vport.h
#8 lore raw
In reply to a message not in the archive

From: Jesse Gross <[email protected]>
Date: Sat, 3 Dec 2011 10:38:45 -0800

Quoted 6 lines

This series of patches proposes the Open vSwitch kernel components for upstream. Open vSwitch has existed as a separate project for several years and we now believe it to be mature enough for inclusion. The actual functionality is described more fully in the commit that adds the kernel code.

Quoted 6 lines

The following changes since commit 340e8dc1fb4032b6c8334c9bff20b2aec42ecfd8:

atm: clip: Remove code commented out since eternity. (2011-12-02 14:27:11 -0500)

are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git for-upstream

Ok I pulled, don't make me regret it :-)

#9 lore raw
In reply to a message not in the archive

Although this series of patchset is a bit large, therefore their codes aren't directly pasted here, but if anyone find some issues in the codes, how will we point out them?

Quoted 86 lines · Jesse Gross

This series of patches proposes the Open vSwitch kernel components for upstream.  Open vSwitch has existed as a separate project for several years and we now believe it to be mature enough for inclusion.  The actual functionality is described more fully in the commit that adds the kernel code.

The following changes since commit 340e8dc1fb4032b6c8334c9bff20b2aec42ecfd8:

 atm: clip: Remove code commented out since eternity. (2011-12-02 14:27:11 -0500)

are available in the git repository at:
 git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git for-upstream

Jesse Gross (3):
     genetlink: Add rcu_dereference_genl and genl_dereference.
     ipv6: Add fragment reporting to ipv6_skip_exthdr().
     net: Add Open vSwitch kernel components.

Pravin B Shelar (3):
     genetlink: Add genl_notify()
     genetlink: Add lockdep_genl_is_held().
     vlan: Move vlan_set_encap_proto() to vlan header file

 Documentation/networking/00-INDEX        |    2 + Documentation/networking/openvswitch.txt |  195 +++ MAINTAINERS                              |    8 + include/linux/genetlink.h                |   24 + include/linux/if_vlan.h                  |   34 + include/linux/openvswitch.h              |  452 +++++++ include/net/genetlink.h                  |    2 + include/net/ipv6.h                       |    2 +- net/8021q/vlan_core.c                    |   33 - net/Kconfig                              |    1 + net/Makefile                             |    1 + net/bridge/br_multicast.c                |    3 +- net/bridge/netfilter/ebt_ip6.c           |    3 +- net/bridge/netfilter/ebt_log.c           |    3 +- net/ipv6/exthdrs_core.c                  |   11 +- net/ipv6/icmp.c                          |    7 +- net/ipv6/ip6_input.c                     |    3 +- net/ipv6/ip6_output.c                    |    3 +- net/ipv6/netfilter/ip6t_REJECT.c         |    3 +- net/netfilter/ipset/ip_set_getport.c     |    4 +- net/netfilter/xt_AUDIT.c                 |    3 +- net/netfilter/xt_TCPMSS.c                |    3 +- net/netfilter/xt_TCPOPTSTRIP.c           |    3 +- net/netfilter/xt_hashlimit.c             |    3 +- net/netfilter/xt_socket.c                |    4 +- net/netlink/genetlink.c                  |   21 + net/openvswitch/Kconfig                  |   28 + net/openvswitch/Makefile                 |   14 + net/openvswitch/actions.c                |  415 +++++++

 net/openvswitch/datapath.c               | 1912 ++++++++++++++++++++++++++++++
 net/openvswitch/datapath.h               |  125 ++
 net/openvswitch/dp_notify.c              |   66 +

 net/openvswitch/flow.c                   | 1346 +++++++++++++++++++++ net/openvswitch/flow.h                   |  199 ++++ net/openvswitch/vport-internal_dev.c     |  241 ++++ net/openvswitch/vport-internal_dev.h     |   28 + net/openvswitch/vport-netdev.c           |  198 +++ net/openvswitch/vport-netdev.h           |   42 + net/openvswitch/vport.c                  |  396 ++++++ net/openvswitch/vport.h                  |  205 ++++ security/lsm_audit.c                     |    3 +- security/selinux/hooks.c                 |    3 +-

 42 files changed, 6000 insertions(+), 52 deletions(-)

 create mode 100644 Documentation/networking/openvswitch.txt create mode 100644 include/linux/openvswitch.h create mode 100644 net/openvswitch/Kconfig
 create mode 100644 net/openvswitch/Makefile create mode 100644 net/openvswitch/actions.c create mode 100644 net/openvswitch/datapath.c create mode 100644 net/openvswitch/datapath.h create mode 100644 net/openvswitch/dp_notify.c create mode 100644 net/openvswitch/flow.c
 create mode 100644 net/openvswitch/flow.h
 create mode 100644 net/openvswitch/vport-internal_dev.c create mode 100644 net/openvswitch/vport-internal_dev.h create mode 100644 net/openvswitch/vport-netdev.c create mode 100644 net/openvswitch/vport-netdev.h create mode 100644 net/openvswitch/vport.c
 create mode 100644 net/openvswitch/vport.h
_______________________________________________
dev mailing list [email protected]
http://openvswitch.org/mailman/listinfo/dev

Signature · 3 lines
Regards,

Zhi Yong Wu
#11 lore raw
In reply to a message not in the archive
Quoted 3 lines · Zhi Yong Wu

Although this series of patchset is a bit large, therefore their codes aren't directly pasted here, but if anyone find some issues in the codes, how will we point out them?

I also sent out the actual patches that are referenced in this pull request to the mailing list, so that would be the best place to provide comments. For example, this is the first patch in the series:
http://marc.info/?l=linux-netdev&m=132293763127660&w=2

#13 lore raw
In reply to a message not in the archive
Quoted 9 lines · Jesse Gross
Quoted 3 lines · Zhi Yong Wu

Although this series of patchset is a bit large, therefore their codes aren't directly pasted here, but if anyone find some issues in the codes, how will we point out them?

I also sent out the actual patches that are referenced in this pull request to the mailing list, so that would be the best place to provide comments.  For example, this is the first patch in the series:
http://marc.info/?l=linux-netdev&m=132293763127660&w=2

Got it, thanks.

Signature · 3 lines
Regards,

Zhi Yong Wu