Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtnl_addr_delete 3.2.24 doesn't work #56

Closed
manticorps opened this issue Mar 12, 2014 · 8 comments
Closed

rtnl_addr_delete 3.2.24 doesn't work #56

manticorps opened this issue Mar 12, 2014 · 8 comments

Comments

@manticorps
Copy link

Hi,

i am working on the 3.2.24 version of libnl, and i think there are a bug on the rtnl_addr_add and rtnl_addr_delete.

Even the test library in src fail to remove a route with interactive command :
swissdotnet@ubuntu:~/networkManager/workspace/libnl/libnl-3.2.24/src$ sudo ./nl-addr-delete -i
127.0.0.1/8 inet dev lo scope host
Delete? (y/N) n
10.110.0.247/24 inet dev eth3 scope global
Delete? (y/N) y
Error: Unable to delete address: Invalid input data or parameter

With debug informations :

----------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 88
.type = 2
.flags = 0 <>
.seq = 1394642172
.port = 10735
[ERRORMSG] 20 octets
.error = -22 "Invalid argument"
[ORIGINAL MESSAGE] 16 octets
.nlmsg_len = 16
.type = 21 <0x15>
.flags = 5 <REQUEST,ACK>
.seq = 1394642172
.port = 10735
--------------------------- END NETLINK MESSAGE ---------------------------
-- Error received: Invalid argument
-- Original message: type=0x15 length=68 flags=<REQUEST,ACK> sequence-nr=1394642172 pid=10735
Error: Unable to delete address: Invalid input data or parameter

I have check with version 3.2.7 and i have no problem with this version.

Thanks

@tgraf
Copy link
Contributor

tgraf commented Mar 13, 2014

Thanks for this bug report Can you post the original Netlink request message as well? The one preceeding the error message.

@manticorps
Copy link
Author

Damn, error in copy/paste sorry. There is the full capture :

