On Mon, Nov 17, 2014 at 9:24 AM, Lorand Jakab <[email protected]> wrote:
> diff --git a/datapath/flow.c b/datapath/flow.c
> index 69b13b3..b01f7bd 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -459,28 +459,31 @@ static int key_extract(struct sk_buff *skb, struct
> sw_flow_key *key)
>
> skb_reset_mac_header(skb);
>
> - /* Link layer. We are guaranteed to have at least the 14 byte
> Ethernet
> - * header in the linear data area.
> - */
> - eth = eth_hdr(skb);
> - ether_addr_copy(key->eth.src, eth->h_source);
> - ether_addr_copy(key->eth.dst, eth->h_dest);
> + /* Link layer. */
> + if (key->phy.is_layer3) {
> + key->eth.tci = 0;
> + key->eth.type = skb->protocol;
Were you going to drop setting the TCI here?
> @@ -766,6 +790,18 @@ static int ovs_key_from_nlattrs(struct sw_flow_match
> *match, u64 attrs,
> if (attrs & (1ULL << OVS_KEY_ATTR_IPV6)) {
> const struct ovs_key_ipv6 *ipv6_key;
>
> + /* Add eth.type value for layer 3 flows */
> + if (!(attrs & (1ULL << OVS_KEY_ATTR_ETHERTYPE))) {
> + __be16 eth_type;
> +
> + if (is_mask) {
> + eth_type = htons(0xffff);
> + } else {
> + eth_type = htons(ETH_P_IPV6);
> + }
Can you make the same style change here (the curly braces) as you did with IPv4?
> diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
> index 41c025d..7732c47 100644
> --- a/datapath/vport-gre.c
> +++ b/datapath/vport-gre.c
> @@ -289,6 +289,11 @@ static int gre_send(struct vport *vport, struct sk_buff
> *skb)
> if (unlikely(!OVS_CB(skb)->egress_tun_info))
> return -EINVAL;
>
> + /* Reject layer 3 packets */
> + if (unlikely(skb->protocol == htons(ETH_P_IP) ||
> + skb->protocol == htons(ETH_P_IPV6)))
> + return -EINVAL;
Looking at this again, I think that this isn't sufficient by itself
(the same is true for other tunnel types and the converse for LISP as
well). skb->protocol always contains the L3 protocol so this won't
reject L3 only packets (and will reject non-IP over Ethernet packets).
A better way to do it might be to look at skb->mac_len.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev