Skip to content

Commit

Permalink
route/link/vxlan: merge branch 'vxlan-io-compare'
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Nov 20, 2015
2 parents acdeaf4 + 4b205ca commit ef32af0
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 103 deletions.
6 changes: 6 additions & 0 deletions include/netlink-private/route/link/api.h
Expand Up @@ -60,6 +60,10 @@ struct rtnl_link_info_ops
* in either io_alloc() or io_parse(). */
void (*io_free)(struct rtnl_link *);

/** Called to compare link info parameters between two links. */
int (*io_compare)(struct rtnl_link *, struct rtnl_link *,
uint32_t attrs, int flags);

struct nl_list_head io_list;
};

Expand Down Expand Up @@ -145,6 +149,8 @@ extern int rtnl_link_af_unregister(struct rtnl_link_af_ops *);
extern int rtnl_link_af_data_compare(struct rtnl_link *a,
struct rtnl_link *b,
int family);
extern int rtnl_link_info_data_compare(struct rtnl_link *a,
struct rtnl_link *b);

#ifdef __cplusplus
}
Expand Down
6 changes: 6 additions & 0 deletions include/netlink/utils.h
Expand Up @@ -185,6 +185,12 @@ enum {
NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR = 14,
#define NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR

/**
* Consider vxlan link info for nl_object_diff().
*/
NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE = 15,
#define NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE

__NL_CAPABILITY_MAX,
NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
#define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
Expand Down
1 change: 1 addition & 0 deletions lib/route/link.c
Expand Up @@ -960,6 +960,7 @@ static int link_compare(struct nl_object *_a, struct nl_object *_b,
goto protinfo_mismatch;
}

diff |= LINK_DIFF(LINKINFO, rtnl_link_info_data_compare(a, b) != 0);
out:
return diff;

Expand Down
22 changes: 22 additions & 0 deletions lib/route/link/api.c
Expand Up @@ -391,6 +391,28 @@ int rtnl_link_af_data_compare(struct rtnl_link *a, struct rtnl_link *b,
return ret;
}

/**
* Compare link info data
* @arg a Link object a
* @arg b Link object b
*
* This function will compare link_info data between two links
* a and b
*
* @return 0 if link_info data matches or is not present
* or != 0 if it mismatches.
*/
int rtnl_link_info_data_compare(struct rtnl_link *a, struct rtnl_link *b)
{
if (a->l_info_ops != b->l_info_ops)
return ~0;

if (!a->l_info_ops || !a->l_info_ops->io_compare)
return 0;

return a->l_info_ops->io_compare(a, b, ~0, 0);
}

/** @} */

/** @} */
Expand Down

0 comments on commit ef32af0

Please sign in to comment.