3 * Generic internet FLOW.
10 #include <linux/in6.h>
11 #include <asm/atomic.h>
21 #define FLOWI_FLAG_ANYSRC 0x01
22 #define FLOWI_FLAG_PRECOW_METRICS 0x02
23 #define FLOWI_FLAG_CAN_SLEEP 0x04
52 struct flowi_common __fl_common
;
53 #define flowi4_oif __fl_common.flowic_oif
54 #define flowi4_iif __fl_common.flowic_iif
55 #define flowi4_mark __fl_common.flowic_mark
56 #define flowi4_tos __fl_common.flowic_tos
57 #define flowi4_scope __fl_common.flowic_scope
58 #define flowi4_proto __fl_common.flowic_proto
59 #define flowi4_flags __fl_common.flowic_flags
60 #define flowi4_secid __fl_common.flowic_secid
67 struct flowi_common __fl_common
;
68 struct in6_addr daddr
;
69 struct in6_addr saddr
;
75 struct flowi_common __fl_common
;
83 struct flowi_common __fl_common
;
88 #define flowi_oif u.__fl_common.flowic_oif
89 #define flowi_iif u.__fl_common.flowic_iif
90 #define flowi_mark u.__fl_common.flowic_mark
91 #define flowi_tos u.__fl_common.flowic_tos
92 #define flowi_scope u.__fl_common.flowic_scope
93 #define flowi_proto u.__fl_common.flowic_proto
94 #define flowi_flags u.__fl_common.flowic_flags
95 #define flowi_secid u.__fl_common.flowic_secid
96 #define fl4_tos flowi_tos
97 #define fl4_scope flowi_scope
98 #define fld_scope flowi_scope
100 #define fld_dst u.dn.daddr
101 #define fld_src u.dn.saddr
102 #define fl6_dst u.ip6.daddr
103 #define fl6_src u.ip6.saddr
104 #define fl6_flowlabel u.ip6.flowlabel
105 #define fl4_dst u.ip4.daddr
106 #define fl4_src u.ip4.saddr
107 #define fl4_sport u.ip4.uli.ports.sport
108 #define fl4_dport u.ip4.uli.ports.dport
109 #define fl4_icmp_type u.ip4.uli.icmpt.type
110 #define fl4_icmp_code u.ip4.uli.icmpt.code
111 #define fl4_ipsec_spi u.ip4.uli.spi
112 #define fl4_mh_type u.ip4.uli.mht.type
113 #define fl4_gre_key u.ip4.uli.gre_key
114 #define fl6_sport u.ip6.uli.ports.sport
115 #define fl6_dport u.ip6.uli.ports.dport
116 #define fl6_icmp_type u.ip6.uli.icmpt.type
117 #define fl6_icmp_code u.ip6.uli.icmpt.code
118 #define fl6_ipsec_spi u.ip6.uli.spi
119 #define fl6_mh_type u.ip6.uli.mht.type
120 #define fl6_gre_key u.ip6.uli.gre_key
121 } __attribute__((__aligned__(BITS_PER_LONG
/8)));
123 static inline struct flowi
*flowi4_to_flowi(struct flowi4
*fl4
)
125 return container_of(fl4
, struct flowi
, u
.ip4
);
128 static inline struct flowi
*flowi6_to_flowi(struct flowi6
*fl6
)
130 return container_of(fl6
, struct flowi
, u
.ip6
);
133 static inline struct flowi
*flowidn_to_flowi(struct flowidn
*fldn
)
135 return container_of(fldn
, struct flowi
, u
.dn
);
138 #define FLOW_DIR_IN 0
139 #define FLOW_DIR_OUT 1
140 #define FLOW_DIR_FWD 2
144 struct flow_cache_ops
;
146 struct flow_cache_object
{
147 const struct flow_cache_ops
*ops
;
150 struct flow_cache_ops
{
151 struct flow_cache_object
*(*get
)(struct flow_cache_object
*);
152 int (*check
)(struct flow_cache_object
*);
153 void (*delete)(struct flow_cache_object
*);
156 typedef struct flow_cache_object
*(*flow_resolve_t
)(
157 struct net
*net
, const struct flowi
*key
, u16 family
,
158 u8 dir
, struct flow_cache_object
*oldobj
, void *ctx
);
160 extern struct flow_cache_object
*flow_cache_lookup(
161 struct net
*net
, const struct flowi
*key
, u16 family
,
162 u8 dir
, flow_resolve_t resolver
, void *ctx
);
164 extern void flow_cache_flush(void);
165 extern atomic_t flow_cache_genid
;