yast2 |
modules/IP.ycp |
| IP manipulation routines | |
|
|
|
This module has an unstable interface. |
Describe a valid IPv4 address
- Return value:
-
describtion a valid IPv4 address
Check syntax of IPv4 address
- Parameters:
-
ip IPv4 address
- Return value:
-
true if correct
Describe a valid IPv6 address
- Return value:
-
describtion a valid IPv4 address
Check syntax of IPv6 address
- Parameters:
-
ip IPv6 address
- Return value:
-
true if correct
If param contains IPv6 in one of its various forms, extracts it.
if ip is closed in [ ] or contain % then it can be special case of IPv6 syntax, so extract ipv6 (see description later) and continue with check.
IPv6 syntax: - pure ipv6 blob (e.g. f008::1) - ipv6 blob with link local suffix (e.g. f008::1%eth0) - dtto in square brackets (e.g. [f008::1%eth0] )
- Parameters:
-
ip a buffer with address
- Return value:
-
IPv6 part of ip param, unchanged ip param otherwise
Check syntax of IP address
- Parameters:
-
ip IP address
- Return value:
-
true if correct
Returns string of valid network definition. Both IPv4 and IPv6.
- Return value:
-
describing the valid network.
Convert IPv4 address from string to integer
- Parameters:
-
ip IPv4 address
- Return value:
-
ip address as integer
Convert IPv4 address from integer to string
- Parameters:
-
ip IPv4 address
- Return value:
-
ip address as string
Converts IPv4 address from string to hex format
- Parameters:
-
ip IPv4 address as string in "ipv4" format
- Return value:
-
representing IP in Hex
- Example
-
IP::ToHex("192.168.1.1") -> "0xC0A80101" IP::ToHex("10.10.0.1") -> "0x0A0A0001"
Compute IPv4 network address from ip4 address and network mask.
- Parameters:
-
ip IPv4 address mask netmask
- Return value:
-
computed subnet
Compute IPv4 broadcast address from ip4 address and network mask.
- Parameters:
-
ip IPv4 address mask netmask
- Return value:
-
computed broadcast
Converts IPv4 into its 32 bit binary representation.
- Parameters:
-
ipv4
- Return value:
-
binary
- Example
-
IPv4ToBits("80.25.135.2") -> "01010000000110011000011100000010" IPv4ToBits("172.24.233.211") -> "10101100000110001110100111010011"
- See
-
BitsToIPv4()
Converts 32 bit binary number to its IPv4 repserentation.
- Parameters:
-
bits
- Return value:
-
ipv4
- Example
-
BitsToIPv4("10111100000110001110001100000101") -> "188.24.227.5" BitsToIPv4("00110101000110001110001001100101") -> "53.24.226.101"
- See
-
IPv4ToBits()
Checks the given IPv4 network entry.
- Parameters:
-
network
- Example
-
CheckNetwork("192.168.0.0/255.255.255.0") -> true CheckNetwork("192.168.1.22") -> true CheckNetwork("172.55.0.0/33") -> false
Checks the given IPv6 network entry.
- Parameters:
-
network
- Example
-
CheckNetwork("2001:db8:0::1/64") -> true CheckNetwork("2001:db8:0::1") -> true CheckNetwork("::1/257") -> false
Checks the given network entry which can be defined in several formats: - Single IPv4 or IPv6, e.g., 192.168.0.1 or 2001:db8:0::1 - IP/Netmask, e.g., 192.168.0.0/255.255.255.0 or 2001:db8:0::1/ffff:ffff::0 - IP/CIDR, e.g., 192.168.0.0/20 or 2001:db8:0::1/56
- Parameters:
-
network
- Example
-
CheckNetwork("192.168.0.1") -> true CheckNetwork("192.168.0.0/20") -> true CheckNetwork("192.168.0.0/255.255.255.0") -> true CheckNetwork("0/0") -> true CheckNetwork("::1/128") -> true CheckNetwork("2001:db8:0::1") -> true CheckNetwork("2001:db8:0::1/64") -> true CheckNetwork("2001:db8:0::1/ffff:ffff::0") -> true CheckNetwork("2001:db8:0::xyz") -> false CheckNetwork("::1/257") -> false CheckNetwork("172.55.0.0/33") -> false CheckNetwork("172.55.0.0/125.85.5.5") -> false