xfrm: use gre key as flow upper protocol info

The GRE Key field is intended to be used for identifying an individual
traffic flow within a tunnel. It is useful to be able to have XFRM
policy selector matches to have different policies for different
GRE tunnels.

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-03 04:41:38 +00:00
committed by David S. Miller
parent e1f2d8c2cc
commit cc9ff19da9
4 changed files with 30 additions and 5 deletions

View File

@ -805,6 +805,9 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
case IPPROTO_MH:
port = htons(fl->fl_mh_type);
break;
case IPPROTO_GRE:
port = htonl(fl->fl_gre_key) >> 16;
break;
default:
port = 0; /*XXX*/
}
@ -826,6 +829,9 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
case IPPROTO_ICMPV6:
port = htons(fl->fl_icmp_code);
break;
case IPPROTO_GRE:
port = htonl(fl->fl_gre_key) & 0xffff;
break;
default:
port = 0; /*XXX*/
}