]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix an unassigned memory error.
authorRoy Marples <roy@marples.name>
Wed, 30 Apr 2014 09:35:48 +0000 (09:35 +0000)
committerRoy Marples <roy@marples.name>
Wed, 30 Apr 2014 09:35:48 +0000 (09:35 +0000)
if-linux.c

index ad52bba70c4c57be5d3f0836caf67b976fc1fd5f..0a27256197d7a8d2d2a976c74924d84565cc1776 100644 (file)
@@ -773,9 +773,6 @@ if_openrawsocket(struct interface *ifp, int protocol)
                return -1;
        }
 #endif
-       su.sll.sll_family = PF_PACKET;
-       su.sll.sll_protocol = htons(protocol);
-       su.sll.sll_ifindex = (int)ifp->index;
        /* Install the DHCP filter */
        memset(&pf, 0, sizeof(pf));
        if (protocol == ETHERTYPE_ARP) {
@@ -794,6 +791,11 @@ if_openrawsocket(struct interface *ifp, int protocol)
                        goto eexit;
        }
 #endif
+
+       memset(&su, 0, sizeof(su));
+       su.sll.sll_family = PF_PACKET;
+       su.sll.sll_protocol = htons(protocol);
+       su.sll.sll_ifindex = (int)ifp->index;
        if (bind(s, &su.sa, sizeof(su)) == -1)
                goto eexit;
        return s;