From 957586db09dc65178c4c06b15682f139d80cd8e0 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 4 Mar 2015 15:15:03 +0100 Subject: [PATCH] inetd.c:inetd_dgram_peek() - Fix reading inbound UDP interface. There seems to have been a regression from earlier when this worked. I'm sure it worked ... or am I? This patch makes the whole thing look a lot more sane, so I wonder ... might have worked in my unit tests on x86, but not when I cross-compile to ARM. Signed-off-by: Joachim Nilsson --- inetd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inetd.c b/inetd.c index 7ff25a2b..9274d448 100644 --- a/inetd.c +++ b/inetd.c @@ -104,10 +104,14 @@ static void spawn_socket(inetd_t *inetd) /* Peek into SOCK_DGRAM socket to figure out where an inbound packet comes from. */ int inetd_dgram_peek(int sd, char *ifname) { + char cmbuf[0x100]; struct msghdr msgh; struct cmsghdr *cmsg; memset(&msgh, 0, sizeof(msgh)); + msgh.msg_control = cmbuf; + msgh.msg_controllen = sizeof(cmbuf); + if (recvmsg(sd, &msgh, MSG_PEEK) < 0) return -1;