summaryrefslogtreecommitdiff
path: root/fw/src/fw.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/src/fw.c')
-rw-r--r--fw/src/fw.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/fw/src/fw.c b/fw/src/fw.c
index bb97960..800e004 100644
--- a/fw/src/fw.c
+++ b/fw/src/fw.c
@@ -1463,9 +1463,26 @@ threadmain(int argc, char **argv)
* that has no card behind it and no network at all, which
* is a bad way to discover a typo in -m.
*/
- if(access(mtpt, AEXIST) < 0)
- sysfatal("%s: %r; not touching %s until it exists",
- mtpt, etherdev);
+ if(access(mtpt, AEXIST) < 0){
+ /*
+ * A fw that died left its control filesystem mounted
+ * here and what remains is a corpse: the name is
+ * there and every operation on it fails, including
+ * the check above. So the restart after a crash was
+ * refused by the very test meant to keep fw from
+ * taking a card it could not then serve. Clear it,
+ * the same way reclaim() clears the pkt interface the
+ * same dead fw left behind; both are its wreckage,
+ * and a firewall that cannot restart into its own
+ * wreckage stays down for good.
+ */
+ unmount(nil, mtpt);
+ if(access(mtpt, AEXIST) < 0)
+ sysfatal("%s: %r; not touching %s until it exists",
+ mtpt, etherdev);
+ fprint(2, "fw: cleared %s, left mounted by an earlier fw\n",
+ mtpt);
+ }
fprint(2, "fw: filtering packets on %s\n", etherdev);
syslog(0, "fw", "started, filtering %s for %s", etherdev, etheraddr);