diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-10-20 13:32:45 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-20 13:32:45 (GMT) |
commit | 420438c71f2951b4ad1525de0d805fbf1cc9b15c (patch) | |
tree | 790bab914f9cd174d08916a99a474a9e8e24180f /lib | |
parent | a670ee5d72cc6c2492108edfe131f7547081748f (diff) | |
download | libnl-420438c71f2951b4ad1525de0d805fbf1cc9b15c.zip libnl-420438c71f2951b4ad1525de0d805fbf1cc9b15c.tar.gz libnl-420438c71f2951b4ad1525de0d805fbf1cc9b15c.tar.bz2 |
Remove NL_DUMP_ENV code
Dumping objects as environment variables has never been implemented
completely and only increases the size of the library for no real
purpose. Integration into scripts is better achieved by implementing
a python module anyway.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/addr.c | 76 | ||||
-rw-r--r-- | lib/route/link.c | 68 | ||||
-rw-r--r-- | lib/route/neigh.c | 46 | ||||
-rw-r--r-- | lib/route/nexthop.c | 40 | ||||
-rw-r--r-- | lib/route/route_obj.c | 66 | ||||
-rw-r--r-- | lib/route/rule.c | 48 |
6 files changed, 0 insertions, 344 deletions
diff --git a/lib/route/addr.c b/lib/route/addr.c index 2e72f6e..b170a50 100644 --- a/lib/route/addr.c +++ b/lib/route/addr.c @@ -400,81 +400,6 @@ static void addr_dump_stats(struct nl_object *obj, struct nl_dump_params *p) addr_dump_details(obj, p); } -static void addr_dump_env(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_addr *addr = (struct rtnl_addr *) obj; - struct nl_cache *link_cache; - char buf[128]; - - nl_dump_line(p, "ADDR_FAMILY=%s\n", - nl_af2str(addr->a_family, buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_LOCAL) - nl_dump_line(p, "ADDR_LOCAL=%s\n", - nl_addr2str(addr->a_local, buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_PEER) - nl_dump_line(p, "ADDR_PEER=%s\n", - nl_addr2str(addr->a_peer, buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_BROADCAST) - nl_dump_line(p, "ADDR_BROADCAST=%s\n", - nl_addr2str(addr->a_bcast, buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_ANYCAST) - nl_dump_line(p, "ADDR_ANYCAST=%s\n", - nl_addr2str(addr->a_anycast, buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_MULTICAST) - nl_dump_line(p, "ADDR_MULTICAST=%s\n", - nl_addr2str(addr->a_multicast, buf, - sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_PREFIXLEN) - nl_dump_line(p, "ADDR_PREFIXLEN=%u\n", - addr->a_prefixlen); - link_cache = nl_cache_mngt_require("route/link"); - - nl_dump_line(p, "ADDR_IFINDEX=%u\n", addr->a_ifindex); - if (link_cache) - nl_dump_line(p, "ADDR_IFNAME=%s\n", - rtnl_link_i2name(link_cache, addr->a_ifindex, - buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_SCOPE) - nl_dump_line(p, "ADDR_SCOPE=%s\n", - rtnl_scope2str(addr->a_scope, buf, sizeof(buf))); - - if (addr->ce_mask & ADDR_ATTR_LABEL) - nl_dump_line(p, "ADDR_LABEL=%s\n", addr->a_label); - - rtnl_addr_flags2str(addr->a_flags, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, "ADDR_FLAGS=%s\n", buf); - - if (addr->ce_mask & ADDR_ATTR_CACHEINFO) { - struct rtnl_addr_cacheinfo *ci = &addr->a_cacheinfo; - - nl_dump_line(p, "ADDR_CACHEINFO_VALID=%s\n", - ci->aci_valid == 0xFFFFFFFFU ? "forever" : - nl_msec2str(ci->aci_valid * 1000, - buf, sizeof(buf))); - - nl_dump_line(p, "ADDR_CACHEINFO_PREFERED=%s\n", - ci->aci_prefered == 0xFFFFFFFFU ? "forever" : - nl_msec2str(ci->aci_prefered * 1000, - buf, sizeof(buf))); - - nl_dump_line(p, "ADDR_CACHEINFO_CREATED=%s\n", - nl_msec2str(addr->a_cacheinfo.aci_cstamp * 10, - buf, sizeof(buf))); - - nl_dump_line(p, "ADDR_CACHEINFO_LASTUPDATE=%s\n", - nl_msec2str(addr->a_cacheinfo.aci_tstamp * 10, - buf, sizeof(buf))); - } -} - static int addr_compare(struct nl_object *_a, struct nl_object *_b, uint32_t attrs, int flags) { @@ -1010,7 +935,6 @@ static struct nl_object_ops addr_obj_ops = { [NL_DUMP_LINE] = addr_dump_line, [NL_DUMP_DETAILS] = addr_dump_details, [NL_DUMP_STATS] = addr_dump_stats, - [NL_DUMP_ENV] = addr_dump_env, }, .oo_compare = addr_compare, .oo_attrs2str = addr_attrs2str, diff --git a/lib/route/link.c b/lib/route/link.c index cf488e5..7e2fef8 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -566,73 +566,6 @@ static void link_dump_stats(struct nl_object *obj, struct nl_dump_params *p) link->l_info_ops->io_dump[NL_DUMP_STATS](link, p); } -static void link_dump_env(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_link *link = (struct rtnl_link *) obj; - struct nl_cache *cache = dp_cache(obj); - char buf[128]; - int i; - - nl_dump_line(p, "LINK_NAME=%s\n", link->l_name); - nl_dump_line(p, "LINK_IFINDEX=%u\n", link->l_index); - nl_dump_line(p, "LINK_FAMILY=%s\n", - nl_af2str(link->l_family, buf, sizeof(buf))); - nl_dump_line(p, "LINK_TYPE=%s\n", - nl_llproto2str(link->l_arptype, buf, sizeof(buf))); - if (link->ce_mask & LINK_ATTR_ADDR) - nl_dump_line(p, "LINK_ADDRESS=%s\n", - nl_addr2str(link->l_addr, buf, sizeof(buf))); - nl_dump_line(p, "LINK_MTU=%u\n", link->l_mtu); - nl_dump_line(p, "LINK_TXQUEUELEN=%u\n", link->l_txqlen); - nl_dump_line(p, "LINK_WEIGHT=%u\n", link->l_weight); - - rtnl_link_flags2str(link->l_flags & ~IFF_RUNNING, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, "LINK_FLAGS=%s\n", buf); - - if (link->ce_mask & LINK_ATTR_QDISC) - nl_dump_line(p, "LINK_QDISC=%s\n", link->l_qdisc); - - if (link->ce_mask & LINK_ATTR_LINK) { - struct rtnl_link *ll = rtnl_link_get(cache, link->l_link); - - nl_dump_line(p, "LINK_LINK_IFINDEX=%d\n", link->l_link); - if (ll) { - nl_dump_line(p, "LINK_LINK_IFNAME=%s\n", ll->l_name); - rtnl_link_put(ll); - } - } - - if (link->ce_mask & LINK_ATTR_MASTER) { - struct rtnl_link *master = rtnl_link_get(cache, link->l_master); - nl_dump_line(p, "LINK_MASTER=%s\n", - master ? master->l_name : "none"); - if (master) - rtnl_link_put(master); - } - - if (link->ce_mask & LINK_ATTR_BRD) - nl_dump_line(p, "LINK_BROADCAST=%s\n", - nl_addr2str(link->l_bcast, buf, sizeof(buf))); - - if (link->ce_mask & LINK_ATTR_STATS) { - for (i = 0; i <= RTNL_LINK_STATS_MAX; i++) { - char *c = buf; - - sprintf(buf, "LINK_"); - rtnl_link_stat2str(i, buf + 5, sizeof(buf) - 5); - while (*c) { - *c = toupper(*c); - c++; - } - nl_dump_line(p, "%s=%" PRIu64 "\n", buf, link->l_stats[i]); - } - } - - if (link->l_info_ops && link->l_info_ops->io_dump[NL_DUMP_ENV]) - link->l_info_ops->io_dump[NL_DUMP_ENV](link, p); -} - #if 0 static int link_handle_event(struct nl_object *a, struct rtnl_link_event_cb *cb) { @@ -1430,7 +1363,6 @@ static struct nl_object_ops link_obj_ops = { [NL_DUMP_LINE] = link_dump_line, [NL_DUMP_DETAILS] = link_dump_details, [NL_DUMP_STATS] = link_dump_stats, - [NL_DUMP_ENV] = link_dump_env, }, .oo_compare = link_compare, .oo_attrs2str = link_attrs2str, diff --git a/lib/route/neigh.c b/lib/route/neigh.c index d4dc82c..0da9a17 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -383,51 +383,6 @@ static void neigh_dump_stats(struct nl_object *a, struct nl_dump_params *p) neigh_dump_details(a, p); } -static void neigh_dump_env(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_neigh *neigh = (struct rtnl_neigh *) obj; - char buf[128]; - - nl_dump_line(p, "NEIGH_FAMILY=%s\n", - nl_af2str(neigh->n_family, buf, sizeof(buf))); - - if (neigh->ce_mask & NEIGH_ATTR_LLADDR) - nl_dump_line(p, "NEIGHT_LLADDR=%s\n", - nl_addr2str(neigh->n_lladdr, buf, sizeof(buf))); - - if (neigh->ce_mask & NEIGH_ATTR_DST) - nl_dump_line(p, "NEIGH_DST=%s\n", - nl_addr2str(neigh->n_dst, buf, sizeof(buf))); - - if (neigh->ce_mask & NEIGH_ATTR_IFINDEX) { - struct nl_cache *link_cache; - - nl_dump_line(p, "NEIGH_IFINDEX=%u\n", neigh->n_ifindex); - - link_cache = nl_cache_mngt_require("route/link"); - if (link_cache) - nl_dump_line(p, "NEIGH_IFNAME=%s\n", - rtnl_link_i2name(link_cache, - neigh->n_ifindex, - buf, sizeof(buf))); - } - - if (neigh->ce_mask & NEIGH_ATTR_PROBES) - nl_dump_line(p, "NEIGH_PROBES=%u\n", neigh->n_probes); - - if (neigh->ce_mask & NEIGH_ATTR_TYPE) - nl_dump_line(p, "NEIGH_TYPE=%s\n", - nl_rtntype2str(neigh->n_type, buf, sizeof(buf))); - - rtnl_neigh_flags2str(neigh->n_flags, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, "NEIGH_FLAGS=%s\n", buf); - - rtnl_neigh_state2str(neigh->n_state, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, "NEIGH_STATE=%s\n", buf); -} - /** * @name Neighbour Object Allocation/Freeage * @{ @@ -846,7 +801,6 @@ static struct nl_object_ops neigh_obj_ops = { [NL_DUMP_LINE] = neigh_dump_line, [NL_DUMP_DETAILS] = neigh_dump_details, [NL_DUMP_STATS] = neigh_dump_stats, - [NL_DUMP_ENV] = neigh_dump_env, }, .oo_compare = neigh_compare, .oo_attrs2str = neigh_attrs2str, diff --git a/lib/route/nexthop.c b/lib/route/nexthop.c index 788e255..44c31a7 100644 --- a/lib/route/nexthop.c +++ b/lib/route/nexthop.c @@ -166,42 +166,6 @@ static void nh_dump_details(struct rtnl_nexthop *nh, struct nl_dump_params *dp) buf, sizeof(buf))); } -static void nh_dump_env(struct rtnl_nexthop *nh, struct nl_dump_params *dp) -{ - struct nl_cache *link_cache; - char buf[128]; - - link_cache = nl_cache_mngt_require("route/link"); - - if (nh->ce_mask & NH_ATTR_GATEWAY) - nl_dump_line(dp, "ROUTE_NH%d_VIA=%s\n", dp->dp_ivar, - nl_addr2str(nh->rtnh_gateway, buf, sizeof(buf))); - - if(nh->ce_mask & NH_ATTR_IFINDEX) { - if (link_cache) { - nl_dump_line(dp, "ROUTE_NH%d_DEV=%s\n", dp->dp_ivar, - rtnl_link_i2name(link_cache, - nh->rtnh_ifindex, - buf, sizeof(buf))); - } else - nl_dump_line(dp, "ROUTE_NH%d_DEV=%d\n", dp->dp_ivar, - nh->rtnh_ifindex); - } - - if (nh->ce_mask & NH_ATTR_WEIGHT) - nl_dump_line(dp, "ROUTE_NH%d_WEIGHT=%u\n", dp->dp_ivar, - nh->rtnh_weight); - - if (nh->ce_mask & NH_ATTR_REALMS) - nl_dump_line(dp, "ROUTE_NH%d_REALM=%04x:%04x\n", dp->dp_ivar, - RTNL_REALM_FROM(nh->rtnh_realms), - RTNL_REALM_TO(nh->rtnh_realms)); - - if (nh->ce_mask & NH_ATTR_FLAGS) - nl_dump_line(dp, "ROUTE_NH%d_FLAGS=<%s>\n", dp->dp_ivar, - rtnl_route_nh_flags2str(nh->rtnh_flags, - buf, sizeof(buf))); -} void rtnl_route_nh_dump(struct rtnl_nexthop *nh, struct nl_dump_params *dp) { switch (dp->dp_type) { @@ -215,10 +179,6 @@ void rtnl_route_nh_dump(struct rtnl_nexthop *nh, struct nl_dump_params *dp) nh_dump_details(nh, dp); break; - case NL_DUMP_ENV: - nh_dump_env(nh, dp); - break; - default: break; } diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index 7f26bfd..856dce4 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -289,71 +289,6 @@ static void route_dump_stats(struct nl_object *obj, struct nl_dump_params *p) } } -static void route_dump_env(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_route *route = (struct rtnl_route *) obj; - struct nl_cache *link_cache; - char buf[128]; - - link_cache = nl_cache_mngt_require("route/link"); - - nl_dump_line(p, "ROUTE_FAMILY=%s\n", - nl_af2str(route->rt_family, buf, sizeof(buf))); - - if (route->ce_mask & ROUTE_ATTR_DST) - nl_dump_line(p, "ROUTE_DST=%s\n", - nl_addr2str(route->rt_dst, buf, sizeof(buf))); - - if (route->ce_mask & ROUTE_ATTR_SRC) - nl_dump_line(p, "ROUTE_SRC=%s\n", - nl_addr2str(route->rt_src, buf, sizeof(buf))); - - if (route->ce_mask & ROUTE_ATTR_PREF_SRC) - nl_dump_line(p, "ROUTE_PREFSRC=%s\n", - nl_addr2str(route->rt_pref_src, buf, sizeof(buf))); - - if (route->ce_mask & ROUTE_ATTR_IIF) { - if (link_cache) { - nl_dump_line(p, "ROUTE_IIF=%s", - rtnl_link_i2name(link_cache, route->rt_iif, - buf, sizeof(buf))); - } else - nl_dump_line(p, "ROUTE_IIF=%d", route->rt_iif); - } - - if (route->ce_mask & ROUTE_ATTR_TOS) - nl_dump_line(p, "ROUTE_TOS=%u\n", route->rt_tos); - - if (route->ce_mask & ROUTE_ATTR_TABLE) - nl_dump_line(p, "ROUTE_TABLE=%u\n", - route->rt_table); - - if (route->ce_mask & ROUTE_ATTR_SCOPE) - nl_dump_line(p, "ROUTE_SCOPE=%s\n", - rtnl_scope2str(route->rt_scope, buf, sizeof(buf))); - - if (route->ce_mask & ROUTE_ATTR_PRIO) - nl_dump_line(p, "ROUTE_PRIORITY=%u\n", - route->rt_prio); - - if (route->ce_mask & ROUTE_ATTR_TYPE) - nl_dump_line(p, "ROUTE_TYPE=%s\n", - nl_rtntype2str(route->rt_type, buf, sizeof(buf))); - - if (route->ce_mask & ROUTE_ATTR_MULTIPATH) { - struct rtnl_nexthop *nh; - int index = 1; - - if (route->rt_nr_nh > 0) - nl_dump_line(p, "ROUTE_NR_NH=%u\n", route->rt_nr_nh); - - nl_list_for_each_entry(nh, &route->rt_nexthops, rtnh_list) { - p->dp_ivar = index++; - rtnl_route_nh_dump(nh, p); - } - } -} - static int route_compare(struct nl_object *_a, struct nl_object *_b, uint32_t attrs, int flags) { @@ -1185,7 +1120,6 @@ struct nl_object_ops route_obj_ops = { [NL_DUMP_LINE] = route_dump_line, [NL_DUMP_DETAILS] = route_dump_details, [NL_DUMP_STATS] = route_dump_stats, - [NL_DUMP_ENV] = route_dump_env, }, .oo_compare = route_compare, .oo_attrs2str = route_attrs2str, diff --git a/lib/route/rule.c b/lib/route/rule.c index 126e96d..182879f 100644 --- a/lib/route/rule.c +++ b/lib/route/rule.c @@ -227,53 +227,6 @@ static void rule_dump_stats(struct nl_object *obj, struct nl_dump_params *p) rule_dump_details(obj, p); } -static void rule_dump_env(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_rule *rule = (struct rtnl_rule *) obj; - char buf[128]; - - nl_dump_line(p, "RULE_PRIORITY=%u\n", rule->r_prio); - nl_dump_line(p, "RULE_FAMILY=%s\n", - nl_af2str(rule->r_family, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_DST) - nl_dump_line(p, "RULE_DST=%s\n", - nl_addr2str(rule->r_dst, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_DST_LEN) - nl_dump_line(p, "RULE_DSTLEN=%u\n", rule->r_dst_len); - - if (rule->ce_mask & RULE_ATTR_SRC) - nl_dump_line(p, "RULE_SRC=%s\n", - nl_addr2str(rule->r_src, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_SRC_LEN) - nl_dump_line(p, "RULE_SRCLEN=%u\n", rule->r_src_len); - - if (rule->ce_mask & RULE_ATTR_IIF) - nl_dump_line(p, "RULE_IIF=%s\n", rule->r_iif); - - if (rule->ce_mask & RULE_ATTR_TABLE) - nl_dump_line(p, "RULE_TABLE=%u\n", rule->r_table); - - if (rule->ce_mask & RULE_ATTR_REALMS) - nl_dump_line(p, "RULE_REALM=%u\n", rule->r_realms); - - if (rule->ce_mask & RULE_ATTR_MARK) - nl_dump_line(p, "RULE_MARK=0x%" PRIx64 "\n", rule->r_mark); - - if (rule->ce_mask & RULE_ATTR_DSFIELD) - nl_dump_line(p, "RULE_DSFIELD=%u\n", rule->r_dsfield); - - if (rule->ce_mask & RULE_ATTR_TYPE) - nl_dump_line(p, "RULE_TYPE=%s\n", - nl_rtntype2str(rule->r_type, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_SRCMAP) - nl_dump_line(p, "RULE_SRCMAP=%s\n", - nl_addr2str(rule->r_srcmap, buf, sizeof(buf))); -} - static int rule_compare(struct nl_object *_a, struct nl_object *_b, uint32_t attrs, int flags) { @@ -762,7 +715,6 @@ static struct nl_object_ops rule_obj_ops = { [NL_DUMP_LINE] = rule_dump_line, [NL_DUMP_DETAILS] = rule_dump_details, [NL_DUMP_STATS] = rule_dump_stats, - [NL_DUMP_ENV] = rule_dump_env, }, .oo_compare = rule_compare, .oo_attrs2str = rule_attrs2str, |