diff options
author | David Lamparter <equinox@diac24.net> | 2010-10-13 15:17:33 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-13 15:21:14 +0200 |
commit | 2b3fabab9ef2445ab1c48de0fed82514e4eb32dc (patch) | |
tree | 26465f4f838a96173b897fffc51ae03371dd223c | |
parent | cb05bbb0e2d38f41569754e1505c22929537c17e (diff) | |
download | android_external_libnl-2b3fabab9ef2445ab1c48de0fed82514e4eb32dc.tar.gz android_external_libnl-2b3fabab9ef2445ab1c48de0fed82514e4eb32dc.tar.bz2 android_external_libnl-2b3fabab9ef2445ab1c48de0fed82514e4eb32dc.zip |
route_obj: don't add empty destination to nlmsg
don't try to give the kernel an empty RTA_DST attribute. this would
previously happening on trying to delete the default route as returned
from the kernel. the kernel doesn't add a RTA_DST atttribute, so libnl
does nl_addr_alloc(0) and inserts a zero-length RTA_DST attribute into
the deletion request, which the kernel then refuses with ERANGE.
Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r-- | lib/route/route_obj.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index 4e14d6d..7f26bfd 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -1108,7 +1108,8 @@ int rtnl_route_build_msg(struct nl_msg *msg, struct rtnl_route *route) * required to allow more than 256 tables. */ NLA_PUT_U32(msg, RTA_TABLE, route->rt_table); - NLA_PUT_ADDR(msg, RTA_DST, route->rt_dst); + if (nl_addr_get_len(route->rt_dst)) + NLA_PUT_ADDR(msg, RTA_DST, route->rt_dst); NLA_PUT_U32(msg, RTA_PRIORITY, route->rt_prio); if (route->ce_mask & ROUTE_ATTR_SRC) |