chiark / gitweb /
site: Record whynot in default (end of comm_notify) case
[secnet.git] / site.c
diff --git a/site.c b/site.c
index a91d6c91cd86aa6681b932df5a1d5ed7339a5374..8ca87690baf350f7c3fee99ddd595db34bb4ade8 100644 (file)
--- a/site.c
+++ b/site.c
@@ -1828,9 +1828,19 @@ static bool_t named_for_us(struct site *st, const struct buffer_if *buf_in,
 {
     struct buffer_if buf[1];
     buffer_readonly_clone(buf,buf_in);
-    return unpick_msg(st,type,buf,m)
-       && name_matches(&m->remote,st->remotename)
-       && name_matches(&m->local,st->localname);
+
+    if (!unpick_msg(st,type,buf,m)) {
+       return False;
+    }
+#define NAME_MATCHES(lr)                       \
+    if (!name_matches(&m->lr, st->lr##name)) { \
+        return False;                          \
+    }
+    NAME_MATCHES(remote);
+    NAME_MATCHES(local );
+#undef NAME_MATCHES
+
+    return True;
 }
 
 static bool_t we_have_priority(struct site *st, const struct msg *m) {
@@ -2074,6 +2084,9 @@ static bool_t site_incoming(void *sst, struct buffer_if *buf,
        return True;
     }
 
+    if (priomsg_update_p(whynot, comm_notify_whynot_general))
+       truncmsg_add_string(&whynot->m,
+                           "not MSG1 or PROD; unknown dest index");
     return False;
 }