[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ee5d9736-72ec-f4fd-8e9b-2c4179687e16@cumulusnetworks.com>
Date: Thu, 18 May 2017 18:28:46 +0300
From: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
To: Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel@...oirfairelinux.com,
"David S. Miller" <davem@...emloft.net>,
Stephen Hemminger <stephen@...workplumber.org>,
"moderated list:ETHERNET BRIDGE" <bridge@...ts.linux-foundation.org>
Subject: Re: [PATCH net-next 5/6] net: bridge: get msgtype from nlmsghdr in
mdb ops
On 5/18/17 12:27 AM, Vivien Didelot wrote:
> Retrieve the message type from the nlmsghdr structure instead of
> hardcoding it in both br_mdb_add and br_mdb_del.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
> ---
> net/bridge/br_mdb.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
> index a72d5e6f339f..d280b20587cb 100644
> --- a/net/bridge/br_mdb.c
> +++ b/net/bridge/br_mdb.c
> @@ -569,6 +569,7 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
> struct net_bridge_port *p;
> struct net_bridge_vlan *v;
> struct net_bridge *br;
> + int msgtype = nlh->nlmsg_type;
minor nits:
nlmsg_type is a u16, also please keep the order and arrange these from longest
to shortest
> int err;
>
> err = br_mdb_parse(skb, nlh, &dev, &entry);
> @@ -595,12 +596,12 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
> if (br_vlan_enabled(br) && vg && entry->vid == 0) {
> list_for_each_entry(v, &vg->vlan_list, vlist) {
> entry->vid = v->vid;
> - err = __br_mdb_do(p, entry, RTM_NEWMDB);
> + err = __br_mdb_do(p, entry, msgtype);
> if (err)
> break;
> }
> } else {
> - err = __br_mdb_do(p, entry, RTM_NEWMDB);
> + err = __br_mdb_do(p, entry, msgtype);
> }
>
> return err;
> @@ -677,6 +678,7 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
> struct net_bridge_port *p;
> struct net_bridge_vlan *v;
> struct net_bridge *br;
> + int msgtype = nlh->nlmsg_type;
same here
> int err;
>
> err = br_mdb_parse(skb, nlh, &dev, &entry);
> @@ -703,12 +705,12 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
> if (br_vlan_enabled(br) && vg && entry->vid == 0) {
> list_for_each_entry(v, &vg->vlan_list, vlist) {
> entry->vid = v->vid;
> - err = __br_mdb_do(p, entry, RTM_DELMDB);
> + err = __br_mdb_do(p, entry, msgtype);
> if (err)
> break;
> }
> } else {
> - err = __br_mdb_do(p, entry, RTM_DELMDB);
> + err = __br_mdb_do(p, entry, msgtype);
> }
>
> return err;
>
Powered by blists - more mailing lists