From 56c76774f4077c83e975d51c3488f43e54390b5c Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 11 Oct 2017 02:02:39 +0100 Subject: [PATCH] server/: Post-merge fixup. 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 | 7 ++++++- server/tripe-admin.5.in | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/server/peer.c b/server/peer.c index a8099e41..341ea38b 100644 --- a/server/peer.c +++ b/server/peer.c @@ -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); } diff --git a/server/tripe-admin.5.in b/server/tripe-admin.5.in index f066ae6d..698e2a69 100644 --- a/server/tripe-admin.5.in +++ b/server/tripe-admin.5.in @@ -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. -- 2.11.0