forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: mptcp: use policy generated by YAML spec
generated with: $ ./tools/net/ynl/ynl-gen-c.py --mode kernel \ > --spec Documentation/netlink/specs/mptcp.yaml --source \ > -o net/mptcp/mptcp_pm_gen.c $ ./tools/net/ynl/ynl-gen-c.py --mode kernel \ > --spec Documentation/netlink/specs/mptcp.yaml --header \ > -o net/mptcp/mptcp_pm_gen.h Link: multipath-tcp/mptcp_net-next#340 Acked-by: Paolo Abeni <[email protected]> Signed-off-by: Davide Caratti <[email protected]>
- Loading branch information
1 parent
5face0a
commit c873dd5
Showing
5 changed files
with
250 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) | ||
/* Do not edit directly, auto-generated from: */ | ||
/* Documentation/netlink/specs/mptcp.yaml */ | ||
/* YNL-GEN kernel source */ | ||
|
||
#include <net/netlink.h> | ||
#include <net/genetlink.h> | ||
|
||
#include "mptcp_pm_gen.h" | ||
|
||
#include <uapi/linux/mptcp_pm.h> | ||
|
||
/* Common nested types */ | ||
const struct nla_policy mptcp_pm_address_nl_policy[MPTCP_PM_ADDR_ATTR_IF_IDX + 1] = { | ||
[MPTCP_PM_ADDR_ATTR_FAMILY] = { .type = NLA_U16, }, | ||
[MPTCP_PM_ADDR_ATTR_ID] = { .type = NLA_U8, }, | ||
[MPTCP_PM_ADDR_ATTR_ADDR4] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ADDR_ATTR_ADDR6] = { .len = 16, }, | ||
[MPTCP_PM_ADDR_ATTR_PORT] = { .type = NLA_U16, }, | ||
[MPTCP_PM_ADDR_ATTR_FLAGS] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ADDR_ATTR_IF_IDX] = { .type = NLA_S32, }, | ||
}; | ||
|
||
/* MPTCP_PM_CMD_ADD_ADDR - do */ | ||
const struct nla_policy mptcp_pm_add_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = { | ||
[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* MPTCP_PM_CMD_DEL_ADDR - do */ | ||
const struct nla_policy mptcp_pm_del_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = { | ||
[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* MPTCP_PM_CMD_GET_ADDR - do */ | ||
const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = { | ||
[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* MPTCP_PM_CMD_FLUSH_ADDRS - do */ | ||
const struct nla_policy mptcp_pm_flush_addrs_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = { | ||
[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* MPTCP_PM_CMD_SET_LIMITS - do */ | ||
const struct nla_policy mptcp_pm_set_limits_nl_policy[MPTCP_PM_ATTR_SUBFLOWS + 1] = { | ||
[MPTCP_PM_ATTR_RCV_ADD_ADDRS] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ATTR_SUBFLOWS] = { .type = NLA_U32, }, | ||
}; | ||
|
||
/* MPTCP_PM_CMD_GET_LIMITS - do */ | ||
const struct nla_policy mptcp_pm_get_limits_nl_policy[MPTCP_PM_ATTR_SUBFLOWS + 1] = { | ||
[MPTCP_PM_ATTR_RCV_ADD_ADDRS] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ATTR_SUBFLOWS] = { .type = NLA_U32, }, | ||
}; | ||
|
||
/* MPTCP_PM_CMD_SET_FLAGS - do */ | ||
const struct nla_policy mptcp_pm_set_flags_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1] = { | ||
[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ATTR_ADDR_REMOTE] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* MPTCP_PM_CMD_ANNOUNCE - do */ | ||
const struct nla_policy mptcp_pm_announce_nl_policy[MPTCP_PM_ATTR_TOKEN + 1] = { | ||
[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, }, | ||
}; | ||
|
||
/* MPTCP_PM_CMD_REMOVE - do */ | ||
const struct nla_policy mptcp_pm_remove_nl_policy[MPTCP_PM_ATTR_LOC_ID + 1] = { | ||
[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ATTR_LOC_ID] = { .type = NLA_U8, }, | ||
}; | ||
|
||
/* MPTCP_PM_CMD_SUBFLOW_CREATE - do */ | ||
const struct nla_policy mptcp_pm_subflow_create_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1] = { | ||
[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ATTR_ADDR_REMOTE] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* MPTCP_PM_CMD_SUBFLOW_DESTROY - do */ | ||
const struct nla_policy mptcp_pm_subflow_destroy_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1] = { | ||
[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, }, | ||
[MPTCP_PM_ATTR_ADDR_REMOTE] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), | ||
}; | ||
|
||
/* Ops table for mptcp_pm */ | ||
const struct genl_ops mptcp_pm_nl_ops[11] = { | ||
{ | ||
.cmd = MPTCP_PM_CMD_ADD_ADDR, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_add_addr_doit, | ||
.policy = mptcp_pm_add_addr_nl_policy, | ||
.maxattr = MPTCP_PM_ENDPOINT_ADDR, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_DEL_ADDR, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_del_addr_doit, | ||
.policy = mptcp_pm_del_addr_nl_policy, | ||
.maxattr = MPTCP_PM_ENDPOINT_ADDR, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_GET_ADDR, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_get_addr_doit, | ||
.dumpit = mptcp_pm_nl_get_addr_dumpit, | ||
.policy = mptcp_pm_get_addr_nl_policy, | ||
.maxattr = MPTCP_PM_ENDPOINT_ADDR, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_FLUSH_ADDRS, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_flush_addrs_doit, | ||
.policy = mptcp_pm_flush_addrs_nl_policy, | ||
.maxattr = MPTCP_PM_ENDPOINT_ADDR, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_SET_LIMITS, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_set_limits_doit, | ||
.policy = mptcp_pm_set_limits_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_SUBFLOWS, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_GET_LIMITS, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_get_limits_doit, | ||
.policy = mptcp_pm_get_limits_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_SUBFLOWS, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_SET_FLAGS, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_set_flags_doit, | ||
.policy = mptcp_pm_set_flags_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_ADDR_REMOTE, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_ANNOUNCE, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_announce_doit, | ||
.policy = mptcp_pm_announce_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_TOKEN, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_REMOVE, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_remove_doit, | ||
.policy = mptcp_pm_remove_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_LOC_ID, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_SUBFLOW_CREATE, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_subflow_create_doit, | ||
.policy = mptcp_pm_subflow_create_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_ADDR_REMOTE, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
{ | ||
.cmd = MPTCP_PM_CMD_SUBFLOW_DESTROY, | ||
.validate = GENL_DONT_VALIDATE_STRICT, | ||
.doit = mptcp_pm_nl_subflow_destroy_doit, | ||
.policy = mptcp_pm_subflow_destroy_nl_policy, | ||
.maxattr = MPTCP_PM_ATTR_ADDR_REMOTE, | ||
.flags = GENL_UNS_ADMIN_PERM, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ | ||
/* Do not edit directly, auto-generated from: */ | ||
/* Documentation/netlink/specs/mptcp.yaml */ | ||
/* YNL-GEN kernel header */ | ||
|
||
#ifndef _LINUX_MPTCP_PM_GEN_H | ||
#define _LINUX_MPTCP_PM_GEN_H | ||
|
||
#include <net/netlink.h> | ||
#include <net/genetlink.h> | ||
|
||
#include <uapi/linux/mptcp_pm.h> | ||
|
||
/* Common nested types */ | ||
extern const struct nla_policy mptcp_pm_address_nl_policy[MPTCP_PM_ADDR_ATTR_IF_IDX + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_add_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_del_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_flush_addrs_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_set_limits_nl_policy[MPTCP_PM_ATTR_SUBFLOWS + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_get_limits_nl_policy[MPTCP_PM_ATTR_SUBFLOWS + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_set_flags_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_announce_nl_policy[MPTCP_PM_ATTR_TOKEN + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_remove_nl_policy[MPTCP_PM_ATTR_LOC_ID + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_subflow_create_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1]; | ||
|
||
extern const struct nla_policy mptcp_pm_subflow_destroy_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1]; | ||
|
||
/* Ops table for mptcp_pm */ | ||
extern const struct genl_ops mptcp_pm_nl_ops[11]; | ||
|
||
int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *skb, | ||
struct netlink_callback *cb); | ||
int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_set_limits_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_get_limits_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info); | ||
int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, | ||
struct genl_info *info); | ||
int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, | ||
struct genl_info *info); | ||
|
||
#endif /* _LINUX_MPTCP_PM_GEN_H */ |
Oops, something went wrong.