libnl/lib/route
Torsten Hilbrich 4035e5b5e8 link: fix regression in link message parser
In a simple test program that queries the source IP for a given
destination address I get a crash in the call to rtnl_link_alloc_cache.

Here is the stack trace (created with version 3.2.4):

Program received signal SIGSEGV, Segmentation fault.
0xb7eb7553 in strlen () from /lib/libc.so.6
(gdb) bt
#0  0xb7eb7553 in strlen () from /lib/libc.so.6
#1  0xb7eb7285 in strdup () from /lib/libc.so.6
#2  0xb7fcc305 in nla_strdup (nla=0x0) at attr.c:1033
#3  0xb7f9c173 in link_msg_parser (ops=0xb7fc2940, who=0x804b330, n=0x804c3e8, pp=0xbffffbf8) at route/link.c:486
#4  0xb7fcd485 in nl_cache_parse (ops=0xb7fc2940, who=0x804b330, nlh=0x804c3e8, params=0xbffffbf8) at cache.c:724
#5  0xb7fcd547 in update_msg_parser (msg=0x804b328, arg=0xbffffbb8) at cache.c:531
#6  0xb7fd1f25 in nl_cb_call (cb=<optimized out>, msg=<optimized out>, type=<optimized out>) at ../include/netlink-local.h:126
#7  recvmsgs (cb=<optimized out>, sk=<optimized out>) at nl.c:729
#8  nl_recvmsgs (sk=0x804b2d0, cb=0x804b368) at nl.c:780
#9  0xb7fcd5fd in __cache_pickup (sk=0x804b2d0, cache=<optimized out>, param=0xbffffbf8) at cache.c:560
#10 0xb7fcd83f in nl_cache_pickup (sk=0x804b2d0, cache=0x804b308) at cache.c:593
#11 0xb7fcd8c8 in nl_cache_refill (sk=0x804b2d0, cache=0x804b308) at cache.c:780
#12 0xb7f9d1fc in rtnl_link_alloc_cache (sk=0x804b2d0, family=4, result=0xbffffcd4) at route/link.c:868
#13 0x08048fd0 in libnl_init (data=<optimized out>) at helper_route.c:60
#14 iproute_get_source (destination=0xbffffeff "127.0.0.1",
    source=0xbffffd0f "\b\004c\370\267\364_\370\267\260\224\004\b8\375\377\277e\024\347\267\320\016\377\267\273\224\004\b\364_\370\267\260\224\004\b", source_size=17)
    at helper_route.c:105
#15 0x08048e6a in main (argc=2, argv=0xbffffde4) at ip_route_get.c:25

The attached patch (against 3.2.4) solves the problem, fixing something that
looks like a typo. The bug is still present in current Git master.
2012-01-12 13:15:31 +01:00
..
cls Unified TC API 2011-03-21 15:51:52 +01:00
link rtnl_link_bond_add: allow to allocate bond name in case NULL is given 2011-11-11 16:24:53 +01:00
qdisc htb: fix misplaced memset() overwriting already set htb prio option 2011-08-12 13:47:23 +02:00
.gitignore Let git ignore generated pktloc source files 2010-07-03 15:56:07 +02:00
addr.c Fix rtnl_link object memory leak when freeing rtnl_addr objects. 2011-10-10 11:44:05 +02:00
class.c trafic class/classifer API improvements and documentation 2011-03-29 12:41:59 +02:00
classid.c Improve readability of classid string representation 2011-04-20 16:29:42 +02:00
cls.c documentation updates 2011-07-14 12:48:00 +02:00
link.c link: fix regression in link message parser 2012-01-12 13:15:31 +01:00
neigh.c neigh: include ndm flags while building message 2011-06-15 16:23:35 +02:00
neightbl.c Add internal wait_for_ack() which only waits for ACK if !NL_NO_AUTO_ACK 2008-10-20 13:12:13 +02:00
nexthop.c constify struct trans_tbl 2010-11-17 16:09:08 +01:00
pktloc.c fix license of lib/route/pktloc.c 2011-09-08 15:08:22 +02:00
pktloc_grammar.l Packet location updates 2010-10-27 01:21:50 +02:00
pktloc_syntax.y pktloc: support to specify a shift operator for packet locations 2010-11-04 20:01:36 +01:00
qdisc.c Qdisc API improvements and documentation 2011-03-25 18:13:19 +01:00
route.c Documentation updates 2011-03-22 00:40:26 +01:00
route_obj.c Only use the MULTIPATH attribute when adding routes with more than one next hop. 2011-10-10 11:44:10 +02:00
route_utils.c constify struct trans_tbl 2010-11-17 16:09:08 +01:00
rtnl.c Use name "global" instead of "universe" for largest scope 2011-05-04 17:47:09 +02:00
rule.c Adding rule with "From" option doesn't work 2011-05-03 11:40:21 +02:00
tc.c documentation updates 2011-07-14 12:48:00 +02:00