]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ndisc-option: introduce ndisc_option_remove() 31943/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 Mar 2024 04:27:08 +0000 (13:27 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 25 Mar 2024 18:30:41 +0000 (03:30 +0900)
src/libsystemd-network/ndisc-option.h

index 46783ebb3e8a1e26f2e946082da04964bbe3e75a..7e7a702b809f161f325e4a01bcc6b8c097ac2b56 100644 (file)
@@ -117,6 +117,13 @@ static inline sd_ndisc_option* ndisc_option_get_by_type(Set *options, uint8_t ty
 }
 int ndisc_option_get_mac(Set *options, uint8_t type, struct ether_addr *ret);
 
+static inline void ndisc_option_remove(Set *options, const sd_ndisc_option *p) {
+        ndisc_option_free(set_remove(options, ASSERT_PTR(p)));
+}
+static inline void ndisc_option_remove_by_type(Set *options, uint8_t type) {
+        ndisc_option_remove(options, &(const sd_ndisc_option) { .type = type });
+}
+
 int ndisc_option_add_raw(
                 Set **options,
                 size_t offset,