mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
280 lines
9.6 KiB
Diff
280 lines
9.6 KiB
Diff
From ca31fb1ed58c293b3f02b1aa46aa672866aff540 Mon Sep 17 00:00:00 2001
|
|
From: Marty Jones <mj8263788@gmail.com>
|
|
Date: Thu, 17 Aug 2023 17:06:55 -0400
|
|
Subject: [PATCH 7/8] Revert "genetlink: remove userhdr from struct genl_info"
|
|
|
|
This reverts commit bffcc6882a1bb2be8c9420184966f4c2c822078e.
|
|
---
|
|
drivers/block/drbd/drbd_nl.c | 9 ++++-----
|
|
include/net/genetlink.h | 7 ++-----
|
|
net/netlink/genetlink.c | 1 +
|
|
net/openvswitch/conntrack.c | 2 +-
|
|
net/openvswitch/datapath.c | 29 +++++++++++++----------------
|
|
net/openvswitch/meter.c | 10 +++++-----
|
|
net/tipc/netlink_compat.c | 2 +-
|
|
7 files changed, 27 insertions(+), 33 deletions(-)
|
|
|
|
--- a/drivers/block/drbd/drbd_nl.c
|
|
+++ b/drivers/block/drbd/drbd_nl.c
|
|
@@ -159,7 +159,7 @@ static int drbd_msg_sprintf_info(struct
|
|
static int drbd_adm_prepare(struct drbd_config_context *adm_ctx,
|
|
struct sk_buff *skb, struct genl_info *info, unsigned flags)
|
|
{
|
|
- struct drbd_genlmsghdr *d_in = genl_info_userhdr(info);
|
|
+ struct drbd_genlmsghdr *d_in = info->userhdr;
|
|
const u8 cmd = info->genlhdr->cmd;
|
|
int err;
|
|
|
|
@@ -1396,9 +1396,8 @@ static void drbd_suspend_al(struct drbd_
|
|
|
|
static bool should_set_defaults(struct genl_info *info)
|
|
{
|
|
- struct drbd_genlmsghdr *dh = genl_info_userhdr(info);
|
|
-
|
|
- return 0 != (dh->flags & DRBD_GENL_F_SET_DEFAULTS);
|
|
+ unsigned flags = ((struct drbd_genlmsghdr*)info->userhdr)->flags;
|
|
+ return 0 != (flags & DRBD_GENL_F_SET_DEFAULTS);
|
|
}
|
|
|
|
static unsigned int drbd_al_extents_max(struct drbd_backing_dev *bdev)
|
|
@@ -4277,7 +4276,7 @@ static void device_to_info(struct device
|
|
int drbd_adm_new_minor(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
struct drbd_config_context adm_ctx;
|
|
- struct drbd_genlmsghdr *dh = genl_info_userhdr(info);
|
|
+ struct drbd_genlmsghdr *dh = info->userhdr;
|
|
enum drbd_ret_code retcode;
|
|
|
|
retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_RESOURCE);
|
|
--- a/include/net/genetlink.h
|
|
+++ b/include/net/genetlink.h
|
|
@@ -98,6 +98,7 @@ struct genl_family {
|
|
* @family: generic netlink family
|
|
* @nlhdr: netlink message header
|
|
* @genlhdr: generic netlink message header
|
|
+ * @userhdr: user specific header
|
|
* @attrs: netlink attributes
|
|
* @_net: network namespace
|
|
* @user_ptr: user pointers
|
|
@@ -109,6 +110,7 @@ struct genl_info {
|
|
const struct genl_family *family;
|
|
const struct nlmsghdr * nlhdr;
|
|
struct genlmsghdr * genlhdr;
|
|
+ void * userhdr;
|
|
struct nlattr ** attrs;
|
|
possible_net_t _net;
|
|
void * user_ptr[2];
|
|
@@ -125,11 +127,6 @@ static inline void genl_info_net_set(str
|
|
write_pnet(&info->_net, net);
|
|
}
|
|
|
|
-static inline void *genl_info_userhdr(const struct genl_info *info)
|
|
-{
|
|
- return (u8 *)info->genlhdr + GENL_HDRLEN;
|
|
-}
|
|
-
|
|
#define GENL_SET_ERR_MSG(info, msg) NL_SET_ERR_MSG((info)->extack, msg)
|
|
|
|
#define GENL_SET_ERR_MSG_FMT(info, msg, args...) \
|
|
--- a/net/netlink/genetlink.c
|
|
+++ b/net/netlink/genetlink.c
|
|
@@ -957,6 +957,7 @@ static int genl_family_rcv_msg_doit(cons
|
|
info.family = family;
|
|
info.nlhdr = nlh;
|
|
info.genlhdr = nlmsg_data(nlh);
|
|
+ info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN;
|
|
info.attrs = attrbuf;
|
|
info.extack = extack;
|
|
genl_info_net_set(&info, net);
|
|
--- a/net/openvswitch/conntrack.c
|
|
+++ b/net/openvswitch/conntrack.c
|
|
@@ -1605,7 +1605,7 @@ static struct sk_buff *
|
|
ovs_ct_limit_cmd_reply_start(struct genl_info *info, u8 cmd,
|
|
struct ovs_header **ovs_reply_header)
|
|
{
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct sk_buff *skb;
|
|
|
|
skb = genlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
|
--- a/net/openvswitch/datapath.c
|
|
+++ b/net/openvswitch/datapath.c
|
|
@@ -590,7 +590,7 @@ out:
|
|
|
|
static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct net *net = sock_net(skb->sk);
|
|
struct nlattr **a = info->attrs;
|
|
struct sw_flow_actions *acts;
|
|
@@ -967,7 +967,7 @@ static int ovs_flow_cmd_new(struct sk_bu
|
|
{
|
|
struct net *net = sock_net(skb->sk);
|
|
struct nlattr **a = info->attrs;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct sw_flow *flow = NULL, *new_flow;
|
|
struct sw_flow_mask mask;
|
|
struct sk_buff *reply;
|
|
@@ -1214,7 +1214,7 @@ static int ovs_flow_cmd_set(struct sk_bu
|
|
{
|
|
struct net *net = sock_net(skb->sk);
|
|
struct nlattr **a = info->attrs;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct sw_flow_key key;
|
|
struct sw_flow *flow;
|
|
struct sk_buff *reply = NULL;
|
|
@@ -1315,7 +1315,7 @@ error:
|
|
static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
struct nlattr **a = info->attrs;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct net *net = sock_net(skb->sk);
|
|
struct sw_flow_key key;
|
|
struct sk_buff *reply;
|
|
@@ -1374,7 +1374,7 @@ unlock:
|
|
static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
struct nlattr **a = info->attrs;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct net *net = sock_net(skb->sk);
|
|
struct sw_flow_key key;
|
|
struct sk_buff *reply;
|
|
@@ -1642,7 +1642,7 @@ static void ovs_dp_reset_user_features(s
|
|
{
|
|
struct datapath *dp;
|
|
|
|
- dp = lookup_datapath(sock_net(skb->sk), genl_info_userhdr(info),
|
|
+ dp = lookup_datapath(sock_net(skb->sk), info->userhdr,
|
|
info->attrs);
|
|
if (IS_ERR(dp))
|
|
return;
|
|
@@ -1935,8 +1935,7 @@ static int ovs_dp_cmd_del(struct sk_buff
|
|
return -ENOMEM;
|
|
|
|
ovs_lock();
|
|
- dp = lookup_datapath(sock_net(skb->sk), genl_info_userhdr(info),
|
|
- info->attrs);
|
|
+ dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
|
|
err = PTR_ERR(dp);
|
|
if (IS_ERR(dp))
|
|
goto err_unlock_free;
|
|
@@ -1969,8 +1968,7 @@ static int ovs_dp_cmd_set(struct sk_buff
|
|
return -ENOMEM;
|
|
|
|
ovs_lock();
|
|
- dp = lookup_datapath(sock_net(skb->sk), genl_info_userhdr(info),
|
|
- info->attrs);
|
|
+ dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
|
|
err = PTR_ERR(dp);
|
|
if (IS_ERR(dp))
|
|
goto err_unlock_free;
|
|
@@ -2005,8 +2003,7 @@ static int ovs_dp_cmd_get(struct sk_buff
|
|
return -ENOMEM;
|
|
|
|
ovs_lock();
|
|
- dp = lookup_datapath(sock_net(skb->sk), genl_info_userhdr(info),
|
|
- info->attrs);
|
|
+ dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
|
|
if (IS_ERR(dp)) {
|
|
err = PTR_ERR(dp);
|
|
goto err_unlock_free;
|
|
@@ -2249,7 +2246,7 @@ static void ovs_update_headroom(struct d
|
|
static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
struct nlattr **a = info->attrs;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct vport_parms parms;
|
|
struct sk_buff *reply;
|
|
struct vport *vport;
|
|
@@ -2351,7 +2348,7 @@ static int ovs_vport_cmd_set(struct sk_b
|
|
return -ENOMEM;
|
|
|
|
ovs_lock();
|
|
- vport = lookup_vport(sock_net(skb->sk), genl_info_userhdr(info), a);
|
|
+ vport = lookup_vport(sock_net(skb->sk), info->userhdr, a);
|
|
err = PTR_ERR(vport);
|
|
if (IS_ERR(vport))
|
|
goto exit_unlock_free;
|
|
@@ -2407,7 +2404,7 @@ static int ovs_vport_cmd_del(struct sk_b
|
|
return -ENOMEM;
|
|
|
|
ovs_lock();
|
|
- vport = lookup_vport(sock_net(skb->sk), genl_info_userhdr(info), a);
|
|
+ vport = lookup_vport(sock_net(skb->sk), info->userhdr, a);
|
|
err = PTR_ERR(vport);
|
|
if (IS_ERR(vport))
|
|
goto exit_unlock_free;
|
|
@@ -2450,7 +2447,7 @@ exit_unlock_free:
|
|
static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
struct nlattr **a = info->attrs;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct sk_buff *reply;
|
|
struct vport *vport;
|
|
int err;
|
|
--- a/net/openvswitch/meter.c
|
|
+++ b/net/openvswitch/meter.c
|
|
@@ -211,7 +211,7 @@ ovs_meter_cmd_reply_start(struct genl_in
|
|
struct ovs_header **ovs_reply_header)
|
|
{
|
|
struct sk_buff *skb;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
|
|
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
|
|
if (!skb)
|
|
@@ -272,7 +272,7 @@ error:
|
|
|
|
static int ovs_meter_cmd_features(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct ovs_header *ovs_reply_header;
|
|
struct nlattr *nla, *band_nla;
|
|
struct sk_buff *reply;
|
|
@@ -409,7 +409,7 @@ static int ovs_meter_cmd_set(struct sk_b
|
|
struct dp_meter *meter, *old_meter;
|
|
struct sk_buff *reply;
|
|
struct ovs_header *ovs_reply_header;
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct dp_meter_table *meter_tbl;
|
|
struct datapath *dp;
|
|
int err;
|
|
@@ -482,7 +482,7 @@ exit_free_meter:
|
|
|
|
static int ovs_meter_cmd_get(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct ovs_header *ovs_reply_header;
|
|
struct nlattr **a = info->attrs;
|
|
struct dp_meter *meter;
|
|
@@ -535,7 +535,7 @@ exit_unlock:
|
|
|
|
static int ovs_meter_cmd_del(struct sk_buff *skb, struct genl_info *info)
|
|
{
|
|
- struct ovs_header *ovs_header = genl_info_userhdr(info);
|
|
+ struct ovs_header *ovs_header = info->userhdr;
|
|
struct ovs_header *ovs_reply_header;
|
|
struct nlattr **a = info->attrs;
|
|
struct dp_meter *old_meter;
|
|
--- a/net/tipc/netlink_compat.c
|
|
+++ b/net/tipc/netlink_compat.c
|
|
@@ -1295,7 +1295,7 @@ static int tipc_nl_compat_recv(struct sk
|
|
struct tipc_nl_compat_msg msg;
|
|
struct nlmsghdr *req_nlh;
|
|
struct nlmsghdr *rep_nlh;
|
|
- struct tipc_genlmsghdr *req_userhdr = genl_info_userhdr(info);
|
|
+ struct tipc_genlmsghdr *req_userhdr = info->userhdr;
|
|
|
|
memset(&msg, 0, sizeof(msg));
|
|
|