All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
@ 2021-05-05 18:08 Toms Atteka
  2021-05-05 21:47   ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Toms Atteka @ 2021-05-05 18:08 UTC (permalink / raw)
  To: netdev; +Cc: Toms Atteka

IPv6 extension headers carry optional internet layer information
and are placed between the fixed header and the upper-layer
protocol header.

This change adds a new OpenFlow field OFPXMT_OFB_IPV6_EXTHDR and
packets can be filtered using ipv6_ext flag.

Tested-at: https://github.com/TomCodeLV/ovs/actions/runs/504185214
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
---
 include/uapi/linux/openvswitch.h |   1 +
 net/openvswitch/flow.c           | 141 +++++++++++++++++++++++++++++++
 net/openvswitch/flow.h           |  14 +++
 net/openvswitch/flow_netlink.c   |   5 +-
 4 files changed, 160 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 8d16744edc31..a19812b6631a 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -420,6 +420,7 @@ struct ovs_key_ipv6 {
 	__u8   ipv6_tclass;
 	__u8   ipv6_hlimit;
 	__u8   ipv6_frag;	/* One of OVS_FRAG_TYPE_*. */
+	__u16  ipv6_exthdr;
 };
 
 struct ovs_key_tcp {
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index e586424d8b04..1ea08d61b4bd 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -239,6 +239,145 @@ static bool icmphdr_ok(struct sk_buff *skb)
 				  sizeof(struct icmphdr));
 }
 
