mirror of
https://github.com/systemd/systemd.git
synced 2024-11-08 11:27:32 +03:00
network: Add function to serialize an IPv6 address
This commit is contained in:
parent
bc152ff879
commit
b729fa14aa
@ -32,6 +32,7 @@
|
||||
#include "conf-parser.h"
|
||||
#include "condition.h"
|
||||
#include "network-internal.h"
|
||||
#include "sd-icmp6-nd.h"
|
||||
|
||||
const char *net_get_name(struct udev_device *device) {
|
||||
const char *name, *field;
|
||||
@ -384,6 +385,20 @@ int deserialize_in_addrs(struct in_addr **ret, const char *string) {
|
||||
return size;
|
||||
}
|
||||
|
||||
void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
|
||||
size_t size) {
|
||||
unsigned i;
|
||||
|
||||
assert(f);
|
||||
assert(addresses);
|
||||
assert(size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
fprintf(f, SD_ICMP6_ADDRESS_FORMAT_STR"%s",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(addresses[i]),
|
||||
(i < (size - 1)) ? " ": "");
|
||||
}
|
||||
|
||||
int deserialize_in6_addrs(struct in6_addr **ret, const char *string) {
|
||||
_cleanup_free_ struct in6_addr *addresses = NULL;
|
||||
int size = 0;
|
||||
|
@ -67,6 +67,8 @@ const char *net_get_name(struct udev_device *device);
|
||||
|
||||
void serialize_in_addrs(FILE *f, const struct in_addr *addresses, size_t size);
|
||||
int deserialize_in_addrs(struct in_addr **addresses, const char *string);
|
||||
void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
|
||||
size_t size);
|
||||
int deserialize_in6_addrs(struct in6_addr **addresses, const char *string);
|
||||
|
||||
/* don't include "dhcp-lease-internal.h" as it causes conflicts between netinet/ip.h and linux/ip.h */
|
||||
|
Loading…
Reference in New Issue
Block a user