From: Ken Raeburn Date: Wed, 14 Jan 2009 23:36:04 +0000 (+0000) Subject: If we have a local UDP socket without the PKTINFO option set, it's X-Git-Tag: krb5-1.7-alpha1~73 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=97af03eeb1b4ba7a982d066d8e3dbdc211892083;p=krb5.git If we have a local UDP socket without the PKTINFO option set, it's bound to a local address, so use getsockname to extract the local (destination) address. ticket: 6335 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21748 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/server/network.c b/src/kadmin/server/network.c index 8382b7350..df3f01cf0 100644 --- a/src/kadmin/server/network.c +++ b/src/kadmin/server/network.c @@ -1401,6 +1401,17 @@ static void process_packet(void *handle, } #endif + if (daddr_len == 0 && conn->type == CONN_UDP) { + /* If the PKTINFO option isn't set, this socket should be + bound to a specific local address. This info probably + should've been saved in our socket data structure at setup + time. */ + daddr_len = sizeof(daddr); + if (getsockname(port_fd, (struct sockaddr *)&daddr, &daddr_len) != 0) + daddr_len = 0; + /* On failure, keep going anyways. */ + } + request.length = cc; request.data = pktbuf; faddr.address = &addr;