1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-20 18:04:03 +03:00

sd-ndisc-router: introduce sd_ndisc_router_set_sender_address()

Currently this is not used, but will be used later to modify the sender
address.
This commit is contained in:
Yu Watanabe 2024-03-06 12:28:51 +09:00 committed by Luca Boccassi
parent 9f3587ae44
commit 95d3570b47
4 changed files with 19 additions and 0 deletions

View File

@ -27,6 +27,17 @@ static ICMP6Packet* icmp6_packet_new(size_t size) {
return p;
}
int icmp6_packet_set_sender_address(ICMP6Packet *p, const struct in6_addr *addr) {
assert(p);
if (addr)
p->sender_address = *addr;
else
p->sender_address = (const struct in6_addr) {};
return 0;
}
int icmp6_packet_get_sender_address(ICMP6Packet *p, struct in6_addr *ret) {
assert(p);

View File

@ -21,6 +21,7 @@ ICMP6Packet* icmp6_packet_ref(ICMP6Packet *p);
ICMP6Packet* icmp6_packet_unref(ICMP6Packet *p);
DEFINE_TRIVIAL_CLEANUP_FUNC(ICMP6Packet*, icmp6_packet_unref);
int icmp6_packet_set_sender_address(ICMP6Packet *p, const struct in6_addr *addr);
int icmp6_packet_get_sender_address(ICMP6Packet *p, struct in6_addr *ret);
int icmp6_packet_get_timestamp(ICMP6Packet *p, clockid_t clock, usec_t *ret);
const struct icmp6_hdr* icmp6_packet_get_header(ICMP6Packet *p);

View File

@ -40,6 +40,12 @@ sd_ndisc_router* ndisc_router_new(ICMP6Packet *packet) {
return rt;
}
int sd_ndisc_router_set_sender_address(sd_ndisc_router *rt, const struct in6_addr *addr) {
assert_return(rt, -EINVAL);
return icmp6_packet_set_sender_address(rt->packet, addr);
}
int sd_ndisc_router_get_sender_address(sd_ndisc_router *rt, struct in6_addr *ret) {
assert_return(rt, -EINVAL);

View File

@ -33,6 +33,7 @@ sd_ndisc_router *sd_ndisc_router_ref(sd_ndisc_router *rt);
sd_ndisc_router *sd_ndisc_router_unref(sd_ndisc_router *rt);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc_router, sd_ndisc_router_unref);
int sd_ndisc_router_set_sender_address(sd_ndisc_router *rt, const struct in6_addr *addr);
int sd_ndisc_router_get_sender_address(sd_ndisc_router *rt, struct in6_addr *ret);
int sd_ndisc_router_get_timestamp(sd_ndisc_router *rt, clockid_t clock, uint64_t *ret);