
functions
files
intro
|
|
Network configuration |
modules/NetworkDevices.ycp |
| Interface manipulation (/etc/sysconfig/network/ifcfg-*) |
|
|
|
The new sysconfig naming is interface (eg. eth0) vs. device
(eg. NE2000 card), but historically yast has called them device
vs. module.
Imports
Global Variables
Global Functions
- Add ()
- CanonicalizeIP (map<string, any> ifcfg)
- CanonicalizeStartmode (map<string, any> ifcfg)
- Check (string dev)
- CleanHotplugSymlink ()
- ConcealSecrets (map devs)
- ConcealSecrets1 (map<string, any> ifcfg)
- Delete (string name)
- DeleteAlias (string device, string aid)
- Edit (string name)
- Export (string devregex)
- Fastest ()
- FilterDevices (string devregex)
- GetFreeDevice (string type)
- GetFreeDevicesOld (string type, integer num)
- HasAliases (string name)
- Import (string devregex, map<string,map> devices)
- IsHotplug (string type)
- List (string devregex)
- Locate (string key, string val)
- LocateNOT (string key, string val)
- LocateProvider (string provider)
- Modified (string devregex)
- Push ()
- Read ()
- RealType (string type, string hotplug)
- Select (string name)
- UpdateModemSymlink ()
- ValidCharsIfcfg ()
- Write (string devregex)
- alias_name (string typ, string num, string anum)
- alias_num (string dev)
- device_name (string typ, string num)
- device_num (string dev)
- device_type (string dev)
Local Variables
Local Functions
|
|
|
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 |
|
global Current -> map<string,any>
|
|
Current device information
- Example:
-
$["BOOTPROTO":"dhcp", "STARTMODE":"auto"] |
|
local Devices -> map<string,map>
|
|
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:
-
|
local OriginalDevices -> map<string,map>
|
|
Devices information
- See:
-
|
local Deleted -> list<string>
|
|
Deleted devices
|
local initialized -> boolean
|
|
True if devices are already read
Which operation is pending?
|
global CardRegex -> map<string,string>
|
|
Predefined network card regular expressions
|
local HotplugTypes -> list<string>
|
|
Supported hotplug types
|
local HotplugRegex (list<string> devs) -> string
|
|
Create a list of hot-pluggable device names for the given devices
- Parameters:
|
global DeviceRegex -> map<string,string>
|
|
Predefined network device regular expressions
|
local FastestTypes -> map<integer,string>
|
|
Types in order from fastest to slowest.
- See:
-
- See:
-
|
local alias_separator -> string
|
|
A single character used to separate alias id
|
local ifcfg_name_regex -> string
|
|
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
|
global device_type (string dev) -> string
|
|
Return a device type
- Parameters:
- Return value:
- Example:
-
device_type("eth1") -> "eth"
device_type("eth-pcmcia-0") -> "eth-pcmcia" |
|
global device_num (string dev) -> string
|
|
Return a device number
- Parameters:
- Return value:
- Example:
-
device_num("eth1") -> "1"
device_num("lo") -> "" |
|
global alias_num (string dev) -> string
|
|
Return a device alias number
- Parameters:
- Return value:
- Example:
-
alias_num("eth1#2") -> "2"
alias_num("eth1#blah") -> "blah" |
|
global device_name (string typ, string num) -> string
|
|
Create a device name from its type and number
- Parameters:
|
typ |
device type |
|
num |
device number |
- Return value:
- Example:
-
device_name("eth", "1") -> "eth1"
device_name("lo", "") -> "lo" |
|
global alias_name (string typ, string num, string anum) -> string
|
|
Create a alias name from its type and numbers
- Parameters:
|
typ |
device type |
|
num |
device number |
|
anum |
alias number |
- Return value:
- Example:
-
alias_name("eth", "1", "2") -> "eth1#2" |
|
global IsHotplug (string type) -> boolean
|
|
Test hotplugability of a device
- Parameters:
- Return value:
|
global RealType (string type, string hotplug) -> string
|
|
Return real type of the device (incl. PCMCIA, USB, ...)
- Parameters:
|
type |
basic device type |
|
hotplug |
hot plug type |
- Return value:
- Example:
-
RealType("eth", "usb") -> "eth-usb" |
|
global CanonicalizeStartmode (map<string, any> ifcfg) -> map<string, any>
|
|
STARTMODE: onboot, on and boot are aliases for auto
- Parameters:
|
global CanonicalizeIP (map<string, any> ifcfg) -> map<string, any>
|
|
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. |
|
global ConcealSecrets1 (map<string, any> ifcfg) -> map
|
|
Conceal secret information, such as WEP keys, so that the output
can be passed to y2log and bugzilla.
- Parameters:
- Return value:
|
|
ifcfg with secret fields masked out |
|
global ConcealSecrets (map devs) -> map
|
|
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 |
|
global Read () -> boolean
|
|
Read devices from files
- Return value:
|
local Filter (map<string,map> devices, string devregex) -> map<string,map>
|
|
- Parameters:
|
global FilterDevices (string devregex) -> map<string,map>
|
|
Used in BuildSummary, BuildOverview
- Parameters:
|
local FilterNOT (map<string,map> devices, string devregex) -> map<string,map>
|
|
- Parameters:
|
local ShellSafe (string s) -> string
|
|
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:
- Return value:
|
|
s with some characters removed, esp. the single quote |
|
local ShellSafeWrite (path p, string s) -> boolean
|
|
SCR::Write (p, ShellSafe (s)) and if s had to be changed,
log the _path_ (not the value, for privacy).
- Parameters:
- Return value:
- See:
-
|
global Write (string devregex) -> boolean
|
|
Write devices to files
- Parameters:
|
devregex |
regular expression for the device type |
- Return value:
- Example:
-
NetworkDevice::Write("eth|tr"); |
|
global Import (string devregex, map<string,map> devices) -> boolean
|
|
Import data
- Parameters:
- Return value:
|
global Export (string devregex) -> map<string,map>
|
|
Export data
- Parameters:
- Return value:
|
|
dumped settings (later acceptable by Import()) |
|
global Modified (string devregex) -> boolean
|
|
Were the devices changed?
- Parameters:
- Return value:
|
global GetFreeDevicesOld (string type, integer num) -> list
|
|
Compute free devices
- Parameters:
|
type |
device type |
|
num |
how many free devices return |
- Return value:
- Example:
-
GetFreeDevices("eth", 2) -> [ 1, 2 ] |
|
global GetFreeDevice (string type) -> string
|
|
Return free device
- Parameters:
- Return value:
- Example:
-
GetFreeDevice("eth") -> "1" |
|
global Check (string dev) -> boolean
|
|
Check presence of the device (alias)
- Parameters:
- Return value:
|
|
true if device is present |
|
global Select (string name) -> boolean
|
|
Select the given device
- Parameters:
- Return value:
Add a new device
- Return value:
|
global Edit (string name) -> boolean
|
|
Edit the given device
- Parameters:
- Return value:
|
global Delete (string name) -> boolean
|
|
Delete the given device
- Parameters:
- Return value:
|
local Change2 (string name, map newdev, boolean check) -> boolean
|
|
Update Devices map
- Parameters:
|
name |
|
|
newdev |
new device map |
|
check |
if check if device already exists |
- Return value:
|
global DeleteAlias (string device, string aid) -> boolean
|
|
Add the alias to the list of deleted items.
Called when exiting from the aliases-of-device dialog.
#48191
- Parameters:
|
global Locate (string key, string val) -> list<string>
|
|
Locate devices of the given type and value
- Parameters:
|
key |
device key |
|
val |
device value |
- Return value:
|
global LocateNOT (string key, string val) -> list<string>
|
|
Locate devices of the given type and value
- Parameters:
|
key |
device key |
|
val |
device value |
- Return value:
|
global LocateProvider (string provider) -> boolean
|
|
Check if any device is using the specified provider
- Parameters:
|
provider |
provider identification |
- Return value:
|
global UpdateModemSymlink () -> boolean
|
|
Update /dev/modem symlink
- Return value:
|
global CleanHotplugSymlink () -> boolean
|
|
Clean the hotplug devices compatibility symlink,
usually ifcfg-eth-pcmcia -> ifcfg-eth-pcmcia-0.
- Return value:
|
global List (string devregex) -> list<string>
|
|
Get devices of the given type
- Parameters:
- Return value:
|
global Fastest () -> string
|
|
Find the fastest available device
|
global HasAliases (string name) -> boolean
|
|
Check if the given device has any virtual alias.
- Parameters:
- Return value:
|
|
true if there are some aliases |
DSL needs to save its config while the underlying network card is
being configured.
|
global ValidCharsIfcfg () -> string
|
|
#46803: forbid "/" (filename), maybe also "-" (separator) "_" (escape)
|