Network configuration |
modules/NetworkDevices.ycp |
Interface manipulation (/etc/sysconfig/network/ifcfg-*) | |
|
|
This module has an unstable interface. |
False suppresses tones of logs 'NetworkDevices.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"
Return device type in human readable form :-)
- Parameters:
-
dev device
- Return value:
-
device type
- Example
-
GetDeviceType(eth-bus-pci-0000:01:07.0) -> "network card" GetDeviceType(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 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 netmask data (#46885) Sysconfig allows: IPADDR=10.0.0.1/8 IPADDR=10.0.0.1 PREFIXLEN=8 IPADDR=10.0.0.1 NETMASK=255.0.0.0 (IPADDR overrides PREFIXLEN, NETMASK used only if prefix length unspecified) If prefix length and NETMASK are unspecified, 32 is implied. Canonicalize it to IPADDR=10.0.0.1 PREFIXLEN= NETMASK=255.0.0.0
- Parameters:
-
ifcfg a map containing IPADDR and possibly NETMASK, PREFIXLEN and possibly other fields
- Return value:
-
the map with IPADDR, NETMASK adjusted; PREFIXLEN "" others unchanged. If IPADDR is empty, return the original.
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
- 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
- Parameters:
-
devregex devices
- Return value:
-
true on success
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
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)