Skip to content

Commit

Permalink
Merge pull request #677 from mtomaschewski/addr-scope
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomaschewski committed Nov 11, 2016
2 parents 21fc6fa + ac6fed0 commit 99e9731
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions schema/interface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<peer type="network-address"/>
<anycast type="network-address"/>
<broadcast type="network-address"/>
<scope type="builtin-route-scope"/>

<!-- currently raw flags -->
<flags type="uint32"/>
Expand Down
5 changes: 5 additions & 0 deletions src/dbus-objects/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ __ni_objectmodel_address_to_dict(const ni_address_t *ap, ni_dbus_variant_t *dict
if (ap->bcast_addr.ss_family == ap->family)
__ni_objectmodel_dict_add_sockaddr(dict, "broadcast", &ap->bcast_addr);

ni_dbus_dict_add_uint32(dict, "scope", ap->scope);
if (ap->flags)
ni_dbus_dict_add_uint32(dict, "flags", ap->flags);

Expand Down Expand Up @@ -606,6 +607,7 @@ __ni_objectmodel_address_from_dict(ni_address_t **list, const ni_dbus_variant_t
ni_address_t *ap = NULL;
ni_sockaddr_t local_addr;
unsigned int prefixlen;
uint32_t scope;

if (__ni_objectmodel_dict_get_sockaddr_prefix(dict, "local", &local_addr, &prefixlen)) {
const ni_dbus_variant_t *var;
Expand All @@ -619,6 +621,9 @@ __ni_objectmodel_address_from_dict(ni_address_t **list, const ni_dbus_variant_t
__ni_objectmodel_dict_get_sockaddr(dict, "anycast", &ap->anycast_addr);
__ni_objectmodel_dict_get_sockaddr(dict, "broadcast", &ap->bcast_addr);

if (ni_dbus_dict_get_uint32(dict, "scope", &scope) && scope <= RT_SCOPE_NOWHERE)
ap->scope = scope;

/* Do we need to translate them and map to names?
* The usable flags differ between address families and
* ipv6 temporary flag is same bit as secondary in ipv4.
Expand Down

0 comments on commit 99e9731

Please sign in to comment.