]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
l2tp: read IPv6 UDP checksum attributes from kernel
authorAsbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
Wed, 16 Nov 2016 22:45:23 +0000 (22:45 +0000)
committerStephen Hemminger <sthemmin@microsoft.com>
Tue, 29 Nov 2016 21:31:30 +0000 (13:31 -0800)
In case of an older kernel that doesn't set L2TP_ATTR_UDP_ZERO_CSUM6_{RX,TX}
the old hard-coded value is being preserved, since the attribute flag will be
missing.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
ip/ipl2tp.c

index 03ca0cc45ba08666ce368785eed2e3a13aec2493..f5d41139312fa589f325096fc01d2120b02d2b8b 100644 (file)
@@ -292,12 +292,9 @@ static int get_response(struct nlmsghdr *n, void *arg)
        if (attrs[L2TP_ATTR_UDP_CSUM])
                p->udp_csum = !!rta_getattr_u8(attrs[L2TP_ATTR_UDP_CSUM]);
 
-       /*
-        * Not fetching from L2TP_ATTR_UDP_ZERO_CSUM6_{T,R}X because the
-        * kernel doesn't send it so just leave it as default value.
-        */
-       p->udp6_csum_tx = 1;
-       p->udp6_csum_rx = 1;
+       p->udp6_csum_tx = !attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX];
+       p->udp6_csum_rx = !attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX];
+
        if (attrs[L2TP_ATTR_COOKIE])
                memcpy(p->cookie, RTA_DATA(attrs[L2TP_ATTR_COOKIE]),
                       p->cookie_len = RTA_PAYLOAD(attrs[L2TP_ATTR_COOKIE]));