Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

openvswitch: Store flow key len if ARP opcode is not request or reply.

We currently only extract the ARP payload if the opcode indicates
that it is a request or reply. However, we also only set the
key length in these situations even though it should still be
possible to match on the opcode. There's no real reason to
restrict the ARP opcode since all have the same format so this
simply removes the check.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>

authored by

Mehak Mahajan and committed by
Jesse Gross
d04d3829 c1c92b6a

+5 -9
+5 -9
net/openvswitch/flow.c
··· 702 702 /* We only match on the lower 8 bits of the opcode. */ 703 703 if (ntohs(arp->ar_op) <= 0xff) 704 704 key->ip.proto = ntohs(arp->ar_op); 705 - 706 - if (key->ip.proto == ARPOP_REQUEST 707 - || key->ip.proto == ARPOP_REPLY) { 708 - memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src)); 709 - memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst)); 710 - memcpy(key->ipv4.arp.sha, arp->ar_sha, ETH_ALEN); 711 - memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN); 712 - key_len = SW_FLOW_KEY_OFFSET(ipv4.arp); 713 - } 705 + memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src)); 706 + memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst)); 707 + memcpy(key->ipv4.arp.sha, arp->ar_sha, ETH_ALEN); 708 + memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN); 709 + key_len = SW_FLOW_KEY_OFFSET(ipv4.arp); 714 710 } 715 711 } else if (key->eth.type == htons(ETH_P_IPV6)) { 716 712 int nh_len; /* IPv6 Header + Extensions */