diff options
author | Samuel Tan <samueltan@google.com> | 2015-08-26 14:53:50 -0700 |
---|---|---|
committer | Samuel Tan <samueltan@google.com> | 2015-08-26 16:18:20 -0700 |
commit | c9637dfcff101b45b9a7aeac4e0e7237d829a59a (patch) | |
tree | 53bd45693fdb007bd475fae7be87715228fdb39e | |
parent | 400e4d5be8159b314dbaa692587f8431579f3f98 (diff) | |
download | dhcpcd-6.8.2-c9637dfcff101b45b9a7aeac4e0e7237d829a59a.tar.gz |
dhcpcd-6.8.2: assign interface index in get_interface
In if_discover, the interface struct's index member
(ifp->index) is assigned from the sll_ifindex member of
of ifa->if_addr (see if.c:490). However, this member is
not set in the get_interface function of ifaddrs.c. This
unitialized interface index member is later used to bind
a socket and send messages on it, which leads to errors.
Assign the interface index of selected interface in
get_interface to fix this.
BUG: 22956197
Change-Id: I41da8fc7abdf3f5fc05c1dc0446d2a1d9dc7557d
-rw-r--r-- | ifaddrs.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -84,6 +84,7 @@ struct ifaddrs *get_interface(const char *name, sa_family_t family) memset(hwaddr, 0, sizeof(struct sockaddr_ll)); hwaddr->sll_family = family; /* hwaddr->sll_protocol = ETHERTYPE_IP; */ + ifc_get_ifindex(ifa->ifa_name, &hwaddr->sll_ifindex); hwaddr->sll_hatype = ARPHRD_ETHER; hwaddr->sll_halen = ETH_ALEN; memcpy(hwaddr->sll_addr, hwbuf, ETH_ALEN); |