[IPSEC]: Kill obsolete get_mss function
Now that we've switched over to storing MTUs in the xfrm_dst entries, we no longer need the dst's get_mss methods. This patch gets rid of them. It also documents the fact that our MTU calculation is not optimal for ESP. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
1371e37da2
commit
80b30c1023
@ -94,7 +94,6 @@ struct dst_ops
|
|||||||
struct dst_entry * (*negative_advice)(struct dst_entry *);
|
struct dst_entry * (*negative_advice)(struct dst_entry *);
|
||||||
void (*link_failure)(struct sk_buff *);
|
void (*link_failure)(struct sk_buff *);
|
||||||
void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
|
void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
|
||||||
int (*get_mss)(struct dst_entry *dst, u32 mtu);
|
|
||||||
int entry_size;
|
int entry_size;
|
||||||
|
|
||||||
atomic_t entries;
|
atomic_t entries;
|
||||||
|
@ -1192,46 +1192,6 @@ int xfrm_bundle_ok(struct xfrm_dst *first, struct flowi *fl, int family)
|
|||||||
|
|
||||||
EXPORT_SYMBOL(xfrm_bundle_ok);
|
EXPORT_SYMBOL(xfrm_bundle_ok);
|
||||||
|
|
||||||
/* Well... that's _TASK_. We need to scan through transformation
|
|
||||||
* list and figure out what mss tcp should generate in order to
|
|
||||||
* final datagram fit to mtu. Mama mia... :-)
|
|
||||||
*
|
|
||||||
* Apparently, some easy way exists, but we used to choose the most
|
|
||||||
* bizarre ones. :-) So, raising Kalashnikov... tra-ta-ta.
|
|
||||||
*
|
|
||||||
* Consider this function as something like dark humour. :-)
|
|
||||||
*/
|
|
||||||
static int xfrm_get_mss(struct dst_entry *dst, u32 mtu)
|
|
||||||
{
|
|
||||||
int res = mtu - dst->header_len;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
struct dst_entry *d = dst;
|
|
||||||
int m = res;
|
|
||||||
|
|
||||||
do {
|
|
||||||
struct xfrm_state *x = d->xfrm;
|
|
||||||
if (x) {
|
|
||||||
spin_lock_bh(&x->lock);
|
|
||||||
if (x->km.state == XFRM_STATE_VALID &&
|
|
||||||
x->type && x->type->get_max_size)
|
|
||||||
m = x->type->get_max_size(d->xfrm, m);
|
|
||||||
else
|
|
||||||
m += x->props.header_len;
|
|
||||||
spin_unlock_bh(&x->lock);
|
|
||||||
}
|
|
||||||
} while ((d = d->child) != NULL);
|
|
||||||
|
|
||||||
if (m <= mtu)
|
|
||||||
break;
|
|
||||||
res -= (m - mtu);
|
|
||||||
if (res < 88)
|
|
||||||
return mtu;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res + dst->header_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
|
int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -1252,8 +1212,6 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
|
|||||||
dst_ops->negative_advice = xfrm_negative_advice;
|
dst_ops->negative_advice = xfrm_negative_advice;
|
||||||
if (likely(dst_ops->link_failure == NULL))
|
if (likely(dst_ops->link_failure == NULL))
|
||||||
dst_ops->link_failure = xfrm_link_failure;
|
dst_ops->link_failure = xfrm_link_failure;
|
||||||
if (likely(dst_ops->get_mss == NULL))
|
|
||||||
dst_ops->get_mss = xfrm_get_mss;
|
|
||||||
if (likely(afinfo->garbage_collect == NULL))
|
if (likely(afinfo->garbage_collect == NULL))
|
||||||
afinfo->garbage_collect = __xfrm_garbage_collect;
|
afinfo->garbage_collect = __xfrm_garbage_collect;
|
||||||
xfrm_policy_afinfo[afinfo->family] = afinfo;
|
xfrm_policy_afinfo[afinfo->family] = afinfo;
|
||||||
@ -1281,7 +1239,6 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
|
|||||||
dst_ops->check = NULL;
|
dst_ops->check = NULL;
|
||||||
dst_ops->negative_advice = NULL;
|
dst_ops->negative_advice = NULL;
|
||||||
dst_ops->link_failure = NULL;
|
dst_ops->link_failure = NULL;
|
||||||
dst_ops->get_mss = NULL;
|
|
||||||
afinfo->garbage_collect = NULL;
|
afinfo->garbage_collect = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1026,6 +1026,12 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(xfrm_state_delete_tunnel);
|
EXPORT_SYMBOL(xfrm_state_delete_tunnel);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is NOT optimal. For example, with ESP it will give an
|
||||||
|
* MTU that's usually two bytes short of being optimal. However, it will
|
||||||
|
* usually give an answer that's a multiple of 4 provided the input is
|
||||||
|
* also a multiple of 4.
|
||||||
|
*/
|
||||||
int xfrm_state_mtu(struct xfrm_state *x, int mtu)
|
int xfrm_state_mtu(struct xfrm_state *x, int mtu)
|
||||||
{
|
{
|
||||||
int res = mtu;
|
int res = mtu;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user