Thread (14 messages) 14 messages, 3 authors, 2021-12-21

Re: [PATCH net-next 5/6] net: marvell: prestera: Register inetaddr stub notifiers

flat view

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2021-12-17 21:02:08
Also in: lkml

On Fri, 17 Dec 2021 21:54:37 +0200
Yevhen Orlov [off-list ref] wrote:
quoted hunk ↗ jump to hunk
+
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help