server/: Post-merge fixup.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 11 Oct 2017 01:02:39 +0000 (02:02 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 25 Jan 2019 12:08:31 +0000 (12:08 +0000)
There's a slightly nasty semantic conflict between the two branches:
mdw/knock introduces a new function which sends a packet to an address
which might not belong to a registered peer, and mdw/ipv6 means that
this now has to cope with multiple address families.  The mess is
surprisingly limited, all things considered.

server/peer.c
server/tripe-admin.5.in

index a8099e4..341ea38 100644 (file)
@@ -527,9 +527,14 @@ buf *p_txstart(peer *p, unsigned msg)
 int p_txaddr(const addr *a, const void *p, size_t sz)
 {
   socklen_t sasz = addrsz(a);
+  int i;
 
+  if ((i = afix(a->sa.sa_family)) < 0) {
+    a_warn("PEER", "?ADDR", a, "disabled-address-family", A_END);
+    return (-1);
+  }
   IF_TRACING(T_PEER, trace_block(T_PACKET, "peer: sending packet", p, sz); )
-  if (sendto(sock.fd, p, sz, 0, &a->sa, sasz) < 0) {
+  if (sendto(udpsock[i].fd, p, sz, 0, &a->sa, sasz) < 0) {
     a_warn("PEER", "?ADDR", a, "socket-write-error", "?ERRNO", A_END);
     return (-1);
   }
index f066ae6..698e2a6 100644 (file)
@@ -1644,6 +1644,10 @@ An error occurred trying to read an incoming packet.
 An error occurred attempting to send a network packet.  We lost that
 one.
 .SP
+.BI "PEER " address\fR... " disabled-address-family"
+An attempt was made to send a packet to an address for which support was
+switched off by command-line options.
+.SP
 .BI "PEER " address\fR... " socket-write-error " ecode " " message
 An error occurred attempting to send a network packet.  We lost that
 one.