the way networkmanager stores and passes network information

Bug #364460 reported by Hadmut Danisch
2
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: network-manager

Hi,

the design of Network-Manager is really odd, because the scripts run in /etc/NetworkManager/dispatcher.d do not have the required pre-up, post-down phases and do not get the required data such as the network name.

The scripts would have to use that UUID to get the information, but how should one do that from a script? You don't even know whether to look in the Gnome or KDE storage (which, btw., forces the user to configure all parameters twice if he uses both Gnome and KDE). Even worse, under gnome you can't simply copy the configuration from one machine to another. Need to configure everything manually again and again and again...

I did not even find a documentation of how to configure system-wide connections, although the existence of the directory /etc/NetworkManage/system-connections suggests that such connections exist.

NetworkManager was obviously written be people who are soleley desktop-oriented but not network-experienced.

regards
Hadmut

Revision history for this message
Alexander Sack (asac) wrote :

not sure what your use case is for pre-up/post-down; please explain.

For the sys connection: go to the applet, configure a connection and flag it as "Available to all users". that will create a config file in /etc/NetworkManager/system-connections; you should be able to copy that from one machine to others.

Revision history for this message
Hadmut Danisch (hadmut) wrote :

Well, the old (command line) style ifup/down tools usually run four different types of scripts in /etc/network:

if-pre-up, if-up, if-down, if-post-down , which makes sense since several tasks need to be done before taking the interface up or after putting it down. e.g. Firewall configuration, traffic counters etc.

Network Manager tries to mimic that but only has two phases, up and down. The other two important phases are missing.

Furthermore, Network Manager does not pass the usual and required information as environment variables to the scripts to be run. E.g. network name, other configuration parameters, DHCP parameters given by the DHCP server (such as DNS configuration) are not passed down to the scripts.

Network Manager is rather incomplete work and does not yet fit into the ubuntu/debian framework.

regards
Hadmut

Revision history for this message
Alexander Sack (asac) wrote :

> if-pre-up, if-up, if-down, if-post-down , which makes sense since several tasks need to be done
> before taking the interface up or after putting it down. e.g. Firewall configuration, traffic counters etc.

Can you come up with a list of use-cases that are currently doable in the scripts? That would help me a lot.

> Furthermore, Network Manager does not pass the usual and required information as environment
> variables to the scripts to be run. E.g. network name, other configuration parameters, DHCP
> parameters given by the DHCP server (such as DNS configuration) are not passed down to the scripts.

Same here, could you assemble a complete list of usual environment variables missing?

> Network Manager is rather incomplete work and does not yet fit into the ubuntu/debian framework.

that kind of discussion is better done outside a bug - anyway, help to make it better by providing facts like above.

Revision history for this message
Hadmut Danisch (hadmut) wrote :

Well, to get a list of use cases of current ubuntu just run

apt-file search /etc/network/if-pre-up.d
apt-file search /etc/network/if-post-down.d

and I have my own scripts to configure iptables according to the given network settings, or to set parameters in /proc/sys/...

About environment variables: There is no "complete" list, since the ifup/ifdown scripts allow to use arbitrary configuration directives in /etc/network/interfaces which are passed as an environment variable to the scripts, upcased with a IF_ prefix. Plenty of programs like the vlan configuration make use of this method to allow arbitrary environments. E.g. have an entry like

  fw hidenat

in the interfaces file is passed as environment IF_FW=hidenat. So you can use whatever you want as parameters to your scripts.

The default environments generated by ifup/ifdown can be found by running a test script or having a look in the source code, i.e.

IF_* (all those arbitrary configuration parameters as stated above)
IFACE (interface name like eth0 )
LOGICAL (logical interface)
MODE (e.g. "start", don't know details)
PHASE (e.g. post-up)
VERBOSITY (0,1)
ADDRFAM (inet,...)
IF_ADDRESS (ip-address)
IF_GATEWAY (router)
IF_METRIC (route metric)
IF_NETMASK

and maybe additional data like WLAN netname.

There are still several open issues before network-manager smoothly fits into the debian/ubuntu environment. These are just some of them.

regards
Hadmut

Revision history for this message
Hadmut Danisch (hadmut) wrote :

Ah, and btw., the parameters passed by the DHCP server should also be given as environment parameters.

Revision history for this message
Hadmut Danisch (hadmut) wrote :

the script in /etc/NetworkManager/dispatcher.d/01ifupdown supports the pre-up/post-down phases, but obviously the NetworkManager does not call it for these phases.

Revision history for this message
jhansonxi (jhansonxi) wrote :
Revision history for this message
jhansonxi (jhansonxi) wrote :

Actually Ubuntu bug #336736, Debian 518368, and Gnome 600167 are probably a better match.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.