If we have a local UDP socket without the PKTINFO option set, it's
authorKen Raeburn <raeburn@mit.edu>
Wed, 14 Jan 2009 23:36:04 +0000 (23:36 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 14 Jan 2009 23:36:04 +0000 (23:36 +0000)
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

src/kadmin/server/network.c

index 8382b7350fc4b2dc69f0f2d3d166a586fc728621..df3f01cf063b37326a3e7c9561f5c41602db9f4a 100644 (file)
@@ -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;