summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp6-option.c
diff options
context:
space:
mode:
authorNacho Barrientos <nacho.barrientos@cern.ch>2021-11-29 14:17:55 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-11-30 03:05:02 +0900
commit081f44859a3e81633418c4639e6a4bf1fd29f100 (patch)
treea8c102a855f4c1a5b037fe505047acc444a1aa37 /src/libsystemd-network/dhcp6-option.c
parent55dad038b21ab6a91be3aba1c071f0f667844653 (diff)
downloadsystemd-081f44859a3e81633418c4639e6a4bf1fd29f100.tar.gz
Byte order to host before using the lifetime
I've seen this in `NetworkManager-1.34.0-0.3.el8.x86_64` (latest in CentOS Stream 8 at the time of writing this message) which does not use the latest Systemd but probably the code base is the same (see https://github.com/NetworkManager/NetworkManager/commit/51f93e00a23fbd09f5ad96da6290bf4ca737d46a). Before the patch: ``` libsystemd: eth0: DHCPv6 client: T1 expires in 34y 3w 6d 45min 31s libsystemd: eth0: DHCPv6 client: T2 expires in 54y 5month 3w 3d 23h 20min 35s ``` After the patch: ``` libsystemd: eth0: DHCPv6 client: T1 expires in 3d 7h 58min 3s libsystemd: eth0: DHCPv6 client: T2 expires in 5d 2h 26min 50s ``` same box (x86_64 system) and same DHCPv6 server. This regression has likely been introduced by 8a8955507af363c31297bbc5df79852db4ad39d6.
Diffstat (limited to 'src/libsystemd-network/dhcp6-option.c')
-rw-r--r--src/libsystemd-network/dhcp6-option.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c
index 42792d1d2f..28fe036a40 100644
--- a/src/libsystemd-network/dhcp6-option.c
+++ b/src/libsystemd-network/dhcp6-option.c
@@ -817,7 +817,7 @@ int dhcp6_option_parse_ia(
/* Ignore the sub-option on non-critical errors. */
continue;
- lt_min = MIN(lt_min, a->iaaddr.lifetime_valid);
+ lt_min = MIN(lt_min, be32toh(a->iaaddr.lifetime_valid));
LIST_PREPEND(addresses, ia.addresses, a);
break;
}
@@ -836,7 +836,7 @@ int dhcp6_option_parse_ia(
/* Ignore the sub-option on non-critical errors. */
continue;
- lt_min = MIN(lt_min, a->iapdprefix.lifetime_valid);
+ lt_min = MIN(lt_min, be32toh(a->iapdprefix.lifetime_valid));
LIST_PREPEND(addresses, ia.addresses, a);
break;
}