summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-ndisc.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-04-10 06:37:35 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2021-04-10 21:16:11 +0200
commit5c078687dca3d86cf4633e39b7e7bc1a4f761d42 (patch)
treec02fe3cbfbd521e4cccfdf01d5d5e37835557d67 /src/network/networkd-ndisc.c
parentresolved: add RFC 8375 "home.arpa" to list of default NTA (diff)
downloadsystemd-5c078687dca3d86cf4633e39b7e7bc1a4f761d42.tar.xz
systemd-5c078687dca3d86cf4633e39b7e7bc1a4f761d42.zip
network: refuse to configure NDISC twice
Diffstat (limited to '')
-rw-r--r--src/network/networkd-ndisc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index ba7c184b66..6830cf592e 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -1315,15 +1315,16 @@ int ndisc_configure(Link *link) {
if (!link_ipv6_accept_ra_enabled(link))
return 0;
- if (!link->ndisc) {
- r = sd_ndisc_new(&link->ndisc);
- if (r < 0)
- return r;
+ if (link->ndisc)
+ return 0; /* Already configured. */
- r = sd_ndisc_attach_event(link->ndisc, link->manager->event, 0);
- if (r < 0)
- return r;
- }
+ r = sd_ndisc_new(&link->ndisc);
+ if (r < 0)
+ return r;
+
+ r = sd_ndisc_attach_event(link->ndisc, link->manager->event, 0);
+ if (r < 0)
+ return r;
r = sd_ndisc_set_mac(link->ndisc, &link->hw_addr.addr.ether);
if (r < 0)