blob: 6667a054763adfad3407d59d0f6810fb13f56a14 [file] [log] [blame]
Eric Dumazet0744dd02011-11-28 05:22:18 +00001#ifndef _NET_FLOW_KEYS_H
2#define _NET_FLOW_KEYS_H
3
Govindarajulu Varadarajane0f31d82014-06-23 16:07:58 +05304/* struct flow_keys:
5 * @src: source ip address in case of IPv4
6 * For IPv6 it contains 32bit hash of src address
7 * @dst: destination ip address in case of IPv4
8 * For IPv6 it contains 32bit hash of dst address
9 * @ports: port numbers of Transport header
10 * port16[0]: src port number
11 * port16[1]: dst port number
12 * @thoff: Transport header offset
13 * @n_proto: Network header protocol (eg. IPv4/IPv6)
14 * @ip_proto: Transport header protocol (eg. TCP/UDP)
15 * All the members, except thoff, are in network byte order.
16 */
Eric Dumazet0744dd02011-11-28 05:22:18 +000017struct flow_keys {
Eric Dumazet4d77d2b2011-11-28 20:30:35 +000018 /* (src,dst) must be grouped, in the same way than in IP header */
Eric Dumazet0744dd02011-11-28 05:22:18 +000019 __be32 src;
20 __be32 dst;
21 union {
22 __be32 ports;
23 __be16 port16[2];
24 };
Daniel Borkmann8ed78162013-03-19 06:39:29 +000025 u16 thoff;
Govindarajulu Varadarajane0f31d82014-06-23 16:07:58 +053026 u16 n_proto;
Eric Dumazet0744dd02011-11-28 05:22:18 +000027 u8 ip_proto;
28};
29
Joe Perches47873422013-09-20 11:23:24 -070030bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
Nikolay Aleksandrov357afe92013-10-02 13:39:24 +020031__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto);
Tom Herbert5ed20a62014-07-01 21:32:05 -070032u32 flow_hash_from_keys(struct flow_keys *keys);
Eric Dumazet0744dd02011-11-28 05:22:18 +000033#endif