]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath: make generic netlink group const
authorGreg Rose <gvrose8192@gmail.com>
Mon, 25 Nov 2019 22:20:44 +0000 (14:20 -0800)
committerBen Pfaff <blp@ovn.org>
Mon, 2 Dec 2019 22:36:49 +0000 (14:36 -0800)
Upstream commit:
    commit 48e48a70c08a8a68f8697f8b30cb83775bda8001
    Author: stephen hemminger <stephen@networkplumber.org>
    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 <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
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 <stephen@networkplumber.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
datapath/datapath.c
datapath/datapath.h

index 8a9e54f0310ef2c512a6ed2efc0fe59e8da1e53b..853bfb5af13b0b15566f17f3a0d25d2b29f0f3ff 100644 (file)
@@ -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,
index ee766621550c7ef51be77547c261f97031adc251..3bffa1dcb77d0aad00aa8d6840891ba3b456f280 100644 (file)
@@ -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 *);