+/**
+ * Parses packet and sets IPv6 extension header flags.
+ *
+ * skb          buffer where extension header data starts in packet
+ * nh           ipv6 header
+ * ext_hdrs     flags are stored here
+ *
+ * OFPIEH12_UNREP is set if more than one of a given IPv6 extension header
+ * is unexpectedly encountered. (Two destination options headers may be
+ * expected and would not cause this bit to be set.)
+ *
+ * OFPIEH12_UNSEQ is set if IPv6 extension headers were not in the order
+ * preferred (but not required) by RFC 2460:
+ *
+ * When more than one extension header is used in the same packet, it is
+ * recommended that those headers appear in the following order:
+ *      IPv6 header
+ *      Hop-by-Hop Options header
+ *      Destination Options header
+ *      Routing header
+ *      Fragment header
+ *      Authentication header
+ *      Encapsulating Security Payload header
+ *      Destination Options header
+ *      upper-layer header
+ */
+void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
+{
+	int next_type = nh->nexthdr;
+	unsigned int start = skb_network_offset(skb) + sizeof(struct ipv6hdr);
+	int dest_options_header_count = 0;
+
+	*ext_hdrs = 0;
+
+	while (ipv6_ext_hdr(next_type)) {
+		struct ipv6_opt_hdr _hdr, *hp;
+
+		switch (next_type) {
+		case IPPROTO_NONE:
+			*ext_hdrs |= OFPIEH12_NONEXT;
+			/* stop parsing */
+			return;
+
+		case IPPROTO_ESP:
+			if (*ext_hdrs & OFPIEH12_ESP)
+				*ext_hdrs |= OFPIEH12_UNREP;
+			if ((*ext_hdrs & ~(OFPIEH12_HOP |
+					   OFPIEH12_DEST |
+					   OFPIEH12_ROUTER |
+					   IPPROTO_FRAGMENT |
+					   OFPIEH12_AUTH |
+					   OFPIEH12_UNREP)) ||
+			    dest_options_header_count >= 2)
+				*ext_hdrs |= OFPIEH12_UNSEQ;
+			*ext_hdrs |= OFPIEH12_ESP;
+			break;
+
+		case IPPROTO_AH:
+			if (*ext_hdrs & OFPIEH12_AUTH)
+				*ext_hdrs |= OFPIEH12_UNREP;
+			if ((*ext_hdrs & ~(OFPIEH12_HOP |
+					   OFPIEH12_DEST |
+					   OFPIEH12_ROUTER |
+					   IPPROTO_FRAGMENT |
+					   OFPIEH12_UNREP)) ||
+			    dest_options_header_count >= 2)
+				*ext_hdrs |= OFPIEH12_UNSEQ;
+			*ext_hdrs |= OFPIEH12_AUTH;
+			break;
+
+		case IPPROTO_DSTOPTS:
+			if (dest_options_header_count == 0) {
+				if (*ext_hdrs & ~(OFPIEH12_HOP |
+						  OFPIEH12_UNREP))
+					*ext_hdrs |= OFPIEH12_UNSEQ;
+				*ext_hdrs |= OFPIEH12_DEST;
+			} else if (dest_options_header_count == 1) {
+				if (*ext_hdrs & ~(OFPIEH12_HOP |
+						  OFPIEH12_DEST |
+						  OFPIEH12_ROUTER |
+						  OFPIEH12_FRAG |
+						  OFPIEH12_AUTH |
+						  OFPIEH12_ESP |
+						  OFPIEH12_UNREP))
+					*ext_hdrs |= OFPIEH12_UNSEQ;
+			} else {
+				*ext_hdrs |= OFPIEH12_UNREP;
+			}
+			dest_options_header_count++;
+			break;
+
+		case IPPROTO_FRAGMENT:
+			if (*ext_hdrs & OFPIEH12_FRAG)
+				*ext_hdrs |= OFPIEH12_UNREP;
+			if ((*ext_hdrs & ~(OFPIEH12_HOP |
+					   OFPIEH12_DEST |
+					   OFPIEH12_ROUTER |
+					   OFPIEH12_UNREP)) ||
+			    dest_options_header_count >= 2)
+				*ext_hdrs |= OFPIEH12_UNSEQ;
+			*ext_hdrs |= OFPIEH12_FRAG;
+			break;
+
+		case IPPROTO_ROUTING:
+			if (*ext_hdrs & OFPIEH12_ROUTER)
+				*ext_hdrs |= OFPIEH12_UNREP;
+			if ((*ext_hdrs & ~(OFPIEH12_HOP |
+					   OFPIEH12_DEST |
+					   OFPIEH12_UNREP)) ||
+			    dest_options_header_count >= 2)
+				*ext_hdrs |= OFPIEH12_UNSEQ;
+			*ext_hdrs |= OFPIEH12_ROUTER;
+			break;
+
+		case IPPROTO_HOPOPTS:
+			if (*ext_hdrs & OFPIEH12_HOP)
+				*ext_hdrs |= OFPIEH12_UNREP;
+			/* OFPIEH12_HOP is set to 1 if a hop-by-hop IPv6
+			 * extension header is present as the first extension
+			 * header in the pac	ket.
+			 */
+			if (*ext_hdrs == 0)
+				*ext_hdrs |= OFPIEH12_HOP;
+			else
+				*ext_hdrs |= OFPIEH12_UNSEQ;
+			break;
+
+		default:
+			return;
+		}
+
+		hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
+		if (!hp)
+			break;
+		next_type = hp->nexthdr;
+		start += ipv6_optlen(hp);
+	};
+}
+
 static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
 {
 	unsigned short frag_off;
@@ -254,6 +393,8 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
 
 	nh = ipv6_hdr(skb);
 
+	get_ipv6_ext_hdrs(skb, nh, &key->ipv6.exthdrs);
+
 	key->ip.proto = NEXTHDR_NONE;
 	key->ip.tos = ipv6_get_dsfield(nh);
 	key->ip.ttl = nh->hop_limit;
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index 758a8c77f736..e7a8eafae272 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -32,6 +32,19 @@ enum sw_flow_mac_proto {
 #define SW_FLOW_KEY_INVALID	0x80
 #define MPLS_LABEL_DEPTH       3
 
+/* Bit definitions for IPv6 Extension Header pseudo-field. */
+enum ofp12_ipv6exthdr_flags {
+	OFPIEH12_NONEXT = 1 << 0,   /* "No next header" encountered. */
+	OFPIEH12_ESP    = 1 << 1,   /* Encrypted Sec Payload header present. */
+	OFPIEH12_AUTH   = 1 << 2,   /* Authentication header present. */
+	OFPIEH12_DEST   = 1 << 3,   /* 1 or 2 dest headers present. */
+	OFPIEH12_FRAG   = 1 << 4,   /* Fragment header present. */
+	OFPIEH12_ROUTER = 1 << 5,   /* Router header present. */
+	OFPIEH12_HOP    = 1 << 6,   /* Hop-by-hop header present. */
+	OFPIEH12_UNREP  = 1 << 7,   /* Unexpected repeats encountered. */
+	OFPIEH12_UNSEQ  = 1 << 8    /* Unexpected sequencing encountered. */
+};
+
 /* Store options at the end of the array if they are less than the
  * maximum size. This allows us to get the benefits of variable length
  * matching for small options.
@@ -121,6 +134,7 @@ struct sw_flow_key {
 				struct in6_addr dst;	/* IPv6 destination address. */
 			} addr;
 			__be32 label;			/* IPv6 flow label. */
+			u16 exthdrs;			/* IPv6 extension header flags */
 			union {
 				struct {
 					struct in6_addr src;
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index fd1f809e9bc1..681cd9ddda4a 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -367,7 +367,7 @@ size_t ovs_key_attr_size(void)
 		+ nla_total_size(4)   /* OVS_KEY_ATTR_VLAN */
 		+ nla_total_size(0)   /* OVS_KEY_ATTR_ENCAP */
 		+ nla_total_size(2)   /* OVS_KEY_ATTR_ETHERTYPE */
-		+ nla_total_size(40)  /* OVS_KEY_ATTR_IPV6 */
+		+ nla_total_size(42)  /* OVS_KEY_ATTR_IPV6 */
 		+ nla_total_size(2)   /* OVS_KEY_ATTR_ICMPV6 */
 		+ nla_total_size(28); /* OVS_KEY_ATTR_ND */
 }
@@ -1585,6 +1585,8 @@ static int ovs_key_from_nlattrs(struct net *net, struct sw_flow_match *match,
 				ipv6_key->ipv6_hlimit, is_mask);
 		SW_FLOW_KEY_PUT(match, ip.frag,
 				ipv6_key->ipv6_frag, is_mask);
+		SW_FLOW_KEY_PUT(match, ipv6.exthdrs,
+				ipv6_key->ipv6_exthdr, is_mask);
 		SW_FLOW_KEY_MEMCPY(match, ipv6.addr.src,
 				ipv6_key->ipv6_src,
 				sizeof(match->key->ipv6.addr.src),
@@ -2113,6 +2115,7 @@ static int __ovs_nla_put_key(const struct sw_flow_key *swkey,
 		ipv6_key->ipv6_tclass = output->ip.tos;
 		ipv6_key->ipv6_hlimit = output->ip.ttl;
 		ipv6_key->ipv6_frag = output->ip.frag;
+		ipv6_key->ipv6_exthdr = output->ipv6.exthdrs;
 	} else if (swkey->eth.type == htons(ETH_P_NSH)) {
 		if (nsh_key_to_nlattr(&output->nsh, is_mask, skb))
 			goto nla_put_failure;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
  2021-05-05 18:08 [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support Toms Atteka
@ 2021-05-05 21:47   ` kernel test robot
  2021-05-06  2:03   ` kernel test robot
  2021-05-06  2:03   ` kernel test robot
  2 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-05-05 21:47 UTC (permalink / raw)
  To: Toms Atteka, netdev; +Cc: kbuild-all, clang-built-linux, Toms Atteka

[-- Attachment #1: Type: text/plain, Size: 7107 bytes --]

Hi Toms,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on ipsec/master ipvs/master net-next/master linus/master v5.12 next-20210505]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550
config: x86_64-randconfig-a012-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ef546bf606b0f17bf7ce250cd4e619528369a8ec
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
        git checkout ef546bf606b0f17bf7ce250cd4e619528369a8ec
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/openvswitch/flow.c:268:6: warning: no previous prototype for function 'get_ipv6_ext_hdrs' [-Wmissing-prototypes]
   void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
        ^
   net/openvswitch/flow.c:268:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
   ^
   static 
   1 warning generated.


vim +/get_ipv6_ext_hdrs +268 net/openvswitch/flow.c

   241	
   242	/**
   243	 * Parses packet and sets IPv6 extension header flags.
   244	 *
   245	 * skb          buffer where extension header data starts in packet
   246	 * nh           ipv6 header
   247	 * ext_hdrs     flags are stored here
   248	 *
   249	 * OFPIEH12_UNREP is set if more than one of a given IPv6 extension header
   250	 * is unexpectedly encountered. (Two destination options headers may be
   251	 * expected and would not cause this bit to be set.)
   252	 *
   253	 * OFPIEH12_UNSEQ is set if IPv6 extension headers were not in the order
   254	 * preferred (but not required) by RFC 2460:
   255	 *
   256	 * When more than one extension header is used in the same packet, it is
   257	 * recommended that those headers appear in the following order:
   258	 *      IPv6 header
   259	 *      Hop-by-Hop Options header
   260	 *      Destination Options header
   261	 *      Routing header
   262	 *      Fragment header
   263	 *      Authentication header
   264	 *      Encapsulating Security Payload header
   265	 *      Destination Options header
   266	 *      upper-layer header
   267	 */
 > 268	void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
   269	{
   270		int next_type = nh->nexthdr;
   271		unsigned int start = skb_network_offset(skb) + sizeof(struct ipv6hdr);
   272		int dest_options_header_count = 0;
   273	
   274		*ext_hdrs = 0;
   275	
   276		while (ipv6_ext_hdr(next_type)) {
   277			struct ipv6_opt_hdr _hdr, *hp;
   278	
   279			switch (next_type) {
   280			case IPPROTO_NONE:
   281				*ext_hdrs |= OFPIEH12_NONEXT;
   282				/* stop parsing */
   283				return;
   284	
   285			case IPPROTO_ESP:
   286				if (*ext_hdrs & OFPIEH12_ESP)
   287					*ext_hdrs |= OFPIEH12_UNREP;
   288				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   289						   OFPIEH12_DEST |
   290						   OFPIEH12_ROUTER |
   291						   IPPROTO_FRAGMENT |
   292						   OFPIEH12_AUTH |
   293						   OFPIEH12_UNREP)) ||
   294				    dest_options_header_count >= 2)
   295					*ext_hdrs |= OFPIEH12_UNSEQ;
   296				*ext_hdrs |= OFPIEH12_ESP;
   297				break;
   298	
   299			case IPPROTO_AH:
   300				if (*ext_hdrs & OFPIEH12_AUTH)
   301					*ext_hdrs |= OFPIEH12_UNREP;
   302				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   303						   OFPIEH12_DEST |
   304						   OFPIEH12_ROUTER |
   305						   IPPROTO_FRAGMENT |
   306						   OFPIEH12_UNREP)) ||
   307				    dest_options_header_count >= 2)
   308					*ext_hdrs |= OFPIEH12_UNSEQ;
   309				*ext_hdrs |= OFPIEH12_AUTH;
   310				break;
   311	
   312			case IPPROTO_DSTOPTS:
   313				if (dest_options_header_count == 0) {
   314					if (*ext_hdrs & ~(OFPIEH12_HOP |
   315							  OFPIEH12_UNREP))
   316						*ext_hdrs |= OFPIEH12_UNSEQ;
   317					*ext_hdrs |= OFPIEH12_DEST;
   318				} else if (dest_options_header_count == 1) {
   319					if (*ext_hdrs & ~(OFPIEH12_HOP |
   320							  OFPIEH12_DEST |
   321							  OFPIEH12_ROUTER |
   322							  OFPIEH12_FRAG |
   323							  OFPIEH12_AUTH |
   324							  OFPIEH12_ESP |
   325							  OFPIEH12_UNREP))
   326						*ext_hdrs |= OFPIEH12_UNSEQ;
   327				} else {
   328					*ext_hdrs |= OFPIEH12_UNREP;
   329				}
   330				dest_options_header_count++;
   331				break;
   332	
   333			case IPPROTO_FRAGMENT:
   334				if (*ext_hdrs & OFPIEH12_FRAG)
   335					*ext_hdrs |= OFPIEH12_UNREP;
   336				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   337						   OFPIEH12_DEST |
   338						   OFPIEH12_ROUTER |
   339						   OFPIEH12_UNREP)) ||
   340				    dest_options_header_count >= 2)
   341					*ext_hdrs |= OFPIEH12_UNSEQ;
   342				*ext_hdrs |= OFPIEH12_FRAG;
   343				break;
   344	
   345			case IPPROTO_ROUTING:
   346				if (*ext_hdrs & OFPIEH12_ROUTER)
   347					*ext_hdrs |= OFPIEH12_UNREP;
   348				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   349						   OFPIEH12_DEST |
   350						   OFPIEH12_UNREP)) ||
   351				    dest_options_header_count >= 2)
   352					*ext_hdrs |= OFPIEH12_UNSEQ;
   353				*ext_hdrs |= OFPIEH12_ROUTER;
   354				break;
   355	
   356			case IPPROTO_HOPOPTS:
   357				if (*ext_hdrs & OFPIEH12_HOP)
   358					*ext_hdrs |= OFPIEH12_UNREP;
   359				/* OFPIEH12_HOP is set to 1 if a hop-by-hop IPv6
   360				 * extension header is present as the first extension
   361				 * header in the pac	ket.
   362				 */
   363				if (*ext_hdrs == 0)
   364					*ext_hdrs |= OFPIEH12_HOP;
   365				else
   366					*ext_hdrs |= OFPIEH12_UNSEQ;
   367				break;
   368	
   369			default:
   370				return;
   371			}
   372	
   373			hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
   374			if (!hp)
   375				break;
   376			next_type = hp->nexthdr;
   377			start += ipv6_optlen(hp);
   378		};
   379	}
   380	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32712 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
@ 2021-05-05 21:47   ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-05-05 21:47 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7296 bytes --]

Hi Toms,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on ipsec/master ipvs/master net-next/master linus/master v5.12 next-20210505]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550
config: x86_64-randconfig-a012-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ef546bf606b0f17bf7ce250cd4e619528369a8ec
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
        git checkout ef546bf606b0f17bf7ce250cd4e619528369a8ec
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/openvswitch/flow.c:268:6: warning: no previous prototype for function 'get_ipv6_ext_hdrs' [-Wmissing-prototypes]
   void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
        ^
   net/openvswitch/flow.c:268:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
   ^
   static 
   1 warning generated.


vim +/get_ipv6_ext_hdrs +268 net/openvswitch/flow.c

   241	
   242	/**
   243	 * Parses packet and sets IPv6 extension header flags.
   244	 *
   245	 * skb          buffer where extension header data starts in packet
   246	 * nh           ipv6 header
   247	 * ext_hdrs     flags are stored here
   248	 *
   249	 * OFPIEH12_UNREP is set if more than one of a given IPv6 extension header
   250	 * is unexpectedly encountered. (Two destination options headers may be
   251	 * expected and would not cause this bit to be set.)
   252	 *
   253	 * OFPIEH12_UNSEQ is set if IPv6 extension headers were not in the order
   254	 * preferred (but not required) by RFC 2460:
   255	 *
   256	 * When more than one extension header is used in the same packet, it is
   257	 * recommended that those headers appear in the following order:
   258	 *      IPv6 header
   259	 *      Hop-by-Hop Options header
   260	 *      Destination Options header
   261	 *      Routing header
   262	 *      Fragment header
   263	 *      Authentication header
   264	 *      Encapsulating Security Payload header
   265	 *      Destination Options header
   266	 *      upper-layer header
   267	 */
 > 268	void get_ipv6_ext_hdrs(struct sk_buff *skb, struct ipv6hdr *nh, u16 *ext_hdrs)
   269	{
   270		int next_type = nh->nexthdr;
   271		unsigned int start = skb_network_offset(skb) + sizeof(struct ipv6hdr);
   272		int dest_options_header_count = 0;
   273	
   274		*ext_hdrs = 0;
   275	
   276		while (ipv6_ext_hdr(next_type)) {
   277			struct ipv6_opt_hdr _hdr, *hp;
   278	
   279			switch (next_type) {
   280			case IPPROTO_NONE:
   281				*ext_hdrs |= OFPIEH12_NONEXT;
   282				/* stop parsing */
   283				return;
   284	
   285			case IPPROTO_ESP:
   286				if (*ext_hdrs & OFPIEH12_ESP)
   287					*ext_hdrs |= OFPIEH12_UNREP;
   288				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   289						   OFPIEH12_DEST |
   290						   OFPIEH12_ROUTER |
   291						   IPPROTO_FRAGMENT |
   292						   OFPIEH12_AUTH |
   293						   OFPIEH12_UNREP)) ||
   294				    dest_options_header_count >= 2)
   295					*ext_hdrs |= OFPIEH12_UNSEQ;
   296				*ext_hdrs |= OFPIEH12_ESP;
   297				break;
   298	
   299			case IPPROTO_AH:
   300				if (*ext_hdrs & OFPIEH12_AUTH)
   301					*ext_hdrs |= OFPIEH12_UNREP;
   302				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   303						   OFPIEH12_DEST |
   304						   OFPIEH12_ROUTER |
   305						   IPPROTO_FRAGMENT |
   306						   OFPIEH12_UNREP)) ||
   307				    dest_options_header_count >= 2)
   308					*ext_hdrs |= OFPIEH12_UNSEQ;
   309				*ext_hdrs |= OFPIEH12_AUTH;
   310				break;
   311	
   312			case IPPROTO_DSTOPTS:
   313				if (dest_options_header_count == 0) {
   314					if (*ext_hdrs & ~(OFPIEH12_HOP |
   315							  OFPIEH12_UNREP))
   316						*ext_hdrs |= OFPIEH12_UNSEQ;
   317					*ext_hdrs |= OFPIEH12_DEST;
   318				} else if (dest_options_header_count == 1) {
   319					if (*ext_hdrs & ~(OFPIEH12_HOP |
   320							  OFPIEH12_DEST |
   321							  OFPIEH12_ROUTER |
   322							  OFPIEH12_FRAG |
   323							  OFPIEH12_AUTH |
   324							  OFPIEH12_ESP |
   325							  OFPIEH12_UNREP))
   326						*ext_hdrs |= OFPIEH12_UNSEQ;
   327				} else {
   328					*ext_hdrs |= OFPIEH12_UNREP;
   329				}
   330				dest_options_header_count++;
   331				break;
   332	
   333			case IPPROTO_FRAGMENT:
   334				if (*ext_hdrs & OFPIEH12_FRAG)
   335					*ext_hdrs |= OFPIEH12_UNREP;
   336				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   337						   OFPIEH12_DEST |
   338						   OFPIEH12_ROUTER |
   339						   OFPIEH12_UNREP)) ||
   340				    dest_options_header_count >= 2)
   341					*ext_hdrs |= OFPIEH12_UNSEQ;
   342				*ext_hdrs |= OFPIEH12_FRAG;
   343				break;
   344	
   345			case IPPROTO_ROUTING:
   346				if (*ext_hdrs & OFPIEH12_ROUTER)
   347					*ext_hdrs |= OFPIEH12_UNREP;
   348				if ((*ext_hdrs & ~(OFPIEH12_HOP |
   349						   OFPIEH12_DEST |
   350						   OFPIEH12_UNREP)) ||
   351				    dest_options_header_count >= 2)
   352					*ext_hdrs |= OFPIEH12_UNSEQ;
   353				*ext_hdrs |= OFPIEH12_ROUTER;
   354				break;
   355	
   356			case IPPROTO_HOPOPTS:
   357				if (*ext_hdrs & OFPIEH12_HOP)
   358					*ext_hdrs |= OFPIEH12_UNREP;
   359				/* OFPIEH12_HOP is set to 1 if a hop-by-hop IPv6
   360				 * extension header is present as the first extension
   361				 * header in the pac	ket.
   362				 */
   363				if (*ext_hdrs == 0)
   364					*ext_hdrs |= OFPIEH12_HOP;
   365				else
   366					*ext_hdrs |= OFPIEH12_UNSEQ;
   367				break;
   368	
   369			default:
   370				return;
   371			}
   372	
   373			hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
   374			if (!hp)
   375				break;
   376			next_type = hp->nexthdr;
   377			start += ipv6_optlen(hp);
   378		};
   379	}
   380	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32712 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
  2021-05-05 18:08 [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support Toms Atteka
@ 2021-05-06  2:03   ` kernel test robot
  2021-05-06  2:03   ` kernel test robot
  2021-05-06  2:03   ` kernel test robot
  2 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-05-06  2:03 UTC (permalink / raw)
  To: Toms Atteka, netdev; +Cc: kbuild-all, Toms Atteka

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Hi Toms,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on ipsec/master ipvs/master net-next/master linus/master v5.12 next-20210505]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cocci warnings: (new ones prefixed by >>)
>> net/openvswitch/flow.c:378:2-3: Unneeded semicolon

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65746 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
@ 2021-05-06  2:03   ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-05-06  2:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

Hi Toms,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on ipsec/master ipvs/master net-next/master linus/master v5.12 next-20210505]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cocci warnings: (new ones prefixed by >>)
>> net/openvswitch/flow.c:378:2-3: Unneeded semicolon

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 65746 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] net-next: openvswitch: IPv6: fix semicolon.cocci warnings
  2021-05-05 18:08 [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support Toms Atteka
@ 2021-05-06  2:03   ` kernel test robot
  2021-05-06  2:03   ` kernel test robot
  2021-05-06  2:03   ` kernel test robot
  2 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-05-06  2:03 UTC (permalink / raw)
  To: Toms Atteka, netdev; +Cc: kbuild-all, Toms Atteka

From: kernel test robot <lkp@intel.com>

net/openvswitch/flow.c:378:2-3: Unneeded semicolon


 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Toms Atteka <cpp.code.lv@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550

 flow.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -375,7 +375,7 @@ void get_ipv6_ext_hdrs(struct sk_buff *s
 			break;
 		next_type = hp->nexthdr;
 		start += ipv6_optlen(hp);
-	};
+	}
 }
 
 static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] net-next: openvswitch: IPv6: fix semicolon.cocci warnings
@ 2021-05-06  2:03   ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-05-06  2:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 936 bytes --]

From: kernel test robot <lkp@intel.com>

net/openvswitch/flow.c:378:2-3: Unneeded semicolon


 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Toms Atteka <cpp.code.lv@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550

 flow.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -375,7 +375,7 @@ void get_ipv6_ext_hdrs(struct sk_buff *s
 			break;
 		next_type = hp->nexthdr;
 		start += ipv6_optlen(hp);
-	};
+	}
 }
 
 static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
  2021-05-06  2:03   ` kernel test robot
  (?)
@ 2021-05-06 15:41   ` Cpp Code
  -1 siblings, 0 replies; 10+ messages in thread
From: Cpp Code @ 2021-05-06 15:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

sorry, wrong git tree.

On Wed, May 5, 2021 at 7:03 PM kernel test robot <lkp@intel.com> wrote:

> Hi Toms,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on net/master]
> [also build test WARNING on ipsec/master ipvs/master net-next/master
> linus/master v5.12 next-20210505]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:
> https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
> 4c7a94286ef7ac7301d633f17519fb1bb89d7550
> config: x86_64-allyesconfig (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> cocci warnings: (new ones prefixed by >>)
> >> net/openvswitch/flow.c:378:2-3: Unneeded semicolon
>
> Please review and possibly fold the followup patch.
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>

[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 2149 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
  2021-05-06  2:03   ` kernel test robot
@ 2021-05-06 15:53     ` Cpp Code
  -1 siblings, 0 replies; 10+ messages in thread
From: Cpp Code @ 2021-05-06 15:53 UTC (permalink / raw)
  To: kernel test robot; +Cc: netdev, kbuild-all

sorry, wrong git tree.


On Wed, May 5, 2021 at 7:03 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Toms,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on net/master]
> [also build test WARNING on ipsec/master ipvs/master net-next/master linus/master v5.12 next-20210505]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550
> config: x86_64-allyesconfig (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> cocci warnings: (new ones prefixed by >>)
> >> net/openvswitch/flow.c:378:2-3: Unneeded semicolon
>
> Please review and possibly fold the followup patch.
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support
@ 2021-05-06 15:53     ` Cpp Code
  0 siblings, 0 replies; 10+ messages in thread
From: Cpp Code @ 2021-05-06 15:53 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]

sorry, wrong git tree.


On Wed, May 5, 2021 at 7:03 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Toms,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on net/master]
> [also build test WARNING on ipsec/master ipvs/master net-next/master linus/master v5.12 next-20210505]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Toms-Atteka/net-next-openvswitch-IPv6-Add-IPv6-extension-header-support/20210506-021045
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4c7a94286ef7ac7301d633f17519fb1bb89d7550
> config: x86_64-allyesconfig (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> cocci warnings: (new ones prefixed by >>)
> >> net/openvswitch/flow.c:378:2-3: Unneeded semicolon
>
> Please review and possibly fold the followup patch.
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-06 15:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 18:08 [PATCH] net-next: openvswitch: IPv6: Add IPv6 extension header support Toms Atteka
2021-05-05 21:47 ` kernel test robot
2021-05-05 21:47   ` kernel test robot
2021-05-06  2:03 ` kernel test robot
2021-05-06  2:03   ` kernel test robot
2021-05-06 15:41   ` Cpp Code
2021-05-06 15:53   ` Cpp Code
2021-05-06 15:53     ` Cpp Code
2021-05-06  2:03 ` [PATCH] net-next: openvswitch: IPv6: fix semicolon.cocci warnings kernel test robot
2021-05-06  2:03   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.