Skip to contentSkip to conversation

Network configuration data in sysfs

RFD Kirill A. Shutemov 5 participants 10 messages Oct 23, 2011 – Oct 25, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Currently there's no way to set or inspect network configuration (protocol addresses, routes, etc.) through sysfs. Yes, we have netlink interface for this, but sysfs has advantage:

- change or inspect network configuration using standard unix utilities (echo, cat, etc.). It's useful at least in restricted environment where no special utilities available -- initrd or stripped down busybox.

- transparent udev support. It would be nice to get this information to udev.

Is there something fundamental preventing us to have sysfs interface for network configuration?

Signature · 1 line
 Kirill A. Shutemov
maintainer
#1 lore raw

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 02:35:58 +0300

Quoted 2 lines

Is there something fundamental preventing us to have sysfs interface for network configuration?

Netlink already provides everything sysfs would potentially provide as well as event tracking.

udev could just listen to a netlink socket and notice all changes to addresses, routes, and device states.

#2 lore raw
Quoted 8 lines · David Miller

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 02:35:58 +0300

Quoted 2 lines

Is there something fundamental preventing us to have sysfs interface for network configuration?

Netlink already provides everything sysfs would potentially provide as well as event tracking.

Not everything. You still need special utilities to view/change the configuration.

Quoted 2 lines

udev could just listen to a netlink socket and notice all changes to addresses, routes, and device states.

Yes, potentially. I'm not sure if it fits well to udev design. Kay, any comments?

Signature · 1 line
 Kirill A. Shutemov
maintainer
#3 lore raw

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 04:34:07 +0300

Quoted 12 lines · David Miller
Quoted 8 lines

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 02:35:58 +0300

Quoted 2 lines

Is there something fundamental preventing us to have sysfs interface for network configuration?

Netlink already provides everything sysfs would potentially provide as well as event tracking.

Not everything. You still need special utilities to view/change the configuration.

You can use netlink to perform any configuration change you want, or to view any network configuration setting.

#4 lore raw
Quoted 10 lines · David Miller

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 04:34:07 +0300

Quoted 7 lines · David Miller
Quoted 6 lines

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 02:35:58 +0300

Quoted 2 lines

Is there something fundamental preventing us to have sysfs interface for network configuration?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Netlink already provides everything sysfs would potentially provide as well as event tracking.

Not everything. You still need special utilities to view/change the configuration.

You can use netlink to perform any configuration change you want, or to view any network configuration setting.

You need /sbin/ip or similar tool to do this, right?

Signature · 1 line
 Kirill A. Shutemov
maintainer
#5 lore raw

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 07:24:00 +0300

Quoted 8 lines · David Miller
Quoted 5 lines

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 04:34:07 +0300

You can use netlink to perform any configuration change you want, or to view any network configuration setting.

You need /sbin/ip or similar tool to do this, right?

I'm talking about udev using netlink natively.

#6 lore raw
Quoted 7 lines · David Miller

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 07:24:00 +0300

Quoted 4 lines · David Miller
Quoted 3 lines

From: "Kirill A. Shutemov" <[email protected]>
Date: Mon, 24 Oct 2011 04:34:07 +0300

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

You can use netlink to perform any configuration change you want, or to view any network configuration setting.

You need /sbin/ip or similar tool to do this, right?

I'm talking about udev using netlink natively.

Kirill, what exactly is the use case? And why what does udev support mean in that context?

I doubt that "not having /sbin/ip installed" should be a reason to add and expose complex interfaces in /sys, while we already have a perfectly working native way to do it.

Kay

#7 lore raw
Quoted 6 lines · Kay Sievers

Kirill, what exactly is the use case? And why what does udev support mean in that context?

I doubt that "not having /sbin/ip installed" should be a reason to add and expose complex interfaces in /sys, while we already have a perfectly working native way to do it.

Adding NETLINK_ROUTE in udev is a way to perform some actions in case of network events without polling. Now there are only a few specific daemons (NM, connman etc) that are listen to the netlink socket and setup the network his own way.

Signature · 1 line
Rgrds, legion
#8 lore raw
Quoted 4 lines · Alexey Gladkov
Quoted 3 lines · Kay Sievers

Kirill, what exactly is the use case? And why what does udev support mean in that context?

Quoted 8 lines
Quoted 3 lines

I doubt that "not having /sbin/ip installed" should be a reason to add and expose complex interfaces in /sys, while we already have a perfectly working native way to do it.

Adding NETLINK_ROUTE in udev is a way to perform some actions in case of network events without polling. Now there are only a few specific daemons (NM, connman etc) that are listen to the netlink socket and setup the network his own way.

I'm not really convinced that udev should be in charge of network config changes, it's a really complex area. Udev is a generic kernel device manager, not a network setup manager.

Our point of view is, that all services depending on network state changes should listen to netlink themselves, and not be worked around with tools like udev to execute stuff and notify them.

But again, what's the use-case for that you have in mind?

Kay

#9 lore raw
In reply to Kirill A. Shutemov
Quoted 9 lines · On Mon, 24 Oct 2011 02:35:58 +0300 "Kirill A. Shutemov" <[email protected]>…

Hi,

Currently there's no way to set or inspect network configuration (protocol addresses, routes, etc.) through sysfs. Yes, we have netlink interface for this, but sysfs has advantage:

- change or inspect network configuration using standard unix utilities (echo, cat, etc.). It's useful at least in restricted environment where no special utilities available -- initrd or stripped down busybox.

Last I checked busybox had a stripped down version of iproute arealdy.

Quoted 6 lines

- transparent udev support. It would be nice to get this information to udev.

Is there something fundamental preventing us to have sysfs interface for network configuration?

Sysfs does not support the concept of transactions. Many network operations require setting multiple values at a time; which is why a message interface like netlink works much better.