lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGm1_kt3AN_5sdPJvCKF4QqQWttvv8sdzpjRb9MLJd7a62L3BA@mail.gmail.com>
Date:	Thu, 17 Apr 2014 14:40:05 +0200
From:	Yegor Yefremov <yegorslists@...glemail.com>
To:	Jiri Pirko <jiri@...nulli.us>
Cc:	netdev <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>, nhorman@...driver.com,
	andy@...yhouse.net, tgraf@...g.ch, dborkman@...hat.com,
	ogerlitz@...lanox.com, jesse@...ira.com, pshelar@...ira.com,
	azhou@...ira.com, Ben Hutchings <ben@...adent.org.uk>,
	stephen@...workplumber.org, jeffrey.t.kirsher@...el.com,
	vyasevic@...hat.com, xiyou.wangcong@...il.com,
	john.r.fastabend@...el.com, edumazet@...gle.com, jhs@...atatu.com,
	sfeldma@...ulusnetworks.com,
	Florian Fainelli <f.fainelli@...il.com>,
	roopa@...ulusnetworks.com, linville@...driver.com,
	dev@...nvswitch.org, jasowang@...hat.com, ebiederm@...ssion.com,
	nicolas.dichtel@...nd.com, ryazanov.s.a@...il.com,
	buytenh@...tstofly.org, aviadr@...lanox.com,
	Felix Fietkau <nbd@...nwrt.org>, alexei.starovoitov@...il.com,
	Neil.Jerram@...aswitch.com
Subject: Re: [patch net-next RFC v3 04/10] rtnl: expose physical switch id for
 particular device

On Thu, Apr 17, 2014 at 2:14 PM, Jiri Pirko <jiri@...nulli.us> wrote:
> The the netdevice represents a port in a switch, it will expose

remove one 'the'

> IFLA_PHYS_SWITCH_ID value via rtnl. Two netdevices with a same value

s/a same/the same

> belong to one physical switch.
>
> Signed-off-by: Jiri Pirko <jiri@...nulli.us>

Reviewed-by: Yegor Yefremov <yegorslists@...glemail.com>

> ---
>  include/uapi/linux/if_link.h |  1 +
>  net/core/rtnetlink.c         | 26 +++++++++++++++++++++++++-
>  2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index 9a7f7ac..c11f492 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -145,6 +145,7 @@ enum {
>         IFLA_CARRIER,
>         IFLA_PHYS_PORT_ID,
>         IFLA_CARRIER_CHANGES,
> +       IFLA_PHYS_SWITCH_ID,
>         __IFLA_MAX
>  };
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 231e043..7170e24 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -43,6 +43,7 @@
>
>  #include <linux/inet.h>
>  #include <linux/netdevice.h>
> +#include <linux/switchdev.h>
>  #include <net/ip.h>
>  #include <net/protocol.h>
>  #include <net/arp.h>
> @@ -829,7 +830,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
>                + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
>                + rtnl_link_get_size(dev) /* IFLA_LINKINFO */
>                + rtnl_link_get_af_size(dev) /* IFLA_AF_SPEC */
> -              + nla_total_size(MAX_PHYS_ITEM_ID_LEN); /* IFLA_PHYS_PORT_ID */
> +              + nla_total_size(MAX_PHYS_ITEM_ID_LEN) /* IFLA_PHYS_PORT_ID */
> +              + nla_total_size(MAX_PHYS_ITEM_ID_LEN); /* IFLA_PHYS_SWITCH_ID */
>  }
>
>  static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev)
> @@ -926,6 +928,24 @@ static int rtnl_phys_port_id_fill(struct sk_buff *skb, struct net_device *dev)
>         return 0;
>  }
>
> +static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
> +{
> +       int err;
> +       struct netdev_phys_item_id psid;
> +
> +       err = swdev_get_id(dev, &psid);
> +       if (err) {
> +               if (err == -EOPNOTSUPP)
> +                       return 0;
> +               return err;
> +       }
> +
> +       if (nla_put(skb, IFLA_PHYS_SWITCH_ID, psid.id_len, psid.id))
> +               return -EMSGSIZE;
> +
> +       return 0;
> +}
> +
>  static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
>                             int type, u32 pid, u32 seq, u32 change,
>                             unsigned int flags, u32 ext_filter_mask)
> @@ -998,6 +1018,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
>         if (rtnl_phys_port_id_fill(skb, dev))
>                 goto nla_put_failure;
>
> +       if (rtnl_phys_switch_id_fill(skb, dev))
> +               goto nla_put_failure;
> +
>         attr = nla_reserve(skb, IFLA_STATS,
>                         sizeof(struct rtnl_link_stats));
>         if (attr == NULL)
> @@ -1151,6 +1174,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
>         [IFLA_NUM_RX_QUEUES]    = { .type = NLA_U32 },
>         [IFLA_PHYS_PORT_ID]     = { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
>         [IFLA_CARRIER_CHANGES]  = { .type = NLA_U32 },  /* ignored */
> +       [IFLA_PHYS_SWITCH_ID]   = { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
>  };
>
>  static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
> --
> 1.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