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.
Unified · Split
| @@ -26,6 +26,10 @@ struct flowi_tunnel { · 25 unmodified lines | |||
| 26 | __be64 tun_id; | 26 | __be64 tun_id; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | struct flowi_xfrm { | ||
| 30 | __u32 if_id; | ||
| 31 | }; | ||
| 32 | |||
| 29 | struct flowi_common { | 33 | struct flowi_common { |
| 30 | int flowic_oif; | 34 | int flowic_oif; |
| 31 | int flowic_iif; | 35 | int flowic_iif; |
| @@ -39,6 +43,7 @@ struct flowi_common { · 7 unmodified lines | |||
| 39 | #define FLOWI_FLAG_SKIP_NH_OIF 0x04 | 43 | #define FLOWI_FLAG_SKIP_NH_OIF 0x04 |
| 40 | __u32 flowic_secid; | 44 | __u32 flowic_secid; |
| 41 | struct flowi_tunnel flowic_tun_key; | 45 | struct flowi_tunnel flowic_tun_key; |
| 46 | struct flowi_xfrm xfrm; | ||
| 42 | kuid_t flowic_uid; | 47 | kuid_t flowic_uid; |
| 43 | }; | 48 | }; |
| 44 | 49 | ||
| @@ -78,6 +83,7 @@ struct flowi4 { · 33 unmodified lines | |||
| 78 | #define flowi4_secid __fl_common.flowic_secid | 83 | #define flowi4_secid __fl_common.flowic_secid |
| 79 | #define flowi4_tun_key __fl_common.flowic_tun_key | 84 | #define flowi4_tun_key __fl_common.flowic_tun_key |
| 80 | #define flowi4_uid __fl_common.flowic_uid | 85 | #define flowi4_uid __fl_common.flowic_uid |
| 86 | #define flowi4_xfrm __fl_common.xfrm | ||
| 81 | 87 | ||
| 82 | /* (saddr,daddr) must be grouped, same order as in IP header */ | 88 | /* (saddr,daddr) must be grouped, same order as in IP header */ |
| 83 | __be32 saddr; | 89 | __be32 saddr; |
| @@ -109,6 +115,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, · 25 unmodified lines | |||
| 109 | fl4->flowi4_flags = flags; | 115 | fl4->flowi4_flags = flags; |
| 110 | fl4->flowi4_secid = 0; | 116 | fl4->flowi4_secid = 0; |
| 111 | fl4->flowi4_tun_key.tun_id = 0; | 117 | fl4->flowi4_tun_key.tun_id = 0; |
| 118 | fl4->flowi4_xfrm.if_id = 0; | ||
| 112 | fl4->flowi4_uid = uid; | 119 | fl4->flowi4_uid = uid; |
| 113 | fl4->daddr = daddr; | 120 | fl4->daddr = daddr; |
| 114 | fl4->saddr = saddr; | 121 | fl4->saddr = saddr; |
| @@ -138,6 +145,7 @@ struct flowi6 { · 23 unmodified lines | |||
| 138 | #define flowi6_secid __fl_common.flowic_secid | 145 | #define flowi6_secid __fl_common.flowic_secid |
| 139 | #define flowi6_tun_key __fl_common.flowic_tun_key | 146 | #define flowi6_tun_key __fl_common.flowic_tun_key |
| 140 | #define flowi6_uid __fl_common.flowic_uid | 147 | #define flowi6_uid __fl_common.flowic_uid |
| 148 | #define flowi6_xfrm __fl_common.xfrm | ||
| 141 | struct in6_addr daddr; | 149 | struct in6_addr daddr; |
| 142 | struct in6_addr saddr; | 150 | struct in6_addr saddr; |
| 143 | /* Note: flowi6_tos is encoded in flowlabel, too. */ | 151 | /* Note: flowi6_tos is encoded in flowlabel, too. */ |
| @@ -185,6 +193,7 @@ struct flowi { · 41 unmodified lines | |||
| 185 | #define flowi_secid u.__fl_common.flowic_secid | 193 | #define flowi_secid u.__fl_common.flowic_secid |
| 186 | #define flowi_tun_key u.__fl_common.flowic_tun_key | 194 | #define flowi_tun_key u.__fl_common.flowic_tun_key |
| 187 | #define flowi_uid u.__fl_common.flowic_uid | 195 | #define flowi_uid u.__fl_common.flowic_uid |
| 196 | #define flowi_xfrm u.__fl_common.xfrm | ||
| 188 | } __attribute__((__aligned__(BITS_PER_LONG/8))); | 197 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
| 189 | 198 | ||
| 190 | static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) | 199 | static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) |