Skip to content

Commit

Permalink
xfrm: fix gre key endianess
Browse files Browse the repository at this point in the history
fl->fl_gre_key is network byte order contrary to fl->fl_icmp_*.
Make xfrm_flowi_{s|d}port return network byte order values for gre
key too.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Timo Teräs authored and David S. Miller committed Nov 28, 2010
1 parent 6a63262 commit aa285b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
port = htons(fl->fl_mh_type);
break;
case IPPROTO_GRE:
port = htonl(fl->fl_gre_key) >> 16;
port = htons(ntohl(fl->fl_gre_key) >> 16);
break;
default:
port = 0; /*XXX*/
Expand All @@ -830,7 +830,7 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
port = htons(fl->fl_icmp_code);
break;
case IPPROTO_GRE:
port = htonl(fl->fl_gre_key) & 0xffff;
port = htons(ntohl(fl->fl_gre_key) & 0xffff);
break;
default:
port = 0; /*XXX*/
Expand Down

0 comments on commit aa285b1

Please sign in to comment.