diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-13 04:47:54 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-13 05:26:22 +0900 |
commit | 1929c1fcb2f305206c01a6fc79cd038d6d9615f5 (patch) | |
tree | fb57455266aeef7a4518facaac1aa50d26c0c3d4 /src/libsystemd-network/dhcp6-protocol.c | |
parent | 38db7a4ed388b032faae221067b77d553a54e6a6 (diff) | |
download | systemd-1929c1fcb2f305206c01a6fc79cd038d6d9615f5.tar.gz |
dhcp6: gracefully handle NoBinding error
When we receive NoBinding status code, the requesting binding (address or
any other information) does not exist anymore in the server. Hence,
resending the request is meaningless. Let's restart the transaction from
the beginning in that case.
Diffstat (limited to 'src/libsystemd-network/dhcp6-protocol.c')
-rw-r--r-- | src/libsystemd-network/dhcp6-protocol.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libsystemd-network/dhcp6-protocol.c b/src/libsystemd-network/dhcp6-protocol.c index c399a7ac50..f965ea40fe 100644 --- a/src/libsystemd-network/dhcp6-protocol.c +++ b/src/libsystemd-network/dhcp6-protocol.c @@ -82,3 +82,14 @@ static const char * const dhcp6_message_status_table[_DHCP6_STATUS_MAX] = { }; DEFINE_STRING_TABLE_LOOKUP(dhcp6_message_status, DHCP6Status); + +int dhcp6_message_status_to_errno(DHCP6Status s) { + switch (s) { + case DHCP6_STATUS_SUCCESS: + return 0; + case DHCP6_STATUS_NO_BINDING: + return -EADDRNOTAVAIL; + default: + return -EINVAL; + } +} |