[SECNET PATCH 09/14] site: Pass whynot through to named_for_us

Ian Jackson ijackson at chiark.greenend.org.uk
Sat Sep 21 17:07:54 BST 2019


We only pass this as non-0 when, if named_for_us rejects, we actually
return false from comm_notify.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 site.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/site.c b/site.c
index e6eb12e..c1571c3 100644
--- a/site.c
+++ b/site.c
@@ -1769,7 +1769,8 @@ static void site_outgoing(void *sst, struct buffer_if *buf)
 }
 
 static bool_t named_for_us(struct site *st, const struct buffer_if *buf_in,
-			   uint32_t type, struct msg *m)
+			   uint32_t type, struct msg *m,
+			   struct priomsg *whynot)
     /* For packets which are identified by the local and remote names.
      * If it has our name and our peer's name in it it's for us. */
 {
@@ -1798,7 +1799,7 @@ static bool_t setup_late_msg_ok(struct site *st,
      * a note of the sending address, iff they look like they are part
      * of the current key setup attempt. */
     struct msg m;
-    if (!named_for_us(st,buf_in,msgtype,&m))
+    if (!named_for_us(st,buf_in,msgtype,&m,0))
 	/* named_for_us calls unpick_msg which gets the nonces */
 	return False;
     if (!consttime_memeq(m.nR,st->remoteN,NONCELEN) ||
@@ -1827,7 +1828,7 @@ static bool_t site_incoming(void *sst, struct buffer_if *buf,
     struct msg named_msg;
 
     if (msgtype==LABEL_MSG1) {
-	if (!named_for_us(st,buf,msgtype,&named_msg))
+	if (!named_for_us(st,buf,msgtype,&named_msg,whynot))
 	    return False;
 	/* It's a MSG1 addressed to us. Decide what to do about it. */
 	dump_packet(st,buf,source,True,True);
@@ -1891,7 +1892,7 @@ static bool_t site_incoming(void *sst, struct buffer_if *buf,
 	return True;
     }
     if (msgtype==LABEL_PROD) {
-	if (!named_for_us(st,buf,msgtype,&named_msg))
+	if (!named_for_us(st,buf,msgtype,&named_msg,whynot))
 	    return False;
 	dump_packet(st,buf,source,True,True);
 	if (st->state!=SITE_RUN) {
-- 
2.11.0




More information about the sgo-software-discuss mailing list