Commit 3a6c2b41 authored by Patrick McHardy's avatar Patrick McHardy

netlink: constify nlmsghdr arguments

Consitfy nlmsghdr arguments to a couple of functions as preparation
for the next patch, which will constify the netlink message data in
all nfnetlink users.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 74f7a655
...@@ -218,8 +218,9 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb); ...@@ -218,8 +218,9 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
struct netlink_callback struct netlink_callback
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct nlmsghdr *nlh; const struct nlmsghdr *nlh;
int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); int (*dump)(struct sk_buff * skb,
struct netlink_callback *cb);
int (*done)(struct netlink_callback *cb); int (*done)(struct netlink_callback *cb);
int family; int family;
long args[6]; long args[6];
...@@ -258,7 +259,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) ...@@ -258,7 +259,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
NLMSG_NEW(skb, pid, seq, type, len, 0) NLMSG_NEW(skb, pid, seq, type, len, 0)
extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
struct nlmsghdr *nlh, const struct nlmsghdr *nlh,
int (*dump)(struct sk_buff *skb, struct netlink_callback*), int (*dump)(struct sk_buff *skb, struct netlink_callback*),
int (*done)(struct netlink_callback*)); int (*done)(struct netlink_callback*));
......
...@@ -365,7 +365,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining) ...@@ -365,7 +365,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
* *
* See nla_parse() * See nla_parse()
*/ */
static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
struct nlattr *tb[], int maxtype, struct nlattr *tb[], int maxtype,
const struct nla_policy *policy) const struct nla_policy *policy)
{ {
...@@ -414,7 +414,7 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, ...@@ -414,7 +414,7 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
* *
* Returns 1 if a report back to the application is requested. * Returns 1 if a report back to the application is requested.
*/ */
static inline int nlmsg_report(struct nlmsghdr *nlh) static inline int nlmsg_report(const struct nlmsghdr *nlh)
{ {
return !!(nlh->nlmsg_flags & NLM_F_ECHO); return !!(nlh->nlmsg_flags & NLM_F_ECHO);
} }
......
...@@ -14,7 +14,7 @@ extern void rtnl_register(int protocol, int msgtype, ...@@ -14,7 +14,7 @@ extern void rtnl_register(int protocol, int msgtype,
extern int rtnl_unregister(int protocol, int msgtype); extern int rtnl_unregister(int protocol, int msgtype);
extern void rtnl_unregister_all(int protocol); extern void rtnl_unregister_all(int protocol);
static inline int rtnl_msg_family(struct nlmsghdr *nlh) static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
{ {
if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
......
...@@ -1705,7 +1705,7 @@ static int netlink_dump(struct sock *sk) ...@@ -1705,7 +1705,7 @@ static int netlink_dump(struct sock *sk)
} }
int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
struct nlmsghdr *nlh, const struct nlmsghdr *nlh,
int (*dump)(struct sk_buff *skb, int (*dump)(struct sk_buff *skb,
struct netlink_callback *), struct netlink_callback *),
int (*done)(struct netlink_callback *)) int (*done)(struct netlink_callback *))
......
...@@ -1011,7 +1011,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) ...@@ -1011,7 +1011,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
} }
static struct nlattr * static struct nlattr *
find_dump_kind(struct nlmsghdr *n) find_dump_kind(const struct nlmsghdr *n)
{ {
struct nlattr *tb1, *tb2[TCA_ACT_MAX+1]; struct nlattr *tb1, *tb2[TCA_ACT_MAX+1];
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment