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
64 #define fl4_sport uli.ports.sport
65 #define fl4_dport uli.ports.dport
66 #define fl4_icmp_type uli.icmpt.type
67 #define fl4_icmp_code uli.icmpt.code
68 #define fl4_ipsec_spi uli.spi
69 #define fl4_mh_type uli.mht.type
70 #define fl4_gre_key uli.gre_key
74 struct flowi_common __fl_common;
75 #define flowi6_oif __fl_common.flowic_oif
76 #define flowi6_iif __fl_common.flowic_iif
77 #define flowi6_mark __fl_common.flowic_mark
78 #define flowi6_tos __fl_common.flowic_tos
79 #define flowi6_scope __fl_common.flowic_scope
80 #define flowi6_proto __fl_common.flowic_proto
81 #define flowi6_flags __fl_common.flowic_flags
82 #define flowi6_secid __fl_common.flowic_secid
83 struct in6_addr daddr;
84 struct in6_addr saddr;
87 #define fl6_sport uli.ports.sport
88 #define fl6_dport uli.ports.dport
89 #define fl6_icmp_type uli.icmpt.type
90 #define fl6_icmp_code uli.icmpt.code
91 #define fl6_ipsec_spi uli.spi
92 #define fl6_mh_type uli.mht.type
93 #define fl6_gre_key uli.gre_key
97 struct flowi_common __fl_common;
98 #define flowidn_oif __fl_common.flowic_oif
99 #define flowidn_iif __fl_common.flowic_iif
100 #define flowidn_mark __fl_common.flowic_mark
101 #define flowidn_scope __fl_common.flowic_scope
102 #define flowidn_proto __fl_common.flowic_proto
103 #define flowidn_flags __fl_common.flowic_flags
107 #define fld_sport uli.ports.sport
108 #define fld_dport uli.ports.dport
113 struct flowi_common __fl_common;
118 #define flowi_oif u.__fl_common.flowic_oif
119 #define flowi_iif u.__fl_common.flowic_iif
120 #define flowi_mark u.__fl_common.flowic_mark
121 #define flowi_tos u.__fl_common.flowic_tos
122 #define flowi_scope u.__fl_common.flowic_scope
123 #define flowi_proto u.__fl_common.flowic_proto
124 #define flowi_flags u.__fl_common.flowic_flags
125 #define flowi_secid u.__fl_common.flowic_secid
126 } __attribute__((__aligned__(BITS_PER_LONG/8)));
128 static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)
130 return container_of(fl4, struct flowi, u.ip4);
133 static inline struct flowi *flowi6_to_flowi(struct flowi6 *fl6)
135 return container_of(fl6, struct flowi, u.ip6);
138 static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn)
140 return container_of(fldn, struct flowi, u.dn);
143 #define FLOW_DIR_IN 0
144 #define FLOW_DIR_OUT 1
145 #define FLOW_DIR_FWD 2
149 struct flow_cache_ops;
151 struct flow_cache_object {
152 const struct flow_cache_ops *ops;
155 struct flow_cache_ops {
156 struct flow_cache_object *(*get)(struct flow_cache_object *);
157 int (*check)(struct flow_cache_object *);
158 void (*delete)(struct flow_cache_object *);
161 typedef struct flow_cache_object *(*flow_resolve_t)(
162 struct net *net, const struct flowi *key, u16 family,
163 u8 dir, struct flow_cache_object *oldobj, void *ctx);
165 extern struct flow_cache_object *flow_cache_lookup(
166 struct net *net, const struct flowi *key, u16 family,
167 u8 dir, flow_resolve_t resolver, void *ctx);
169 extern void flow_cache_flush(void);
170 extern atomic_t flow_cache_genid;