-- Debug: Sent Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 20
.type = 18 <route/link::get>
.flags = 773 <REQUEST,ACK,ROOT,MATCH>
.seq = 1394712909
.port = 31458
[PAYLOAD] 4 octets
00 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 236
.type = 16 <route/link::new>
.flags = 2
.seq = 1394712909
.port = 31458
[PAYLOAD] 16 octets
00 00 04 03 01 00 00 00 49 00 01 00 00 00 00 00 ........I.......
[ATTR 03] 3 octets
6c 6f 00 lo.
[PADDING] 1 octets
00 .
[ATTR 13] 4 octets
00 00 00 00 ....
[ATTR 16] 1 octets
00 .
[PADDING] 3 octets
00 00 00 ...
[ATTR 17] 1 octets
00 .
[PADDING] 3 octets
00 00 00 ...
[ATTR 04] 4 octets
34 40 00 00 4@..
[ATTR 06] 8 octets
6e 6f 71 75 65 75 65 00 noqueue.
[ATTR 14] 28 octets
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ............
[ATTR 01] 6 octets
00 00 00 00 00 00 ......
[PADDING] 2 octets
00 00 ..
[ATTR 02] 6 octets
00 00 00 00 00 00 ......
[PADDING] 2 octets
00 00 ..
[ATTR 07] 92 octets
16 04 00 00 16 04 00 00 59 76 01 00 59 76 01 00 ........Yv..Yv..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ............
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 244
.type = 16 <route/link::new>
.flags = 2
.seq = 1394712909
.port = 31458
[PAYLOAD] 16 octets
00 00 01 00 02 00 00 00 43 10 01 00 00 00 00 00 ........C.......
[ATTR 03] 5 octets
65 74 68 33 00 eth3.
[PADDING] 3 octets
00 00 00 ...
[ATTR 13] 4 octets
e8 03 00 00 ....
[ATTR 16] 1 octets
00 .
[PADDING] 3 octets
00 00 00 ...
[ATTR 17] 1 octets
00 .
[PADDING] 3 octets
00 00 00 ...
[ATTR 04] 4 octets
dc 05 00 00 ....
[ATTR 06] 11 octets
70 66 69 66 6f 5f 66 61 73 74 00 pfifo_fast.
[PADDING] 1 octets
00 .
[ATTR 14] 28 octets
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 20 00 00 00 00 00 00 13 00 00 00 . ..........
[ATTR 01] 6 octets
00 0c 29 be 81 c1 ..)...
[PADDING] 2 octets
00 00 ..
[ATTR 02] 6 octets
ff ff ff ff ff ff ......
[PADDING] 2 octets
00 00 ..
[ATTR 07] 92 octets
65 a4 03 00 43 17 00 00 6a 5d 2a 07 1b aa 0a 00 e...C...j]*.....
04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ............
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 20
.type = 3
.flags = 2
.seq = 1394712909
.port = 31458
[PAYLOAD] 4 octets
00 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: End of multipart message block: type=DONE length=20 flags= sequence-nr=1394712909 pid=31458
-- Debug: Sent Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 20
.type = 22 <route/addr::get>
.flags = 773 <REQUEST,ACK,ROOT,MATCH>
.seq = 1394712910
.port = 31458
[PAYLOAD] 4 octets
00 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 48
.type = 20 <route/addr::new>
.flags = 2
.seq = 1394712910
.port = 31458
[PAYLOAD] 8 octets
02 08 80 fe 01 00 00 00 ........
[ATTR 01] 4 octets
7f 00 00 01 ....
[ATTR 02] 4 octets
7f 00 00 01 ....
[ATTR 03] 3 octets
6c 6f 00 lo.
[PADDING] 1 octets
00 .
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 60
.type = 20 <route/addr::new>
.flags = 2
.seq = 1394712910
.port = 31458
[PAYLOAD] 8 octets
02 18 80 00 02 00 00 00 ........
[ATTR 01] 4 octets
0a 6e 00 f7 .n..
[ATTR 02] 4 octets
0a 6e 00 f7 .n..
[ATTR 04] 4 octets
0a 6e 00 ff .n..
[ATTR 03] 5 octets
65 74 68 33 00 eth3.
[PADDING] 3 octets
00 00 00 ...
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 64
.type = 20 <route/addr::new>
.flags = 2
.seq = 1394712910
.port = 31458
[PAYLOAD] 8 octets
0a 80 80 fe 01 00 00 00 ........
[ATTR 01] 16 octets
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ................
[ATTR 06] 16 octets
ff ff ff ff ff ff ff ff ee 00 00 00 ee 00 00 00 ................
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 64
.type = 20 <route/addr::new>
.flags = 2
.seq = 1394712910
.port = 31458
[PAYLOAD] 8 octets
0a 40 80 fd 02 00 00 00 .@......
[ATTR 01] 16 octets
fe 80 00 00 00 00 00 00 02 0c 29 ff fe be 81 c1 ..........).....
[ATTR 06] 16 octets
ff ff ff ff ff ff ff ff 25 69 62 00 25 69 62 00 ........%ib.%ib.
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 20
.type = 3
.flags = 2
.seq = 1394712910
.port = 31458
[PAYLOAD] 4 octets
00 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: End of multipart message block: type=DONE length=20 flags= sequence-nr=1394712910 pid=31458
-- Debug: End of multipart message block: type=DONE length=20 flags= sequence-nr=1394712960 pid=31487
127.0.0.1/8 inet dev lo scope host
Delete? (y/N) n
10.110.0.247/24 inet dev eth3 scope global
Delete? (y/N) y
-- Debug: Sent Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 68
.type = 21 <route/addr::del>
.flags = 5 <REQUEST,ACK>
.seq = 1394712911
.port = 31458
[PAYLOAD] 8 octets
02 18 80 00 02 00 00 00 ........
[ATTR 02] 4 octets
0a 6e 00 f7 .n..
[ATTR 01] 4 octets
0a 6e 00 f7 .n..
[ATTR 03] 5 octets
65 74 68 33 00 eth3.
[PADDING] 3 octets
00 00 00 ...
[ATTR 04] 4 octets
0a 6e 00 ff .n..
[ATTR 08] 4 octets
80 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[NETLINK HEADER] 16 octets
.nlmsg_len = 88
.type = 2
.flags = 0 <>
.seq = 1394712911
.port = 31458
[ERRORMSG] 20 octets
.error = -22 "Invalid argument"
[ORIGINAL MESSAGE] 16 octets
.nlmsg_len = 16
.type = 21 <0x15>
.flags = 5 <REQUEST,ACK>
.seq = 1394712911
.port = 31458
--------------------------- END NETLINK MESSAGE ---------------------------
-- Error received: Invalid argument
-- Original message: type=0x15 length=68 flags=<REQUEST,ACK> sequence-nr=1394712911 pid=31458
Error: Unable to delete address: Invalid input data or parameter

