Skip to content

Commit

Permalink
netlink: fixed tunnel ipv6 link address parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomaschewski committed Mar 13, 2014
1 parent 3f467f7 commit 6281ad7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/iflist.c
Expand Up @@ -1277,8 +1277,15 @@ __ni_rtnl_parse_newaddr(unsigned ifflags, struct nlmsghdr *h, struct ifaddrmsg *
* local address is supplied in IFA_LOCAL attribute.
*/
if (ifflags & NI_IFF_POINT_TO_POINT) {
__ni_nla_get_addr(ifa->ifa_family, &ap->local_addr, tb[IFA_LOCAL]);
__ni_nla_get_addr(ifa->ifa_family, &ap->peer_addr, tb[IFA_ADDRESS]);
if (tb[IFA_LOCAL]) {
/* local peer remote */
__ni_nla_get_addr(ifa->ifa_family, &ap->local_addr, tb[IFA_LOCAL]);
__ni_nla_get_addr(ifa->ifa_family, &ap->peer_addr, tb[IFA_ADDRESS]);
} else
if (tb[IFA_ADDRESS]) {
/* local only, e.g. tunnel ipv6 link layer address */
__ni_nla_get_addr(ifa->ifa_family, &ap->local_addr, tb[IFA_ADDRESS]);
}
/* Note iproute2 code obtains peer_addr from IFA_BROADCAST */
/* When I read and remember it correctly, iproute2 is using:
* !tb[IFA_BROADCAST] && tb[IFA_LOCAL] && tb[IFA_ADDRESS]
Expand Down

0 comments on commit 6281ad7

Please sign in to comment.