netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Yevhen Orlov <yevhen.orlov@plvision.eu>
Cc: netdev@vger.kernel.org,
	Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>,
	Taras Chornyi <taras.chornyi@plvision.eu>,
	Mickey Rachamim <mickeyr@marvell.com>,
	Serhiy Pshyk <serhiy.pshyk@plvision.eu>,
	Taras Chornyi <tchornyi@marvell.com>,
	Oleksandr Mazur <oleksandr.mazur@plvision.eu>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 5/6] net: marvell: prestera: Register inetaddr stub notifiers
Date: Fri, 17 Dec 2021 13:02:03 -0800	[thread overview]
Message-ID: <20211217130203.537f6dc9@hermes.local> (raw)
In-Reply-To: <20211217195440.29838-6-yevhen.orlov@plvision.eu>

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.

  reply	other threads:[~2021-12-17 21:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 19:54 [PATCH net-next 0/6] prestera: add basic router driver support Yevhen Orlov
2021-12-17 19:54 ` [PATCH net-next 1/6] net: marvell: prestera: add virtual router ABI Yevhen Orlov
2021-12-17 19:54 ` [PATCH net-next 2/6] net: marvell: prestera: Add router interface ABI Yevhen Orlov
2021-12-17 19:54 ` [PATCH net-next 3/6] net: marvell: prestera: Add prestera router infra Yevhen Orlov
2021-12-17 19:54 ` [PATCH net-next 4/6] net: marvell: prestera: add hardware router objects accounting Yevhen Orlov
2021-12-17 19:54 ` [PATCH net-next 5/6] net: marvell: prestera: Register inetaddr stub notifiers Yevhen Orlov
2021-12-17 21:02   ` Stephen Hemminger [this message]
2021-12-21 16:07     ` Yevhen Orlov
2021-12-17 19:54 ` [PATCH net-next 6/6] net: marvell: prestera: Implement initial inetaddr notifiers Yevhen Orlov
2021-12-17 21:03   ` Stephen Hemminger
2021-12-21  4:32     ` Yevhen Orlov
2021-12-17 21:03   ` Stephen Hemminger
2021-12-18 16:52 ` [PATCH net-next 0/6] prestera: add basic router driver support Andrew Lunn
2021-12-21  4:28   ` Yevhen Orlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211217130203.537f6dc9@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mickeyr@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr.mazur@plvision.eu \
    --cc=serhiy.pshyk@plvision.eu \
    --cc=taras.chornyi@plvision.eu \
    --cc=tchornyi@marvell.com \
    --cc=volodymyr.mytnyk@plvision.eu \
    --cc=yevhen.orlov@plvision.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).