From 9661d2e80c54f3d781f84128d510f4a7c8bca482 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 29 Oct 2021 22:05:16 +0900 Subject: [PATCH] sd-ndisc: drop unused functions All received information is stored in sd_ndisc_router, and we have sd_ndisc_router_get_mtu() and sd_ndisc_router_get_hop_limit(). --- src/libsystemd-network/ndisc-internal.h | 2 -- src/libsystemd-network/sd-ndisc.c | 28 ------------------------- src/libsystemd-network/test-ndisc-rs.c | 3 --- src/systemd/sd-ndisc.h | 3 --- 4 files changed, 36 deletions(-) diff --git a/src/libsystemd-network/ndisc-internal.h b/src/libsystemd-network/ndisc-internal.h index d379b44519..615de0db51 100644 --- a/src/libsystemd-network/ndisc-internal.h +++ b/src/libsystemd-network/ndisc-internal.h @@ -25,8 +25,6 @@ struct sd_ndisc { int event_priority; struct ether_addr mac_addr; - uint8_t hop_limit; - uint32_t mtu; sd_event_source *recv_event_source; sd_event_source *timeout_event_source; diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 65f75cc250..276c205ecf 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -179,28 +179,6 @@ _public_ int sd_ndisc_new(sd_ndisc **ret) { return 0; } -_public_ int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *mtu) { - assert_return(nd, -EINVAL); - assert_return(mtu, -EINVAL); - - if (nd->mtu == 0) - return -ENODATA; - - *mtu = nd->mtu; - return 0; -} - -_public_ int sd_ndisc_get_hop_limit(sd_ndisc *nd, uint8_t *ret) { - assert_return(nd, -EINVAL); - assert_return(ret, -EINVAL); - - if (nd->hop_limit == 0) - return -ENODATA; - - *ret = nd->hop_limit; - return 0; -} - static int ndisc_handle_datagram(sd_ndisc *nd, sd_ndisc_router *rt) { int r; @@ -213,12 +191,6 @@ static int ndisc_handle_datagram(sd_ndisc *nd, sd_ndisc_router *rt) { if (r < 0) return 0; - /* Update global variables we keep */ - if (rt->mtu > 0) - nd->mtu = rt->mtu; - if (rt->hop_limit > 0) - nd->hop_limit = rt->hop_limit; - log_ndisc(nd, "Received Router Advertisement: flags %s preference %s lifetime %" PRIu16 " sec", rt->flags & ND_RA_FLAG_MANAGED ? "MANAGED" : rt->flags & ND_RA_FLAG_OTHER ? "OTHER" : "none", rt->preference == SD_NDISC_PREFERENCE_HIGH ? "high" : rt->preference == SD_NDISC_PREFERENCE_LOW ? "low" : "medium", diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c index ae26ee7e74..1366b44115 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test-ndisc-rs.c @@ -242,7 +242,6 @@ static void test_callback(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router ND_RA_FLAG_MANAGED }; uint64_t flags; - uint32_t mtu; assert_se(nd); @@ -263,8 +262,6 @@ static void test_callback(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router return; } - assert_se(sd_ndisc_get_mtu(nd, &mtu) == -ENODATA); - sd_event_exit(e, 0); } diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h index f45b2ad65e..ab9ff55ddb 100644 --- a/src/systemd/sd-ndisc.h +++ b/src/systemd/sd-ndisc.h @@ -82,9 +82,6 @@ int sd_ndisc_set_ifname(sd_ndisc *nd, const char *interface_name); int sd_ndisc_get_ifname(sd_ndisc *nd, const char **ret); int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); -int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *ret); -int sd_ndisc_get_hop_limit(sd_ndisc *nd, uint8_t *ret); - int sd_ndisc_router_from_raw(sd_ndisc_router **ret, const void *raw, size_t raw_size); sd_ndisc_router *sd_ndisc_router_ref(sd_ndisc_router *rt); sd_ndisc_router *sd_ndisc_router_unref(sd_ndisc_router *rt);