127.0.0.1/8 inet dev lo scope host
Delete? (y/N) 10.110.0.247/24 inet dev eth3 scope global
Delete? (y/N)

Same result on kernel : Linux ubuntu 2.6.32-57-generic and 3.2.0

@thom311
Copy link
Owner

thom311 commented Mar 13, 2014

Without looking deep into this, it could be the same issue as https://bugzilla.redhat.com/show_bug.cgi?id=1063885#c22

Could you please retry with removing the line https://github.com/thom311/libnl/blob/master/lib/route/addr.c#L601 ?

@manticorps
Copy link
Author

You got'it that resolve the problem.

Thanks for the fast response.

@thom311
Copy link
Owner

thom311 commented Mar 13, 2014

Interesting. But it's not really the solution, because this line should be correct and is actually needed.

Could you please give more information about the system where this happens? Kernel version, architecture, ubuntu-version

@manticorps
Copy link
Author

Informations about the first system (a little old) :
Ubuntu-version : 10.04
Kernel 2.6.32-57 generic
Arch x86 (VM)

Full uname -a :
Linux ubuntu 2.6.32-57-generic #119-Ubuntu SMP Wed Feb 19 01:04:55 UTC 2014 i686 GNU/Linux

The ip configuration :
swissdotnet@ubuntu:~/workspace/tinyxml2$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:be:81:c1 brd ff:ff:ff:ff:ff:ff
inet 10.110.0.247/24 brd 10.110.0.255 scope global eth3
inet6 fe80::20c:29ff:febe:81c1/64 scope link
valid_lft forever preferred_lft forever

NetworkManager is running


The second system :
Debian 7.2
Kernel 3.2.0
Arch x64

@tgraf
Copy link
Contributor

tgraf commented Mar 13, 2014

I agree that this is a kernel bug but I can't reproduce this on a 3.13 kernel.

thom311 added a commit that referenced this issue Apr 4, 2014
… kernels

Older kernels don't accept receiving unknown netlink attributes.
See net/core/rtnetlink.c, rtnetlink_rcv_msg(). This was fixed by kernel
commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.

As a workaround, only set the additional attributes, when the user
provided flags that makes this necessary and useful.

#56
https://bugzilla.redhat.com/show_bug.cgi?id=1063885

Based-on-patch-by: Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
@thom311
Copy link
Owner

thom311 commented Apr 4, 2014

fixed by commit 5206c05

@thom311 thom311 closed this as completed Apr 4, 2014
mmazur pushed a commit to pld-linux/libnl that referenced this issue Jun 3, 2014
- libnl issue #56 (thom311/libnl#56):
  "Older kernels don't accept receiving unknown netlink attributes."
  (old kernel + new libnl ==> NetworkManager doesn't work)
chenyt9 pushed a commit to MotorolaMobilityLLC/external-libnl-headers that referenced this issue May 6, 2022
… kernels

Older kernels don't accept receiving unknown netlink attributes.
See net/core/rtnetlink.c, rtnetlink_rcv_msg(). This was fixed by kernel
commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.

As a workaround, only set the additional attributes, when the user
provided flags that makes this necessary and useful.

thom311/libnl#56
https://bugzilla.redhat.com/show_bug.cgi?id=1063885

Based-on-patch-by: Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants