Don't take the address of a variable whose scope is about to disappear.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 13 Nov 2012 14:01:43 +0000 (15:01 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Wed, 14 Nov 2012 10:16:47 +0000 (11:16 +0100)
Conflicts:
src/net_packet.c

src/net_packet.c

index cd8d98ac0b94cb602a738752f771cfa1d6102af2..7a473ab2f0c2dc814e008827a3697727e7e5c1ba 100644 (file)
@@ -500,16 +500,16 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
        struct sockaddr *sa;
        socklen_t sl;
        int sock;
+       sockaddr_t broadcast;
 
        /* Overloaded use of priority field: -1 means local broadcast */
 
        if(origpriority == -1 && n->prevedge) {
-               struct sockaddr_in in;
-               in.sin_family = AF_INET;
-               in.sin_addr.s_addr = -1;
-               in.sin_port = n->prevedge->address.in.sin_port;
-               sa = (struct sockaddr *)&in;
-               sl = sizeof in;
+               broadcast.in.sin_family = AF_INET;
+               broadcast.in.sin_addr.s_addr = -1;
+               broadcast.in.sin_port = n->prevedge->address.in.sin_port;
+               sa = &broadcast.sa;
+               sl = sizeof broadcast.in;
                sock = 0;
        } else {
                if(origpriority == -1)