summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-01 07:17:40 (GMT)
committerThomas Graf <tgraf@suug.ch>2010-11-01 07:17:40 (GMT)
commit4267d8f336b11e8fbbf1a4b54499ee19012b1b28 (patch)
tree4349cb1f09cc204f50a2555565359d486d2ce694 /include
parent7903d6ab4bc54421463517a116e93eef2448e92c (diff)
downloadlibnl-4267d8f336b11e8fbbf1a4b54499ee19012b1b28.zip
libnl-4267d8f336b11e8fbbf1a4b54499ee19012b1b28.tar.gz
libnl-4267d8f336b11e8fbbf1a4b54499ee19012b1b28.tar.bz2
classid auto generation if provided tc name does not exist
Manually editing etc/libnl/classid before adding tc objects is a pain. This patch adds code to attempt auto generating a unique tc id which will then be assigned to the provided name and added to the classid file. This will make the following commands work with prior definitions of the names "top" and "test" sudo sbin/nl-qdisc-add --dev eth0 --parent root --id top htb sudo sbin/nl-class-add --dev eth0 --parent top --id test htb --rate 100mbit It will generate the following ids automatically: 4001: top 4001:1 test
Diffstat (limited to 'include')
-rw-r--r--include/netlink/cli/tc.h2
-rw-r--r--include/netlink/route/tc.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/include/netlink/cli/tc.h b/include/netlink/cli/tc.h
index 762cc69..82f9a1d 100644
--- a/include/netlink/cli/tc.h
+++ b/include/netlink/cli/tc.h
@@ -16,7 +16,7 @@
extern void nl_cli_tc_parse_dev(struct rtnl_tc *, struct nl_cache *, char *);
extern void nl_cli_tc_parse_parent(struct rtnl_tc *, char *);
-extern void nl_cli_tc_parse_handle(struct rtnl_tc *, char *);
+extern void nl_cli_tc_parse_handle(struct rtnl_tc *, char *, int);
extern void nl_cli_tc_parse_mtu(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_mpu(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_overhead(struct rtnl_tc *, char *);
diff --git a/include/netlink/route/tc.h b/include/netlink/route/tc.h
index b4e953e..f1e8605 100644
--- a/include/netlink/route/tc.h
+++ b/include/netlink/route/tc.h
@@ -66,6 +66,8 @@ extern int rtnl_tc_calc_cell_log(int);
extern int rtnl_tc_read_classid_file(void);
extern char * rtnl_tc_handle2str(uint32_t, char *, size_t);
extern int rtnl_tc_str2handle(const char *, uint32_t *);
+extern int rtnl_classid_generate(const char *, uint32_t *,
+ uint32_t);
#ifdef __cplusplus
}