Re: [ovs-dev] [PATCH] datapath: make generic netlink group const

2019-12-02 Thread Ben Pfaff
On Mon, Nov 25, 2019 at 02:20:44PM -0800, Greg Rose wrote:
> Upstream commit:
> commit 48e48a70c08a8a68f8697f8b30cb83775bda8001
> Author: stephen hemminger 
> Date:   Wed Jul 16 11:25:52 2014 -0700
> 
> openvswitch: make generic netlink group const
> 
> Generic netlink tables can be const.
> 
> Signed-off-by: Stephen Hemminger 
> Signed-off-by: David S. Miller 
> 
> The equivalent tables in meter.c and conntrack.c are constified so
> it should be safe to do the same for these and will improve
> security as well.
> 
> Original patch slightly modified for out of tree module.
> 
> Passes check-kmod.
> Passes Travis.
> https://travis-ci.org/gvrose8192/ovs-experimental/builds/616880002
> 
> Cc: Stephen Hemminger 
> Signed-off-by: Greg Rose 

Thanks, applied to (OVS) master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] datapath: make generic netlink group const

2019-11-25 Thread Greg Rose
Upstream commit:
commit 48e48a70c08a8a68f8697f8b30cb83775bda8001
Author: stephen hemminger 
Date:   Wed Jul 16 11:25:52 2014 -0700

openvswitch: make generic netlink group const

Generic netlink tables can be const.

Signed-off-by: Stephen Hemminger 
Signed-off-by: David S. Miller 

The equivalent tables in meter.c and conntrack.c are constified so
it should be safe to do the same for these and will improve
security as well.

Original patch slightly modified for out of tree module.

Passes check-kmod.
Passes Travis.
https://travis-ci.org/gvrose8192/ovs-experimental/builds/616880002

Cc: Stephen Hemminger 
Signed-off-by: Greg Rose 
---
 datapath/datapath.c | 21 +++--
 datapath/datapath.h |  2 +-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 8a9e54f..853bfb5 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -71,16 +71,16 @@ static struct genl_family dp_datapath_genl_family;
 
 static const struct nla_policy flow_policy[];
 
-static struct genl_multicast_group ovs_dp_flow_multicast_group = {
-   .name = OVS_FLOW_MCGROUP
+static const struct genl_multicast_group ovs_dp_flow_multicast_group = {
+   .name = OVS_FLOW_MCGROUP,
 };
 
-static struct genl_multicast_group ovs_dp_datapath_multicast_group = {
-   .name = OVS_DATAPATH_MCGROUP
+static const struct genl_multicast_group ovs_dp_datapath_multicast_group = {
+   .name = OVS_DATAPATH_MCGROUP,
 };
 
-struct genl_multicast_group ovs_dp_vport_multicast_group = {
-   .name = OVS_VPORT_MCGROUP
+const struct genl_multicast_group ovs_dp_vport_multicast_group = {
+   .name = OVS_VPORT_MCGROUP,
 };
 
 /* Check if need to build a reply message.
@@ -93,7 +93,8 @@ static bool ovs_must_notify(struct genl_family *family, 
struct genl_info *info,
   genl_has_listeners(family, genl_info_net(info), group);
 }
 
-static void ovs_notify(struct genl_family *family, struct genl_multicast_group 
*grp,
+static void ovs_notify(struct genl_family *family,
+  const struct genl_multicast_group *grp,
   struct sk_buff *skb, struct genl_info *info)
 {
genl_notify(family, skb, info, GROUP_ID(grp), GFP_KERNEL);
@@ -1442,7 +1443,7 @@ static const struct nla_policy 
flow_policy[OVS_FLOW_ATTR_MAX + 1] = {
[OVS_FLOW_ATTR_UFID_FLAGS] = { .type = NLA_U32 },
 };
 
-static struct genl_ops dp_flow_genl_ops[] = {
+static const struct genl_ops dp_flow_genl_ops[] = {
{ .cmd = OVS_FLOW_CMD_NEW,
 #ifdef HAVE_GENL_VALIDATE_FLAGS
  .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -1846,7 +1847,7 @@ static const struct nla_policy 
datapath_policy[OVS_DP_ATTR_MAX + 1] = {
[OVS_DP_ATTR_USER_FEATURES] = { .type = NLA_U32 },
 };
 
-static struct genl_ops dp_datapath_genl_ops[] = {
+static const struct genl_ops dp_datapath_genl_ops[] = {
{ .cmd = OVS_DP_CMD_NEW,
 #ifdef HAVE_GENL_VALIDATE_FLAGS
  .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -2303,7 +2304,7 @@ static const struct nla_policy 
vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
[OVS_VPORT_ATTR_NETNSID] = { .type = NLA_S32 },
 };
 
-static struct genl_ops dp_vport_genl_ops[] = {
+static const struct genl_ops dp_vport_genl_ops[] = {
{ .cmd = OVS_VPORT_CMD_NEW,
 #ifdef HAVE_GENL_VALIDATE_FLAGS
  .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
diff --git a/datapath/datapath.h b/datapath/datapath.h
index ee76662..3bffa1d 100644
--- a/datapath/datapath.h
+++ b/datapath/datapath.h
@@ -237,7 +237,7 @@ static inline struct datapath *get_dp(struct net *net, int 
dp_ifindex)
 
 extern struct notifier_block ovs_dp_device_notifier;
 extern struct genl_family dp_vport_genl_family;
-extern struct genl_multicast_group ovs_dp_vport_multicast_group;
+extern const struct genl_multicast_group ovs_dp_vport_multicast_group;
 
 void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key);
 void ovs_dp_detach_port(struct vport *);
-- 
1.8.3.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev