Compare commits

..

8 Commits

Author SHA1 Message Date
Lennart Poettering 9d5dac4dce
Merge pull request #15411 from ssahani/systemd-issue-15375
sd-network: DHCPv6 - Add NoPrefixAvail to error code
2020-04-13 10:58:38 +02:00
Lennart Poettering d9235719f2
Merge pull request #15397 from ssahani/vxlan
network: VXlan group and remote fixes
2020-04-13 10:47:40 +02:00
Zbigniew Jędrzejewski-Szmek 38cd55b007 Remove unneded {}s
$ perl -i -0pe 's|\s+{\n([^\n]*;)\n\s+}\n|\n\1\n|gms' **/*.c

Inspired by ea7cbf5bdd.
2020-04-13 09:31:49 +02:00
Susant Sahani 667ceb9d9d sd-network: DHCP6 - Use readable error status rather than numeric
value in the log message
2020-04-13 06:06:14 +02:00
Susant Sahani 7a0f1895d3 sd-network: DHCPv6 - Add NoPrefixAvail to error code 2020-04-12 14:14:52 +02:00
Susant Sahani 659f85a519 networkctl: Add support to display VXLan remote address 2020-04-11 16:12:42 +02:00
Susant Sahani fc1d9c7b0c network: VXLan - Add support for remote address 2020-04-11 06:11:51 +02:00
Susant Sahani 7c9b26900c network: VXLan - fix adding Group address 2020-04-10 15:29:10 +02:00
16 changed files with 41 additions and 33 deletions

View File

@ -302,9 +302,8 @@ EFI_STATUS tpm_log_event(UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UIN
EFI_TCG2 *tpm2; EFI_TCG2 *tpm2;
tpm2 = tcg2_interface_check(); tpm2 = tcg2_interface_check();
if (tpm2) { if (tpm2)
return tpm2_measure_to_pcr_and_event_log(tpm2, pcrindex, buffer, buffer_size, description); return tpm2_measure_to_pcr_and_event_log(tpm2, pcrindex, buffer, buffer_size, description);
}
tpm1 = tcg1_interface_check(); tpm1 = tcg1_interface_check();
if (tpm1) if (tpm1)

View File

@ -336,9 +336,8 @@ static char* merge_unit_ids(const char* unit_log_field, char **pairs) {
STRV_FOREACH_PAIR(unit_id, job_type, pairs) { STRV_FOREACH_PAIR(unit_id, job_type, pairs) {
next = strlen(unit_log_field) + strlen(*unit_id); next = strlen(unit_log_field) + strlen(*unit_id);
if (!GREEDY_REALLOC(ans, alloc, size + next + 1)) { if (!GREEDY_REALLOC(ans, alloc, size + next + 1))
return mfree(ans); return mfree(ans);
}
sprintf(ans + size, "%s%s", unit_log_field, *unit_id); sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
if (*(unit_id+1)) if (*(unit_id+1))

View File

@ -535,9 +535,8 @@ static int inspect_home(int argc, char *argv[], void *userdata) {
} }
r = bus_call_method(bus, &home_mgr, "GetUserRecordByName", &error, &reply, "s", *i); r = bus_call_method(bus, &home_mgr, "GetUserRecordByName", &error, &reply, "s", *i);
} else { } else
r = bus_call_method(bus, &home_mgr, "GetUserRecordByUID", &error, &reply, "u", (uint32_t) uid); r = bus_call_method(bus, &home_mgr, "GetUserRecordByUID", &error, &reply, "u", (uint32_t) uid);
}
if (r < 0) { if (r < 0) {
log_error_errno(r, "Failed to inspect home: %s", bus_error_message(&error, r)); log_error_errno(r, "Failed to inspect home: %s", bus_error_message(&error, r));

View File

@ -166,9 +166,8 @@ CurlGlue *curl_glue_unref(CurlGlue *g) {
if (g->curl) if (g->curl)
curl_multi_cleanup(g->curl); curl_multi_cleanup(g->curl);
while ((io = hashmap_steal_first(g->ios))) { while ((io = hashmap_steal_first(g->ios)))
sd_event_source_unref(io); sd_event_source_unref(io);
}
hashmap_free(g->ios); hashmap_free(g->ios);

View File

@ -116,9 +116,8 @@ static void test_catalog_import_merge(void) {
h = test_import(input, -1, 0); h = test_import(input, -1, 0);
assert_se(ordered_hashmap_size(h) == 1); assert_se(ordered_hashmap_size(h) == 1);
ORDERED_HASHMAP_FOREACH(payload, h, j) { ORDERED_HASHMAP_FOREACH(payload, h, j)
assert_se(streq(combined, payload)); assert_se(streq(combined, payload));
}
} }
static void test_catalog_import_merge_no_body(void) { static void test_catalog_import_merge_no_body(void) {
@ -149,9 +148,8 @@ static void test_catalog_import_merge_no_body(void) {
h = test_import(input, -1, 0); h = test_import(input, -1, 0);
assert_se(ordered_hashmap_size(h) == 1); assert_se(ordered_hashmap_size(h) == 1);
ORDERED_HASHMAP_FOREACH(payload, h, j) { ORDERED_HASHMAP_FOREACH(payload, h, j)
assert_se(streq(combined, payload)); assert_se(streq(combined, payload));
}
} }
static void test_catalog_update(const char *database) { static void test_catalog_update(const char *database) {

View File

@ -464,8 +464,8 @@ int dhcp6_option_parse_ia(DHCP6Option *iaoption, DHCP6IA *ia) {
if (status < 0) if (status < 0)
return status; return status;
if (status > 0) { if (status > 0) {
log_dhcp6_client(client, "IA status %d", log_dhcp6_client(client, "IA status %s",
status); dhcp6_message_status_to_string(status));
return -EINVAL; return -EINVAL;
} }

View File

@ -89,7 +89,8 @@ enum {
DHCP6_STATUS_NO_BINDING = 3, DHCP6_STATUS_NO_BINDING = 3,
DHCP6_STATUS_NOT_ON_LINK = 4, DHCP6_STATUS_NOT_ON_LINK = 4,
DHCP6_STATUS_USE_MULTICAST = 5, DHCP6_STATUS_USE_MULTICAST = 5,
_DHCP6_STATUS_MAX = 6, DHCP6_STATUS_NO_PREFIX_AVAIL = 6,
_DHCP6_STATUS_MAX = 7,
}; };
enum { enum {

View File

@ -112,6 +112,7 @@ const char * dhcp6_message_status_table[_DHCP6_STATUS_MAX] = {
[DHCP6_STATUS_NO_BINDING] = "Binding unavailable", [DHCP6_STATUS_NO_BINDING] = "Binding unavailable",
[DHCP6_STATUS_NOT_ON_LINK] = "Not on link", [DHCP6_STATUS_NOT_ON_LINK] = "Not on link",
[DHCP6_STATUS_USE_MULTICAST] = "Use multicast", [DHCP6_STATUS_USE_MULTICAST] = "Use multicast",
[DHCP6_STATUS_NO_PREFIX_AVAIL] = "No prefix available",
}; };
DEFINE_STRING_TABLE_LOOKUP(dhcp6_message_status, int); DEFINE_STRING_TABLE_LOOKUP(dhcp6_message_status, int);

View File

@ -267,10 +267,9 @@ int x11_read_data(Context *c, sd_bus_message *m) {
else if (streq(a[1], "XkbOptions")) else if (streq(a[1], "XkbOptions"))
p = &c->x11_options; p = &c->x11_options;
if (p) { if (p)
free_and_replace(*p, a[2]); free_and_replace(*p, a[2]);
} }
}
} else if (!in_section && first_word(l, "Section")) { } else if (!in_section && first_word(l, "Section")) {
_cleanup_strv_free_ char **a = NULL; _cleanup_strv_free_ char **a = NULL;

View File

@ -38,7 +38,14 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m"); return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
} }
if (in_addr_is_null(v->remote_family, &v->remote) == 0) { if (in_addr_is_null(v->group_family, &v->group) == 0) {
if (v->group_family == AF_INET)
r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
else
r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_GROUP6, &v->group.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
} else if (in_addr_is_null(v->remote_family, &v->remote) == 0) {
if (v->remote_family == AF_INET) if (v->remote_family == AF_INET)
r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->remote.in); r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->remote.in);
else else
@ -348,6 +355,11 @@ static int netdev_vxlan_verify(NetDev *netdev, const char *filename) {
if (!v->dest_port && v->generic_protocol_extension) if (!v->dest_port && v->generic_protocol_extension)
v->dest_port = 4790; v->dest_port = 4790;
if (in_addr_is_null(v->group_family, &v->group) == 0 && in_addr_is_null(v->remote_family, &v->remote) == 0)
return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"%s: VXLAN both 'Group=' and 'Remote=' cannot be specified. Ignoring.",
filename);
return 0; return 0;
} }

View File

@ -1549,9 +1549,17 @@ static int link_status_one(
} }
if (IN_SET(info->vxlan_info.group_family, AF_INET, AF_INET6)) { if (IN_SET(info->vxlan_info.group_family, AF_INET, AF_INET6)) {
const char *p;
r = in_addr_is_multicast(info->vxlan_info.group_family, &info->vxlan_info.group);
if (r <= 0)
p = "Remote:";
else
p = "Group:";
r = table_add_many(table, r = table_add_many(table,
TABLE_EMPTY, TABLE_EMPTY,
TABLE_STRING, "Group:", TABLE_STRING, p,
info->vxlan_info.group_family == AF_INET ? TABLE_IN_ADDR : TABLE_IN6_ADDR, info->vxlan_info.group_family == AF_INET ? TABLE_IN_ADDR : TABLE_IN6_ADDR,
&info->vxlan_info.group); &info->vxlan_info.group);
if (r < 0) if (r < 0)

View File

@ -408,9 +408,8 @@ static void test_strv_split_newlines(void) {
l = strv_split_newlines(str); l = strv_split_newlines(str);
assert_se(l); assert_se(l);
STRV_FOREACH(s, l) { STRV_FOREACH(s, l)
assert_se(streq(*s, input_table_multiple[i++])); assert_se(streq(*s, input_table_multiple[i++]));
}
} }
static void test_strv_split_nulstr(void) { static void test_strv_split_nulstr(void) {

View File

@ -514,9 +514,8 @@ int main(int argc, char *argv[]) {
printf("ID_TYPE=generic\n"); printf("ID_TYPE=generic\n");
break; break;
} }
} else { } else
printf("ID_TYPE=disk\n"); printf("ID_TYPE=disk\n");
}
printf("ID_BUS=ata\n"); printf("ID_BUS=ata\n");
printf("ID_MODEL=%s\n", model); printf("ID_MODEL=%s\n", model);
printf("ID_MODEL_ENC=%s\n", model_enc); printf("ID_MODEL_ENC=%s\n", model_enc);
@ -524,9 +523,8 @@ int main(int argc, char *argv[]) {
if (serial[0] != '\0') { if (serial[0] != '\0') {
printf("ID_SERIAL=%s_%s\n", model, serial); printf("ID_SERIAL=%s_%s\n", model, serial);
printf("ID_SERIAL_SHORT=%s\n", serial); printf("ID_SERIAL_SHORT=%s\n", serial);
} else { } else
printf("ID_SERIAL=%s\n", model); printf("ID_SERIAL=%s\n", model);
}
if (id.command_set_1 & (1<<5)) { if (id.command_set_1 & (1<<5)) {
printf("ID_ATA_WRITE_CACHE=1\n"); printf("ID_ATA_WRITE_CACHE=1\n");

View File

@ -111,9 +111,8 @@ static char *get_value(char **buffer) {
*/ */
(*buffer)++; (*buffer)++;
end = quote_string; end = quote_string;
} else { } else
end = comma_string; end = comma_string;
}
val = strsep(buffer, end); val = strsep(buffer, end);
if (val && end == quote_string) if (val && end == quote_string)
/* /*

View File

@ -228,9 +228,8 @@ static bool test_pointers(sd_device *dev,
is_touchscreen = true; is_touchscreen = true;
else if (has_joystick_axes_or_buttons) else if (has_joystick_axes_or_buttons)
is_joystick = true; is_joystick = true;
} else if (has_joystick_axes_or_buttons) { } else if (has_joystick_axes_or_buttons)
is_joystick = true; is_joystick = true;
}
if (has_mt_coordinates) { if (has_mt_coordinates) {
if (stylus_or_pen) if (stylus_or_pen)

View File

@ -125,9 +125,8 @@ static int on_reboot(Context *c) {
#if HAVE_AUDIT #if HAVE_AUDIT
if (c->audit_fd >= 0) if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) { errno != EPERM)
r = log_error_errno(errno, "Failed to send audit message: %m"); r = log_error_errno(errno, "Failed to send audit message: %m");
}
#endif #endif
/* If this call fails it will return 0, which /* If this call fails it will return 0, which
@ -154,9 +153,8 @@ static int on_shutdown(Context *c) {
#if HAVE_AUDIT #if HAVE_AUDIT
if (c->audit_fd >= 0) if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) { errno != EPERM)
r = log_error_errno(errno, "Failed to send audit message: %m"); r = log_error_errno(errno, "Failed to send audit message: %m");
}
#endif #endif
q = utmp_put_shutdown(); q = utmp_put_shutdown();