Skip to content

Commit d159ce7

Browse files
committed
flow: Extend flow informations with xfrm interface id.
Add a new flowi_xfrm structure with informations needed to do a xfrm lookup. At the moment it keeps the informations about the new xfrm interface id needed to lookup xfrm interfaces that are introduced with a followup patch. We need this new lookup key as other possible keys, like the ifindex is already part of the xfrm selector and used as a key to enforce the output device after the transformation in the policy/state lookup. Signed-off-by: Steffen Klassert <[email protected]> Acked-by: Shannon Nelson <[email protected]> Acked-by: Benedict Wong <[email protected]> Tested-by: Benedict Wong <[email protected]> Tested-by: Antony Antony <[email protected]> Reviewed-by: Eyal Birger <[email protected]>
1 parent 9b42c1f commit d159ce7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/net/flow.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ struct flowi_tunnel {
2626
__be64 tun_id;
2727
};
2828

29+
struct flowi_xfrm {
30+
__u32 if_id;
31+
};
32+
2933
struct flowi_common {
3034
int flowic_oif;
3135
int flowic_iif;
@@ -39,6 +43,7 @@ struct flowi_common {
3943
#define FLOWI_FLAG_SKIP_NH_OIF 0x04
4044
__u32 flowic_secid;
4145
struct flowi_tunnel flowic_tun_key;
46+
struct flowi_xfrm xfrm;
4247
kuid_t flowic_uid;
4348
};
4449

@@ -78,6 +83,7 @@ struct flowi4 {
7883
#define flowi4_secid __fl_common.flowic_secid
7984
#define flowi4_tun_key __fl_common.flowic_tun_key
8085
#define flowi4_uid __fl_common.flowic_uid
86+
#define flowi4_xfrm __fl_common.xfrm
8187

8288
/* (saddr,daddr) must be grouped, same order as in IP header */
8389
__be32 saddr;
@@ -109,6 +115,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
109115
fl4->flowi4_flags = flags;
110116
fl4->flowi4_secid = 0;
111117
fl4->flowi4_tun_key.tun_id = 0;
118+
fl4->flowi4_xfrm.if_id = 0;
112119
fl4->flowi4_uid = uid;
113120
fl4->daddr = daddr;
114121
fl4->saddr = saddr;
@@ -138,6 +145,7 @@ struct flowi6 {
138145
#define flowi6_secid __fl_common.flowic_secid
139146
#define flowi6_tun_key __fl_common.flowic_tun_key
140147
#define flowi6_uid __fl_common.flowic_uid
148+
#define flowi6_xfrm __fl_common.xfrm
141149
struct in6_addr daddr;
142150
struct in6_addr saddr;
143151
/* Note: flowi6_tos is encoded in flowlabel, too. */
@@ -185,6 +193,7 @@ struct flowi {
185193
#define flowi_secid u.__fl_common.flowic_secid
186194
#define flowi_tun_key u.__fl_common.flowic_tun_key
187195
#define flowi_uid u.__fl_common.flowic_uid
196+
#define flowi_xfrm u.__fl_common.xfrm
188197
} __attribute__((__aligned__(BITS_PER_LONG/8)));
189198

190199
static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)

0 commit comments

Comments
 (0)