X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=a7508fe3989601278c667bf3fb150a12afcb70c8;hb=c4d488788a3ed8fba3e75c9ddd632d1f98e9ac77;hp=85033d97124fc0c49e2b274b80277aefc8e7893e;hpb=c3af52231184ade3cf728ec60c9de9e87c2622ad;p=ppp.git diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 85033d9..a7508fe 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -125,6 +125,14 @@ #include #include #include +/* glibc versions prior to 2.24 do not define SOL_NETLINK */ +#ifndef SOL_NETLINK +#define SOL_NETLINK 270 +#endif +/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */ +#ifndef NETLINK_CAP_ACK +#define NETLINK_CAP_ACK 10 +#endif #endif #include "pppd.h" @@ -2843,7 +2851,15 @@ static int append_peer_ipv6_address(unsigned int iface, struct in6_addr *local_a if (fd < 0) return 0; - /* do not ask for error message content */ + /* + * Tell kernel to not send to us payload of acknowledgment error message. + * NETLINK_CAP_ACK option is supported since Linux kernel version 4.3 and + * older kernel versions always send full payload in acknowledgment netlink + * message. We ignore payload of this message as we need only error code, + * to check if our set remote peer address request succeeded or failed. + * So ignore return value from the following setsockopt() call as setting + * option NETLINK_CAP_ACK means for us just a kernel hint / optimization. + */ one = 1; setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one)); @@ -2869,8 +2885,8 @@ static int append_peer_ipv6_address(unsigned int iface, struct in6_addr *local_a ifa = NLMSG_DATA(nlmsg); ifa->ifa_family = AF_INET6; ifa->ifa_prefixlen = 128; - ifa->ifa_flags = 0; - ifa->ifa_scope = RT_SCOPE_UNIVERSE; + ifa->ifa_flags = IFA_F_PERMANENT; + ifa->ifa_scope = RT_SCOPE_LINK; ifa->ifa_index = iface; local_rta = IFA_RTA(ifa);