[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211217130203.537f6dc9@hermes.local>
Date: Fri, 17 Dec 2021 13:02:03 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Yevhen Orlov <yevhen.orlov@...ision.eu>
Cc: netdev@...r.kernel.org,
Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>,
Taras Chornyi <taras.chornyi@...ision.eu>,
Mickey Rachamim <mickeyr@...vell.com>,
Serhiy Pshyk <serhiy.pshyk@...ision.eu>,
Taras Chornyi <tchornyi@...vell.com>,
Oleksandr Mazur <oleksandr.mazur@...ision.eu>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 5/6] net: marvell: prestera: Register inetaddr
stub notifiers
On Fri, 17 Dec 2021 21:54:37 +0200
Yevhen Orlov <yevhen.orlov@...ision.eu> wrote:
> +
> +static int __prestera_inetaddr_valid_cb(struct notifier_block *nb,
> + unsigned long event, void *ptr)
> +{
> + struct in_validator_info *ivi = (struct in_validator_info *)ptr;
> + struct net_device *dev = ivi->ivi_dev->dev;
> + struct prestera_router *router = container_of(nb,
> + struct prestera_router,
> + inetaddr_valid_nb);
> + struct in_device *idev;
> + int err = 0;
> +
> + if (event != NETDEV_UP)
> + goto out;
> +
> + /* Ignore if this is not first address */
> + idev = __in_dev_get_rtnl(dev);
> + if (idev && idev->ifa_list)
> + goto out;
> +
> + if (ipv4_is_multicast(ivi->ivi_addr)) {
> + err = -EINVAL;
> + goto out;
> + }
> +
> + err = __prestera_inetaddr_event(router->sw, dev, event, ivi->extack);
> +out:
> + return notifier_from_errno(err);
> +}
Your router is quite limited if it only can handle a single unicast address.
Powered by blists - more mailing lists