lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130425110216.GA582@verge.net.au>
Date:	Thu, 25 Apr 2013 20:02:20 +0900
From:	Simon Horman <horms@...ge.net.au>
To:	"Rajahalme, Jarno (NSN - FI/Espoo)" <jarno.rajahalme@....com>
Cc:	"<dev@...nvswitch.org>" <dev@...nvswitch.org>,
	"<netdev@...r.kernel.org>" <netdev@...r.kernel.org>,
	Ravi K <rkerur@...il.com>,
	Isaku Yamahata <yamahata@...inux.co.jp>,
	Jesse Gross <jesse@...ira.com>, Ben Pfaff <blp@...ira.com>
Subject: Re: [PATCH] datapath: Add basic MPLS support to kernel

On Thu, Apr 25, 2013 at 10:02:49AM +0000, Rajahalme, Jarno (NSN - FI/Espoo) wrote:
> 
> On Apr 25, 2013, at 10:58 , ext Simon Horman wrote:
> 
> > @@ -648,6 +650,7 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key,
> > 		return -ENOMEM;
> > 
> > 	skb_reset_network_header(skb);
> > +	skb_reset_mac_len(skb);
> > 	__skb_push(skb, skb->data - skb_mac_header(skb));
> > 
> > 	/* Network layer. */
> > @@ -730,6 +733,30 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key,
> > 			memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN);
> > 			key_len = SW_FLOW_KEY_OFFSET(ipv4.arp);
> > 		}
> > +	} else if (eth_p_mpls(key->eth.type)) {
> > +		size_t stack_len = MPLS_HLEN;
> > +
> > +		while (1) {
> > +			__be32 lse;
> > +
> > +			error = check_header(skb, stack_len);
> 
> skb->data has been pushed to the mac_header prior to this, so this would not test availability of the MPLS data. 
> Maybe the following would work:
> 
> 			error = check_header(skb, skb->mac_len + stack_len);

Thanks, I will update my patch.

> 
> > +			if (unlikely(error))
> > +				goto out;
> > +
> > +			memcpy(&lse, skb_network_header(skb), MPLS_HLEN);
> > +
> > +			if (stack_len == MPLS_HLEN) {
> > +				key_len = SW_FLOW_KEY_OFFSET(mpls.top_lse);
> > +				memcpy(&key->mpls.top_lse, &lse, MPLS_HLEN);
> > +			}
> > +
> > +			/* Advance network_header to bottom of MPLS label
> > +			 * stack. mac_len corresponds to the top of the stack.
> > +			 */
> > +			skb_set_network_header(skb, skb->mac_len + stack_len);
> > +			if (lse & htonl(MPLS_BOS_MASK))
> > +				break;
> > +		}
> 
> I don't see anything advancing the stack_len, so the loop would not end for deeper stacks?

Oops, I'm unsure how I forgot that.

Yes, stack_len is supposed to advance by one for each iteration of the loop.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