xfrm: fix gre key endianess

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>
This commit is contained in:
Timo Teräs 2010-11-23 04:03:45 +00:00 committed by David S. Miller
parent 6a632625c7
commit aa285b1740
1 changed files with 2 additions and 2 deletions

View File

@ -806,7 +806,7 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
port = htons(fl->fl_mh_type); port = htons(fl->fl_mh_type);
break; break;
case IPPROTO_GRE: case IPPROTO_GRE:
port = htonl(fl->fl_gre_key) >> 16; port = htons(ntohl(fl->fl_gre_key) >> 16);
break; break;
default: default:
port = 0; /*XXX*/ port = 0; /*XXX*/
@ -830,7 +830,7 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
port = htons(fl->fl_icmp_code); port = htons(fl->fl_icmp_code);
break; break;
case IPPROTO_GRE: case IPPROTO_GRE:
port = htonl(fl->fl_gre_key) & 0xffff; port = htons(ntohl(fl->fl_gre_key) & 0xffff);
break; break;
default: default:
port = 0; /*XXX*/ port = 0; /*XXX*/