- memset(&ipv6_attr.addr6, 0, sizeof(ipv6_attr.addr6));
- ipv6_attr.addr6.s6_addr[0] = 0xFE;
- ipv6_attr.addr6.s6_addr[1] = 0x80;
- ipv6_attr.addr6.s6_addr[15] = 1;
- memcpy(NLMSG_DATA(&req.nh) + sizeof(req.ifmsg.ifaddr), &ipv6_attr, sizeof(ipv6_attr));
-
- req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.ifmsg.ifaddr)
- + ipv6_attr.rta.rta_len);
+ memset(&ip6, 0, sizeof(ip6));
+ ip6.s6_addr[0] = 0xFE;
+ ip6.s6_addr[1] = 0x80;
+ ip6.s6_addr[15] = 1;
+ netlink_addattr(&req.nh, IFA_LOCAL, &ip6, sizeof(ip6));