diff options
Diffstat (limited to 'pasta.c')
-rw-r--r-- | pasta.c | 46 |
1 files changed, 27 insertions, 19 deletions
@@ -272,45 +272,53 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid, */ void pasta_ns_conf(struct ctx *c) { - nl_link_up(1, 1 /* lo */, 0); + nl_link_up(nl_sock_ns, 1 /* lo */, 0); /* Get or set MAC in target namespace */ if (MAC_IS_ZERO(c->mac_guest)) - nl_link_get_mac(1, c->pasta_ifi, c->mac_guest); + nl_link_get_mac(nl_sock_ns, c->pasta_ifi, c->mac_guest); else - nl_link_set_mac(1, c->pasta_ifi, c->mac_guest); + nl_link_set_mac(nl_sock_ns, c->pasta_ifi, c->mac_guest); if (c->pasta_conf_ns) { - nl_link_up(1, c->pasta_ifi, c->mtu); + nl_link_up(nl_sock_ns, c->pasta_ifi, c->mtu); if (c->ifi4) { if (c->no_copy_addrs) { - nl_addr_set(c->pasta_ifi, AF_INET, + nl_addr_set(nl_sock_ns, c->pasta_ifi, AF_INET, &c->ip4.addr, c->ip4.prefix_len); } else { - nl_addr_dup(c->ifi4, c->pasta_ifi, AF_INET); + nl_addr_dup(nl_sock, c->ifi4, + nl_sock_ns, c->pasta_ifi, AF_INET); } - if (c->no_copy_routes) - nl_route_set_def(c->pasta_ifi, AF_INET, - &c->ip4.gw); - else - nl_route_dup(c->ifi4, c->pasta_ifi, AF_INET); + if (c->no_copy_routes) { + nl_route_set_def(nl_sock_ns, c->pasta_ifi, + AF_INET, &c->ip4.gw); + } else { + nl_route_dup(nl_sock, c->ifi4, nl_sock_ns, + c->pasta_ifi, AF_INET); + } } if (c->ifi6) { if (c->no_copy_addrs) { - nl_addr_set(c->pasta_ifi, AF_INET6, - &c->ip6.addr, 64); + nl_addr_set(nl_sock_ns, c->pasta_ifi, + AF_INET6, &c->ip6.addr, 64); } else { - nl_addr_dup(c->ifi6, c->pasta_ifi, AF_INET6); + nl_addr_dup(nl_sock, c->ifi6, + nl_sock_ns, c->pasta_ifi, + AF_INET6); } - if (c->no_copy_routes) - nl_route_set_def(c->pasta_ifi, AF_INET6, - &c->ip6.gw); - else - nl_route_dup(c->ifi6, c->pasta_ifi, AF_INET6); + if (c->no_copy_routes) { + nl_route_set_def(nl_sock_ns, c->pasta_ifi, + AF_INET6, &c->ip6.gw); + } else { + nl_route_dup(nl_sock, c->ifi6, + nl_sock_ns, c->pasta_ifi, + AF_INET6); + } } } |