[ovs-dev] [PATCH 17/19] packet: packet_get_tcp_flags: use flow's encap_dl_type

Simon Horman horms at verge.net.au
Mon Dec 24 02:35:23 UTC 2012


If the encap_dl_type is set then it indicates information about the
dl_type of an encapsulated frame and should be used when decoding
L3 and L4 information.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 lib/packets.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/packets.c b/lib/packets.c
index 59a6a61..844c0ec 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -976,8 +976,10 @@ packet_set_udp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst)
 uint8_t
 packet_get_tcp_flags(const struct ofpbuf *packet, const struct flow *flow)
 {
-    if ((flow->dl_type == htons(ETH_TYPE_IP) ||
-         flow->dl_type == htons(ETH_TYPE_IPV6)) &&
+    ovs_be16 dl_type = flow->encap_dl_type
+        ? flow->encap_dl_type
+        : flow->dl_type;
+    if ((dl_type == htons(ETH_TYPE_IP) || dl_type == htons(ETH_TYPE_IPV6)) &&
         flow->nw_proto == IPPROTO_TCP && packet->l7) {
         const struct tcp_header *tcp = packet->l4;
         return TCP_FLAGS(tcp->tcp_ctl);
-- 
1.7.10.4




More information about the dev mailing list