diff --git a/board/common/rootfs/usr/sbin/container b/board/common/rootfs/usr/sbin/container index 4bc99d9a..f79353d7 100755 --- a/board/common/rootfs/usr/sbin/container +++ b/board/common/rootfs/usr/sbin/container @@ -652,7 +652,9 @@ wrap() if [ "$cmd" = "stop" ]; then # The setup phase may run forever in the background trying to fetch - # the image. It saves its PID in /run/containers/${name}.pid + # the image. It saves its PID in /run/containers/${name}.pid. Kill + # any in-flight setup, then fall through to podman stop -- a stale + # pidfile is not proof the container isn't running. if [ -f "$pidfile" ]; then pid=$(cat "$pidfile") @@ -663,10 +665,9 @@ wrap() fi rm -f "$pidfile" - return 0 fi - # Only the 'podman stop' command takes -i and --timeout + # Only the 'podman stop' command takes -i (ignore missing) and --timeout args="-i --timeout $timeout" fi diff --git a/src/confd/src/ip.c b/src/confd/src/ip.c index a83c1017..463b3b1e 100644 --- a/src/confd/src/ip.c +++ b/src/confd/src/ip.c @@ -295,11 +295,18 @@ int netdag_gen_ip_neighs(struct dagger *net, FILE *ip, const char *proto, int err = 0; if (!ipconf || !lydx_is_enabled(ipconf, "enabled")) { - FILE *fp = dagger_fopen_net_exit(net, ifname, NETDAG_EXIT_PRE, "flush-neigh.sh"); + FILE *fp; + + /* Skip if interface is currently in another netns (container) see #1493 */ + if (!if_nametoindex(ifname)) + return 0; + + fp = dagger_fopen_net_exit(net, ifname, NETDAG_EXIT_PRE, "flush-neigh.sh"); if (fp) { fprintf(fp, "ip -%c neigh flush dev %s nud permanent\n", proto[3], ifname); fclose(fp); } + return 0; } @@ -323,15 +330,18 @@ int netdag_gen_ip_addrs(struct dagger *net, FILE *ip, const char *proto, const char *ifname = lydx_get_cattr(dif, "name"); if (!ipconf || !lydx_is_enabled(ipconf, "enabled")) { - if (!cni_find(ifname) && if_nametoindex(ifname)) { - FILE *fp; + FILE *fp; - fp = dagger_fopen_net_exit(net, ifname, NETDAG_EXIT_PRE, "flush.sh"); - if (fp) { - fprintf(fp, "ip -%c addr flush dev %s\n", proto[3], ifname); - fclose(fp); - } + /* Skip if interface is currently in another netns (container) see #1493 */ + if (!if_nametoindex(ifname)) + return 0; + + fp = dagger_fopen_net_exit(net, ifname, NETDAG_EXIT_PRE, "flush.sh"); + if (fp) { + fprintf(fp, "ip -%c addr flush dev %s\n", proto[3], ifname); + fclose(fp); } + return 0; }