]> git.pld-linux.org Git - packages/libnl.git/blob - old_kernels.patch
added old_kernel.patch; rel. 3
[packages/libnl.git] / old_kernels.patch
1 diff --git a/lib/route/addr.c b/lib/route/addr.c
2 index 97905f0..e6e91d2 100644
3 --- a/lib/route/addr.c
4 +++ b/lib/route/addr.c
5 @@ -598,7 +598,19 @@ static int build_addr_msg(struct rtnl_addr *tmpl, int cmd, int flags,
6                 NLA_PUT(msg, IFA_CACHEINFO, sizeof(ca), &ca);
7         }
8  
9 -       NLA_PUT_U32(msg, IFA_FLAGS, tmpl->a_flags);
10 +       if (tmpl->a_flags & ~0xFF) {
11 +               /* only set the IFA_FLAGS attribute, if they actually contain additional
12 +                * flags that are not already set to am.ifa_flags.
13 +                *
14 +                * Older kernels refuse RTM_NEWADDR and RTM_NEWROUTE messages with EINVAL
15 +                * if they contain unknown netlink attributes. See net/core/rtnetlink.c, which
16 +                * was fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.
17 +                *
18 +                * With this workaround, libnl will function correctly with older kernels,
19 +                * unless there is a new libnl user that wants to set these flags. In this
20 +                * case it's up to the user to workaround this issue. */
21 +               NLA_PUT_U32(msg, IFA_FLAGS, tmpl->a_flags);
22 +       }
23  
24         *result = msg;
25         return 0;
This page took 0.073319 seconds and 3 git commands to generate.