diff options
author | Patrick McHardy <kaber@trash.net> | 2010-04-07 17:19:14 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-04-19 10:42:53 (GMT) |
commit | f5f49c224835c555df9e2c1f79ac5adf4640f4a8 (patch) | |
tree | 228c316604fe1eb067f7378671b9faa91cde8226 /lib | |
parent | 82907257184f647353a9a993caaa1ebadaee2842 (diff) | |
download | libnl-f5f49c224835c555df9e2c1f79ac5adf4640f4a8.zip libnl-f5f49c224835c555df9e2c1f79ac5adf4640f4a8.tar.gz libnl-f5f49c224835c555df9e2c1f79ac5adf4640f4a8.tar.bz2 |
addr: restore anycast functions
Seems it got lost during some cleanups.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/addr.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/route/addr.c b/lib/route/addr.c index d14c481..b170a50 100644 --- a/lib/route/addr.c +++ b/lib/route/addr.c @@ -126,6 +126,7 @@ #define ADDR_ATTR_LOCAL 0x0100 #define ADDR_ATTR_BROADCAST 0x0200 #define ADDR_ATTR_MULTICAST 0x0400 +#define ADDR_ATTR_ANYCAST 0x0800 static struct nl_cache_ops rtnl_addr_ops; static struct nl_object_ops addr_obj_ops; @@ -149,6 +150,7 @@ static void addr_free_data(struct nl_object *obj) nl_addr_put(addr->a_local); nl_addr_put(addr->a_bcast); nl_addr_put(addr->a_multicast); + nl_addr_put(addr->a_anycast); } static int addr_clone(struct nl_object *_dst, struct nl_object *_src) @@ -172,6 +174,10 @@ static int addr_clone(struct nl_object *_dst, struct nl_object *_src) if (!(dst->a_multicast = nl_addr_clone(src->a_multicast))) return -NLE_NOMEM; + if (src->a_anycast) + if (!(dst->a_anycast = nl_addr_clone(src->a_anycast))) + return -NLE_NOMEM; + return 0; } @@ -273,6 +279,15 @@ static int addr_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, addr->ce_mask |= ADDR_ATTR_MULTICAST; } + if (tb[IFA_ANYCAST]) { + addr->a_anycast = nl_addr_alloc_attr(tb[IFA_ANYCAST], + family); + if (!addr->a_anycast) + goto errout_nomem; + + addr->ce_mask |= ADDR_ATTR_ANYCAST; + } + err = pp->pp_cb((struct nl_object *) addr, pp); errout: rtnl_addr_put(addr); @@ -349,6 +364,11 @@ static void addr_dump_details(struct nl_object *obj, struct nl_dump_params *p) nl_addr2str(addr->a_multicast, buf, sizeof(buf))); + if (addr->ce_mask & ADDR_ATTR_ANYCAST) + nl_dump(p, " anycast %s", + nl_addr2str(addr->a_anycast, buf, + sizeof(buf))); + nl_dump(p, "\n"); } @@ -398,6 +418,7 @@ static int addr_compare(struct nl_object *_a, struct nl_object *_b, diff |= ADDR_DIFF(MULTICAST, nl_addr_cmp(a->a_multicast, b->a_multicast)); diff |= ADDR_DIFF(BROADCAST, nl_addr_cmp(a->a_bcast, b->a_bcast)); + diff |= ADDR_DIFF(ANYCAST, nl_addr_cmp(a->a_anycast, b->a_anycast)); if (flags & LOOSE_COMPARISON) diff |= ADDR_DIFF(FLAGS, @@ -825,6 +846,17 @@ struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *addr) return addr->a_multicast; } +int rtnl_addr_set_anycast(struct rtnl_addr *addr, struct nl_addr *anycast) +{ + return __assign_addr(addr, &addr->a_anycast, anycast, + ADDR_ATTR_ANYCAST); +} + +struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *addr) +{ + return addr->a_anycast; +} + uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *addr) { if (addr->ce_mask & ADDR_ATTR_CACHEINFO) |