chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nspawn: when adding a veth interface to a bridge, use the "vb-" rather than "ve-...
[elogind.git]
/
src
/
nspawn
/
nspawn.c
diff --git
a/src/nspawn/nspawn.c
b/src/nspawn/nspawn.c
index 98e90fe3c9207ab51dde3c3ece05bea4aca7a24e..2441758c2a15e2a1523b482a6207301b64d0ad0d 100644
(file)
--- a/
src/nspawn/nspawn.c
+++ b/
src/nspawn/nspawn.c
@@
-480,7
+480,7
@@
static int parse_argv(int argc, char *argv[]) {
case ARG_PERSONALITY:
case ARG_PERSONALITY:
- arg_personality = p
arse_personality
(optarg);
+ arg_personality = p
ersonality_from_string
(optarg);
if (arg_personality == 0xffffffffLU) {
log_error("Unknown or unsupported personality '%s'.", optarg);
return -EINVAL;
if (arg_personality == 0xffffffffLU) {
log_error("Unknown or unsupported personality '%s'.", optarg);
return -EINVAL;
@@
-743,7
+743,7
@@
static int setup_resolv_conf(const char *dest) {
static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
- sd_id128_t rnd;
+ sd_id128_t rnd
= {}
;
char as_uuid[37];
int r;
char as_uuid[37];
int r;
@@
-1302,7
+1302,7
@@
static int reset_audit_loginuid(void) {
return 0;
}
return 0;
}
-static int setup_veth(pid_t pid, char iface_name[]) {
+static int setup_veth(pid_t pid, char iface_name[
IFNAMSIZ
]) {
_cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
_cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
int r;
_cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
_cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
int r;
@@
-1313,15
+1313,22
@@
static int setup_veth(pid_t pid, char iface_name[]) {
if (!arg_network_veth)
return 0;
if (!arg_network_veth)
return 0;
+ /* Use two different interface name prefixes depending whether
+ * we are in bridge mode or not. */
+ if (arg_network_bridge)
+ memcpy(iface_name, "vb-", 3);
+ else
+ memcpy(iface_name, "ve-", 3);
+
strncpy(iface_name+3, arg_machine, IFNAMSIZ - 3);
strncpy(iface_name+3, arg_machine, IFNAMSIZ - 3);
- r = sd_rtnl_open(
0, &rtnl
);
+ r = sd_rtnl_open(
&rtnl, 0
);
if (r < 0) {
log_error("Failed to connect to netlink: %s", strerror(-r));
return r;
}
if (r < 0) {
log_error("Failed to connect to netlink: %s", strerror(-r));
return r;
}
- r = sd_rtnl_message_new_link(rtnl,
RTM_NEWLINK, 0, &m
);
+ r = sd_rtnl_message_new_link(rtnl,
&m, RTM_NEWLINK, 0
);
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;
@@
-1416,13
+1423,13
@@
static int setup_bridge(const char veth_name[]) {
return -errno;
}
return -errno;
}
- r = sd_rtnl_open(
0, &rtnl
);
+ r = sd_rtnl_open(
&rtnl, 0
);
if (r < 0) {
log_error("Failed to connect to netlink: %s", strerror(-r));
return r;
}
if (r < 0) {
log_error("Failed to connect to netlink: %s", strerror(-r));
return r;
}
- r = sd_rtnl_message_new_link(rtnl,
RTM_SETLINK, 0, &m
);
+ r = sd_rtnl_message_new_link(rtnl,
&m, RTM_SETLINK, 0
);
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;
@@
-1461,7
+1468,7
@@
static int move_network_interfaces(pid_t pid) {
if (strv_isempty(arg_network_interfaces))
return 0;
if (strv_isempty(arg_network_interfaces))
return 0;
- r = sd_rtnl_open(
0, &rtnl
);
+ r = sd_rtnl_open(
&rtnl, 0
);
if (r < 0) {
log_error("Failed to connect to netlink: %s", strerror(-r));
return r;
if (r < 0) {
log_error("Failed to connect to netlink: %s", strerror(-r));
return r;
@@
-1497,7
+1504,7
@@
static int move_network_interfaces(pid_t pid) {
return -EBUSY;
}
return -EBUSY;
}
- r = sd_rtnl_message_new_link(rtnl,
RTM_NEWLINK, ifi, &m
);
+ r = sd_rtnl_message_new_link(rtnl,
&m, RTM_NEWLINK, ifi
);
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;
@@
-1587,7
+1594,7
@@
int main(int argc, char *argv[]) {
int n_fd_passed;
pid_t pid = 0;
sigset_t mask;
int n_fd_passed;
pid_t pid = 0;
sigset_t mask;
- char veth_name[IFNAMSIZ]
= "ve-"
;
+ char veth_name[IFNAMSIZ];
log_parse_environment();
log_open();
log_parse_environment();
log_open();