lkml.org 
[lkml]   [2021]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@plvision.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.

\
 
 \ /
  Last update: 2021-12-17 22:03    [W:0.085 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site