diff options
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 43 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 6 |
2 files changed, 6 insertions, 43 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index cbb0ba34a600..0db9e57013fd 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1192,46 +1192,6 @@ int xfrm_bundle_ok(struct xfrm_dst *first, struct flowi *fl, int family) | |||
1192 | 1192 | ||
1193 | EXPORT_SYMBOL(xfrm_bundle_ok); | 1193 | EXPORT_SYMBOL(xfrm_bundle_ok); |
1194 | 1194 | ||
1195 | /* Well... that's _TASK_. We need to scan through transformation | ||
1196 | * list and figure out what mss tcp should generate in order to | ||
1197 | * final datagram fit to mtu. Mama mia... :-) | ||
1198 | * | ||
1199 | * Apparently, some easy way exists, but we used to choose the most | ||
1200 | * bizarre ones. :-) So, raising Kalashnikov... tra-ta-ta. | ||
1201 | * | ||
1202 | * Consider this function as something like dark humour. :-) | ||
1203 | */ | ||
1204 | static int xfrm_get_mss(struct dst_entry *dst, u32 mtu) | ||
1205 | { | ||
1206 | int res = mtu - dst->header_len; | ||
1207 | |||
1208 | for (;;) { | ||
1209 | struct dst_entry *d = dst; | ||
1210 | int m = res; | ||
1211 | |||
1212 | do { | ||
1213 | struct xfrm_state *x = d->xfrm; | ||
1214 | if (x) { | ||
1215 | spin_lock_bh(&x->lock); | ||
1216 | if (x->km.state == XFRM_STATE_VALID && | ||
1217 | x->type && x->type->get_max_size) | ||
1218 | m = x->type->get_max_size(d->xfrm, m); | ||
1219 | else | ||
1220 | m += x->props.header_len; | ||
1221 | spin_unlock_bh(&x->lock); | ||
1222 | } | ||
1223 | } while ((d = d->child) != NULL); | ||
1224 | |||
1225 | if (m <= mtu) | ||
1226 | break; | ||
1227 | res -= (m - mtu); | ||
1228 | if (res < 88) | ||
1229 | return mtu; | ||
1230 | } | ||
1231 | |||
1232 | return res + dst->header_len; | ||
1233 | } | ||
1234 | |||
1235 | int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | 1195 | int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) |
1236 | { | 1196 | { |
1237 | int err = 0; | 1197 | int err = 0; |
@@ -1252,8 +1212,6 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
1252 | dst_ops->negative_advice = xfrm_negative_advice; | 1212 | dst_ops->negative_advice = xfrm_negative_advice; |
1253 | if (likely(dst_ops->link_failure == NULL)) | 1213 | if (likely(dst_ops->link_failure == NULL)) |
1254 | dst_ops->link_failure = xfrm_link_failure; | 1214 | dst_ops->link_failure = xfrm_link_failure; |
1255 | if (likely(dst_ops->get_mss == NULL)) | ||
1256 | dst_ops->get_mss = xfrm_get_mss; | ||
1257 | if (likely(afinfo->garbage_collect == NULL)) | 1215 | if (likely(afinfo->garbage_collect == NULL)) |
1258 | afinfo->garbage_collect = __xfrm_garbage_collect; | 1216 | afinfo->garbage_collect = __xfrm_garbage_collect; |
1259 | xfrm_policy_afinfo[afinfo->family] = afinfo; | 1217 | xfrm_policy_afinfo[afinfo->family] = afinfo; |
@@ -1281,7 +1239,6 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
1281 | dst_ops->check = NULL; | 1239 | dst_ops->check = NULL; |
1282 | dst_ops->negative_advice = NULL; | 1240 | dst_ops->negative_advice = NULL; |
1283 | dst_ops->link_failure = NULL; | 1241 | dst_ops->link_failure = NULL; |
1284 | dst_ops->get_mss = NULL; | ||
1285 | afinfo->garbage_collect = NULL; | 1242 | afinfo->garbage_collect = NULL; |
1286 | } | 1243 | } |
1287 | } | 1244 | } |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 9d206c282cf1..8b9a4747417d 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1026,6 +1026,12 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x) | |||
1026 | } | 1026 | } |
1027 | EXPORT_SYMBOL(xfrm_state_delete_tunnel); | 1027 | EXPORT_SYMBOL(xfrm_state_delete_tunnel); |
1028 | 1028 | ||
1029 | /* | ||
1030 | * This function is NOT optimal. For example, with ESP it will give an | ||
1031 | * MTU that's usually two bytes short of being optimal. However, it will | ||
1032 | * usually give an answer that's a multiple of 4 provided the input is | ||
1033 | * also a multiple of 4. | ||
1034 | */ | ||
1029 | int xfrm_state_mtu(struct xfrm_state *x, int mtu) | 1035 | int xfrm_state_mtu(struct xfrm_state *x, int mtu) |
1030 | { | 1036 | { |
1031 | int res = mtu; | 1037 | int res = mtu; |