mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
[NET_SCHED]: policer: restore compatibility with old iproute binaries
The tc actions increased the size of struct tc_police, which broke compatibility with old iproute binaries since both the act_police and the old NET_CLS_POLICE code check for an exact size match. Since the new members are not even used, the simple fix is to also accept the size of the old structure. Dumping is not affected since old userspace will receive a bigger structure, which is handled fine. Signed-off-by: Patrick McHardy <kaber@trash.net> Acked-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5f68e4c07c
commit
1e9b3d5339
1 changed files with 22 additions and 4 deletions
|
@ -46,6 +46,18 @@ static struct tcf_hashinfo police_hash_info = {
|
||||||
.lock = &police_lock,
|
.lock = &police_lock,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* old policer structure from before tc actions */
|
||||||
|
struct tc_police_compat
|
||||||
|
{
|
||||||
|
u32 index;
|
||||||
|
int action;
|
||||||
|
u32 limit;
|
||||||
|
u32 burst;
|
||||||
|
u32 mtu;
|
||||||
|
struct tc_ratespec rate;
|
||||||
|
struct tc_ratespec peakrate;
|
||||||
|
};
|
||||||
|
|
||||||
/* Each policer is serialized by its individual spinlock */
|
/* Each policer is serialized by its individual spinlock */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_CLS_ACT
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
|
@ -131,12 +143,15 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
|
||||||
struct tc_police *parm;
|
struct tc_police *parm;
|
||||||
struct tcf_police *police;
|
struct tcf_police *police;
|
||||||
struct qdisc_rate_table *R_tab = NULL, *P_tab = NULL;
|
struct qdisc_rate_table *R_tab = NULL, *P_tab = NULL;
|
||||||
|
int size;
|
||||||
|
|
||||||
if (rta == NULL || rtattr_parse_nested(tb, TCA_POLICE_MAX, rta) < 0)
|
if (rta == NULL || rtattr_parse_nested(tb, TCA_POLICE_MAX, rta) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (tb[TCA_POLICE_TBF-1] == NULL ||
|
if (tb[TCA_POLICE_TBF-1] == NULL)
|
||||||
RTA_PAYLOAD(tb[TCA_POLICE_TBF-1]) != sizeof(*parm))
|
return -EINVAL;
|
||||||
|
size = RTA_PAYLOAD(tb[TCA_POLICE_TBF-1]);
|
||||||
|
if (size != sizeof(*parm) && size != sizeof(struct tc_police_compat))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
parm = RTA_DATA(tb[TCA_POLICE_TBF-1]);
|
parm = RTA_DATA(tb[TCA_POLICE_TBF-1]);
|
||||||
|
|
||||||
|
@ -415,12 +430,15 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est)
|
||||||
struct tcf_police *police;
|
struct tcf_police *police;
|
||||||
struct rtattr *tb[TCA_POLICE_MAX];
|
struct rtattr *tb[TCA_POLICE_MAX];
|
||||||
struct tc_police *parm;
|
struct tc_police *parm;
|
||||||
|
int size;
|
||||||
|
|
||||||
if (rtattr_parse_nested(tb, TCA_POLICE_MAX, rta) < 0)
|
if (rtattr_parse_nested(tb, TCA_POLICE_MAX, rta) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (tb[TCA_POLICE_TBF-1] == NULL ||
|
if (tb[TCA_POLICE_TBF-1] == NULL)
|
||||||
RTA_PAYLOAD(tb[TCA_POLICE_TBF-1]) != sizeof(*parm))
|
return NULL;
|
||||||
|
size = RTA_PAYLOAD(tb[TCA_POLICE_TBF-1]);
|
||||||
|
if (size != sizeof(*parm) && size != sizeof(struct tc_police_compat))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
parm = RTA_DATA(tb[TCA_POLICE_TBF-1]);
|
parm = RTA_DATA(tb[TCA_POLICE_TBF-1]);
|
||||||
|
|
Loading…
Reference in a new issue