netem "Invalid input data or parameter" error

Marek Waszkiewicz marek.waszkiewicz77 at gmail.com
Mon Dec 11 05:49:53 PST 2017


Hi,
I was trying simple app with netem qdisc:

struct nl_sock *sock;
  struct rtnl_qdisc *q;
  struct nl_cache *cache;
  struct rtnl_link *link;
  int if_index;


  sock = nl_socket_alloc();

  nl_connect(sock, NETLINK_ROUTE);
  rtnl_link_alloc_cache(sock, AF_UNSPEC, &cache);
  link = rtnl_link_get_by_name(cache, "eth0");
  if_index = rtnl_link_get_ifindex(link);

  q = rtnl_qdisc_alloc();

  rtnl_tc_set_ifindex(TC_CAST(q), if_index);
  rtnl_tc_set_parent(TC_CAST(q), TC_H_ROOT);
  rtnl_tc_set_handle(TC_CAST(q), TC_HANDLE(1, 0));
  rtnl_tc_set_kind(TC_CAST(q), "netem");

  rtnl_netem_set_delay(q, 100);
  rtnl_netem_set_loss(q, 10);

  rtnl_qdisc_add(sock, q, NLM_F_CREATE);



However, adding netem qdisc  failed with:  EINVAL "Invalid input data
or parameter" error, any clues ?

Regards



More information about the libnl mailing list