mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 04:24:32 +00:00
tests/trivial: rename ip4_addr_ne32() to ip4_addr_be32() in test-networkmanager-service.py
The function is supposed to return the IPv4 address as 32 bit integer in network byte order (bit endian). The ip4_addr_ne32() name is confusing, because "ne" commonly stands for "native endianness". Compare also "unaligned.h" and unaligned_read_ne32(), which also stands for native endianness (host order), not network order (big endian). Rename.
This commit is contained in:
parent
260cded3d6
commit
9730961a02
|
@ -108,7 +108,9 @@ class Util:
|
|||
return (Util.ip_addr_ntop(a, family), family)
|
||||
|
||||
@staticmethod
|
||||
def ip4_addr_ne32(addr):
|
||||
def ip4_addr_be32(addr):
|
||||
# return the IPv4 address as 32 bit integer in network byte order
|
||||
# (big endian).
|
||||
a, family = Util.ip_addr_pton(addr, socket.AF_INET)
|
||||
n = 0
|
||||
for i in range(4):
|
||||
|
@ -1852,9 +1854,9 @@ class IP4Config(ExportedObj):
|
|||
|
||||
return {
|
||||
PRP_IP4_CONFIG_ADDRESSES: dbus.Array([
|
||||
[ Util.ip4_addr_ne32(a['addr']),
|
||||
[ Util.ip4_addr_be32(a['addr']),
|
||||
a['prefix'],
|
||||
Util.ip4_addr_ne32(a['gateway']) if a['gateway'] else 0
|
||||
Util.ip4_addr_be32(a['gateway']) if a['gateway'] else 0
|
||||
] for a in addrs
|
||||
],
|
||||
'au'),
|
||||
|
@ -1868,9 +1870,9 @@ class IP4Config(ExportedObj):
|
|||
'a{sv}'),
|
||||
PRP_IP4_CONFIG_GATEWAY: dbus.String(gateway) if gateway else "",
|
||||
PRP_IP4_CONFIG_ROUTES: dbus.Array([
|
||||
[ Util.ip4_addr_ne32(a['dest']),
|
||||
[ Util.ip4_addr_be32(a['dest']),
|
||||
a['prefix'],
|
||||
Util.ip4_addr_ne32(a['next-hop'] or '0.0.0.0'),
|
||||
Util.ip4_addr_be32(a['next-hop'] or '0.0.0.0'),
|
||||
max(a['metric'], 0)
|
||||
] for a in routes
|
||||
],
|
||||
|
@ -1884,12 +1886,12 @@ class IP4Config(ExportedObj):
|
|||
for a in routes
|
||||
],
|
||||
'a{sv}'),
|
||||
PRP_IP4_CONFIG_NAMESERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_ne32(n)) for n in nameservers], 'u'),
|
||||
PRP_IP4_CONFIG_NAMESERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_be32(n)) for n in nameservers], 'u'),
|
||||
PRP_IP4_CONFIG_DOMAINS: dbus.Array(domains, 's'),
|
||||
PRP_IP4_CONFIG_SEARCHES: dbus.Array(searches, 's'),
|
||||
PRP_IP4_CONFIG_DNSOPTIONS: dbus.Array(dnsoptions, 's'),
|
||||
PRP_IP4_CONFIG_DNSPRIORITY: dbus.Int32(dnspriority),
|
||||
PRP_IP4_CONFIG_WINSSERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_ne32(n)) for n in winsservers], 'u'),
|
||||
PRP_IP4_CONFIG_WINSSERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_be32(n)) for n in winsservers], 'u'),
|
||||
}
|
||||
|
||||
def props_regenerate(self, generate_seed):
|
||||
|
|
Loading…
Reference in a new issue