Network configuration |
modules/NetworkInterfaces.ycp |
| Interface manipulation (/etc/sysconfig/network/ifcfg-*) | |
|
|
|
This module has an unstable interface. |
False suppresses tones of logs 'NetworkInterfaces.ycp:ABC Check(eth,id-00:aa:bb:cc:dd:ee,)'
Current device identifier
- Example
-
eth0, eth1:blah, lo, ... Add, Edit and Delete copy the requested device info (via Select) to Name and Current, Commit puts it back
Current device information
- Example
-
$["BOOTPROTO":"dhcp", "STARTMODE":"auto"]
Interface information: Devices[string type, string id] is a map with the contents of ifcfg-type-id. Separating type from id is useful because the type determines the fields of the interface file. Multiple addresses for an interface are nested maps [type, id, "_aliases", aid]
- See
-
Read
Devices information
- See
-
Read
Deleted devices
True if devices are already read
Which operation is pending?
Predefined network card regular expressions
Supported hotplug types
Create a list of hot-pluggable device names for the given devices
- Parameters:
-
devs
Predefined network device regular expressions
Types in order from fastest to slowest.
- See
-
FastestRegexps
- See
-
Push
A single character used to separate alias id
ifcfg name = type + id + alias_id If id is numeric, it is not separated from type, otherwise separated by "-" Id may be empty Alias_id, if nonempty, is separated by alias_separator
Return a device type
- Parameters:
-
dev device
- Return value:
-
device type
- Example
-
device_type("eth1") -> "eth" device_type("eth-pcmcia-0") -> "eth-pcmcia"
Translates type code exposed by kernel in sysfs onto internaly used dev types.
Detects a subtype of Ethernet device type according /sys or /proc content
- Parameters:
-
dev
Detects a subtype of InfiniBand device type according /sys or /proc content
- Parameters:
-
dev
Determines device type according /sys/class/net/
Firstly, it uses /sys/class/net/
- Parameters:
-
dev
- Return value:
-
return device type or nil if nothing known found
Detects device type according given ifcfg configuration
- Parameters:
-
ifcfg
- Return value:
-
device type or nil if type cannot be recognized from ifcfg config
Return device type in human readable form :-)
- Parameters:
-
dev device
- Return value:
-
device type
- Example
-
GetDeviceTypeName(eth-bus-pci-0000:01:07.0) -> "Network Card" GetDeviceTypeName(modem0) -> "Modem"
Return a device number
- Parameters:
-
dev device
- Return value:
-
device number
- Example
-
device_num("eth1") -> "1" device_num("lo") -> ""
Return a device alias number
- Parameters:
-
dev device
- Return value:
-
alias number
- Example
-
alias_num("eth1#2") -> "2" alias_num("eth1#blah") -> "blah"
Create a device name from its type and number
- Parameters:
-
typ device type num device number
- Return value:
-
device name
- Example
-
device_name("eth", "1") -> "eth1" device_name("lo", "") -> "lo"
Create a alias name from its type and numbers
- Parameters:
-
typ device type num device number anum alias number
- Return value:
-
alias name
- Example
-
alias_name("eth", "1", "2") -> "eth1#2"
Test hotplugability of a device
- Parameters:
-
type device type
- Return value:
-
true if hotpluggable
Return matching inteface for this hardware ID (uses getcfg-interface)
- Parameters:
-
dev unique device string return interface name
- Example
-
MatchInterface("eth-id-00:01:DE:AD:BE:EF") -> "eth0"
Test whether device is connected (Link:up) The info is taken from sysfs
- Parameters:
-
dev unique device string
- Return value:
-
true if connected
Return real type of the device (incl. PCMCIA, USB, ...)
- Parameters:
-
type basic device type hotplug hot plug type
- Return value:
-
real type
- Example
-
RealType("eth", "usb") -> "eth-usb"
STARTMODE: onboot, on and boot are aliases for auto
- Parameters:
-
ifcfg
Canonicalize static ip configuration obtained from sysconfig. (suse#46885)
Static ip configuration formats supported by sysconfig: 1) IPADDR=10.0.0.1/8 2) IPADDR=10.0.0.1 PREFIXLEN=8 3) IPADDR=10.0.0.1 NETMASK=255.0.0.0
Features:
- IPADDR (in form
Canonicalize it to:
- IPADDR="
- Parameters:
-
ifcfg a map with netconfig (ifcfg) configuration for a one device
- Return value:
-
a map with IPADDR, NETMASK and PREFIXLEN adjusted if IPADDR is present. Returns original ifcfg if IPADDR is not present. In case of error, returns nil.
Conceal secret information, such as WEP keys, so that the output can be passed to y2log and bugzilla.
- Parameters:
-
ifcfg one ifcfg
- Return value:
-
ifcfg with secret fields masked out
Conceal secret information, such as WEP keys, so that the output can be passed to y2log and bugzilla. (#65741)
- Parameters:
-
devs a two-level map of ifcfgs like Devices
- Return value:
-
ifcfgs with secret fields masked out
Read devices from files
- Return value:
-
true if sucess
re-read all settings again from system for creating new proposal from scratch (#170558)
- Parameters:
-
devices devregex
Used in BuildSummary, BuildOverview
- Parameters:
-
devregex
- Parameters:
-
devices devregex
For the NAME field, filter out characters that will case problems for the shell or the ini agent. (#72164) It should be done in more places but this field is most susceptible.
- Parameters:
-
s a string
- Return value:
-
s with some characters removed, esp. the single quote
SCR::Write (p, ShellSafe (s)) and if s had to be changed, log the _path_ (not the value, for privacy).
- Parameters:
-
p SCR path s value
- Return value:
-
success
- See
-
ShellSafe
Write devices to files
- Parameters:
-
devregex regular expression for the device type
- Return value:
-
true if success
- Example
-
NetworkDevice::Write("eth|tr");
Import data
All devices which confirms to
- Parameters:
-
devregex devices
- Return value:
-
true on success
Return supported network device types (for type netcard) for this hardware
Return textual device type
- Parameters:
-
type description type longdescr
- Return value:
-
textual form of device type
- Example
-
GetDevTypeDescription("eth", false) -> "Ethernet" GetDevTypeDescription("eth", true) -> "Ethernet Network Card"
Export data
- Parameters:
-
devregex
- Return value:
-
dumped settings (later acceptable by Import())
Were the devices changed?
- Parameters:
-
devregex
- Return value:
-
true if modified
Compute free devices
- Parameters:
-
type device type num how many free devices return
- Return value:
-
num of free devices
- Example
-
GetFreeDevices("eth", 2) -> [ 1, 2 ]
Return free device
- Parameters:
-
type device type
- Return value:
-
free device
- Example
-
GetFreeDevice("eth") -> "1"
Check presence of the device (alias)
- Parameters:
-
dev device identifier
- Return value:
-
true if device is present
Select the given device
- Parameters:
-
name
- Return value:
-
true if success
Add a new device
- Return value:
-
true if success
Edit the given device
- Parameters:
-
name
- Return value:
-
true if success
Delete the given device
- Parameters:
-
name
- Return value:
-
true if success
Update Devices map
- Parameters:
-
name newdev new device map check if check if device already exists
- Return value:
-
true if success
Add the alias to the list of deleted items. Called when exiting from the aliases-of-device dialog. #48191
- Parameters:
-
device aid
get IP addres + additional IP addresses
- Parameters:
-
device
- Return value:
-
of IP addresses of selected interface
Locate devices of the given type and value
- Parameters:
-
key device key val device value
- Return value:
-
of devices with key=val
Locate devices of the given type and value
- Parameters:
-
key device key val device value
- Return value:
-
of devices with key!=val
Check if any device is using the specified provider
- Parameters:
-
provider provider identification
- Return value:
-
true if there is any
Update /dev/modem symlink
- Return value:
-
true if success
Clean the hotplug devices compatibility symlink, usually ifcfg-eth-pcmcia -> ifcfg-eth-pcmcia-0.
- Return value:
-
true if success
Get devices of the given type
- Parameters:
-
devregex
- Return value:
-
of found devices
Find the fastest available device
Check if the given device has any virtual alias.
- Parameters:
-
name
- Return value:
-
true if there are some aliases
DSL needs to save its config while the underlying network card is being configured.
#46803: forbid "/" (filename), maybe also "-" (separator) "_" (escape)
list of all devices except given one by parameter dev also loopback is ommited
- Parameters:
-
dev