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-next>] [day] [month] [year] [list]
Message-ID: <4FEA37A0.309@xdin.com>
Date:	Tue, 26 Jun 2012 22:28:51 +0000
From:	Arvid Brodin <Arvid.Brodin@...n.com>
To:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Stephen Hemminger <shemminger@...tta.com>
CC:	Javier Boticario <jboticario@...il.com>,
	Bruno Ferreira <balferreira@...glemail.com>
Subject: HSR: How to set IF_OPER_LOWERLAYERDOWN?

Hi,

According to Documentation/networking/operstates.txt a network interface have an
operational state and an administrative state.

If I understand things correctly the administrative state is the desired state set by
userspace, and the operational state is the actual state which depends on things like the
administrative state, whether a carrier is present, or (for virtual interfaces lite VLAN)
whether the lower interface is available.


In the driver I'm writing (for the "HSR" redundancy protocol) a hsr (virtual) interface is
useable as long as any of its (physical) slaves are useable. I.e. the operstate of a hsr
device might be set like this:

void hsr_set_operstate()
{
	if (!is_admin_up(hsr_dev)) /* Check IFF_UP */ {
		set_operstate(hsr_dev, IF_OPER_DOWN);
		return;
	}

	if (is_operstate_up(slave1) || is_operstate_up(slave2)) /* Check IF_OPER_UP */
		set_operstate(hsr_dev, IF_OPER_UP);
	else
		set_operstate(hsr_dev, IF_OPER_LOWERLAYERDOWN);
}

However, the function set_operstate() (in net/core/rtnetlink.c) only accept transitions to
IF_OPER_UP and IF_OPER_DORMANT - other transitions are ignored. (There is a function
rfc2863_policy() (net/core/link_watch.c) that may return IF_OPER_LOWERLAYERDOWN iff
(!netif_carrier_ok(dev) && (dev->ifindex != dev->iflink)), but I don't know what that means.)

So how do I signal my interface as being IF_OPER_LOWERLAYERDOWN?


In another, related matter, I'm wondering if I should set the carrier state of my virtual
interface so that it shows netif_carrier_ok() when it is possible to get the interface to
IF_OPER_UP:

void hsr_set_carrier()
{
	if (is_operstate_up(slave1) || is_operstate_up(slave2))
		netif_carrier_on(hsr_dev);
	else
		netif_carrier_off(hsr_dev);
}


Thanks,
-- 
Arvid Brodin | Consultant (Linux)
XDIN AB | Jan Stenbecks Torg 17 | SE-164 40 Kista | Sweden | xdin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