Merge pull request #1055 from poettering/dhcp-updates
Various networkd and dhcp updates
This commit is contained in:
@@ -1024,7 +1024,9 @@ _public_ const char *sd_bus_message_get_sender(sd_bus_message *m) {
|
||||
|
||||
_public_ const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m) {
|
||||
assert_return(m, NULL);
|
||||
assert_return(sd_bus_error_is_set(&m->error), NULL);
|
||||
|
||||
if (!sd_bus_error_is_set(&m->error))
|
||||
return NULL;
|
||||
|
||||
return &m->error;
|
||||
}
|
||||
|
||||
@@ -79,8 +79,7 @@ static bool linebuf_add(struct linebuf *buf, const char *s, size_t len) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool linebuf_add_char(struct linebuf *buf, char c)
|
||||
{
|
||||
static bool linebuf_add_char(struct linebuf *buf, char c) {
|
||||
if (buf->len + 1 >= sizeof(buf->bytes))
|
||||
return false;
|
||||
buf->bytes[buf->len++] = c;
|
||||
@@ -269,13 +268,13 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
|
||||
}
|
||||
|
||||
static const char hwdb_bin_paths[] =
|
||||
"/etc/systemd/hwdb/hwdb.bin\0"
|
||||
"/etc/udev/hwdb.bin\0"
|
||||
"/usr/lib/systemd/hwdb/hwdb.bin\0"
|
||||
"/etc/systemd/hwdb/hwdb.bin\0"
|
||||
"/etc/udev/hwdb.bin\0"
|
||||
"/usr/lib/systemd/hwdb/hwdb.bin\0"
|
||||
#ifdef HAVE_SPLIT_USR
|
||||
"/lib/systemd/hwdb/hwdb.bin\0"
|
||||
"/lib/systemd/hwdb/hwdb.bin\0"
|
||||
#endif
|
||||
UDEVLIBEXECDIR "/hwdb.bin\0";
|
||||
UDEVLIBEXECDIR "/hwdb.bin\0";
|
||||
|
||||
_public_ int sd_hwdb_new(sd_hwdb **ret) {
|
||||
_cleanup_hwdb_unref_ sd_hwdb *hwdb = NULL;
|
||||
|
||||
@@ -214,6 +214,28 @@ _public_ int sd_network_link_get_lldp(int ifindex, char **lldp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_network_link_get_timezone(int ifindex, char **ret) {
|
||||
_cleanup_free_ char *s = NULL, *p = NULL;
|
||||
int r;
|
||||
|
||||
assert_return(ifindex > 0, -EINVAL);
|
||||
assert_return(ret, -EINVAL);
|
||||
|
||||
if (asprintf(&p, "/run/systemd/netif/links/%d", ifindex) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
r = parse_env_file(p, NEWLINE, "TIMEZONE", &s, NULL);
|
||||
if (r == -ENOENT)
|
||||
return -ENODATA;
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (isempty(s))
|
||||
return -ENODATA;
|
||||
|
||||
*ret = s;
|
||||
s = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int network_get_link_strv(const char *key, int ifindex, char ***ret) {
|
||||
_cleanup_free_ char *p = NULL, *s = NULL;
|
||||
|
||||
Reference in New Issue
Block a user