From 2027a634a72b8cb0a6e0e863c2a55b123e4cd213 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Sat, 25 Jul 2015 10:51:47 +0200 Subject: netlink: Only disable TC stats if QoS is not available in kernel Up to now, the entire Netlink module was disable if QoS statistics were not available. Merely disable TC stats themselves but continue using the input module. Reported-by: Wen Chiu Signed-off-by: Thomas Graf --- src/in_netlink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/in_netlink.c b/src/in_netlink.c index d71ee9a..683e05f 100644 --- a/src/in_netlink.c +++ b/src/in_netlink.c @@ -738,7 +738,7 @@ static void do_link(struct nl_object *obj, void *arg) attr_update(e, m->attrid, c_rx, c_tx, flags); } - if (!c_notc) + if (!c_notc && qdisc_cache) handle_tc(e, link); element_notify_update(e, NULL); @@ -754,7 +754,8 @@ static void netlink_read(void) goto disable; } - if ((err = nl_cache_resync(sock, qdisc_cache, NULL, NULL)) < 0) { + if (qdisc_cache && + (err = nl_cache_resync(sock, qdisc_cache, NULL, NULL)) < 0) { fprintf(stderr, "Unable to resync qdisc cache: %s\n", nl_geterror(err)); goto disable; } @@ -805,8 +806,9 @@ static int netlink_do_init(void) } if ((err = rtnl_qdisc_alloc_cache(sock, &qdisc_cache)) < 0) { - fprintf(stderr, "Unable to allocate qdisc cache: %s\n", nl_geterror(err)); - goto disable; + fprintf(stderr, "Warning: Unable to allocate qdisc cache: %s\n", nl_geterror(err)); + fprintf(stderr, "Disabling QoS statistics.\n"); + qdisc_cache = NULL; } netlink_use_bit(link_attrs, ARRAY_SIZE(link_attrs)); -- cgit v1.2.3