summaryrefslogtreecommitdiffstats
path: root/lib/route
diff options
context:
space:
mode:
authorThomas Graf <tgr@lsx.localdomain>2008-05-14 16:34:39 (GMT)
committerThomas Graf <tgr@lsx.localdomain>2008-05-14 16:34:39 (GMT)
commitb4fbe1d34d6f54045b5c6236d86aacd4340ec83d (patch)
tree5f0d8a6fc7d399388f983a069f2c0ac087022e93 /lib/route
parenteed2afaab7aa72fae393a395a8879b91a922ff5e (diff)
downloadlibnl-b4fbe1d34d6f54045b5c6236d86aacd4340ec83d.zip
libnl-b4fbe1d34d6f54045b5c6236d86aacd4340ec83d.tar.gz
libnl-b4fbe1d34d6f54045b5c6236d86aacd4340ec83d.tar.bz2
Replace RTNL_LINK_NOT_FOUND with just 0
The interface index 0 is reserved and can be safely used to signal that the device does not exist.
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/addr.c10
-rw-r--r--lib/route/link.c19
-rw-r--r--lib/route/neigh.c5
-rw-r--r--lib/route/tc.c5
4 files changed, 9 insertions, 30 deletions
diff --git a/lib/route/addr.c b/lib/route/addr.c
index e9101a0..905dce2 100644
--- a/lib/route/addr.c
+++ b/lib/route/addr.c
@@ -872,10 +872,7 @@ void rtnl_addr_set_ifindex(struct rtnl_addr *addr, int ifindex)
int rtnl_addr_get_ifindex(struct rtnl_addr *addr)
{
- if (addr->ce_mask & ADDR_ATTR_IFINDEX)
- return addr->a_ifindex;
- else
- return RTNL_LINK_NOT_FOUND;
+ return addr->a_ifindex;
}
void rtnl_addr_set_family(struct rtnl_addr *addr, int family)
@@ -886,10 +883,7 @@ void rtnl_addr_set_family(struct rtnl_addr *addr, int family)
int rtnl_addr_get_family(struct rtnl_addr *addr)
{
- if (addr->ce_mask & ADDR_ATTR_FAMILY)
- return addr->a_family;
- else
- return AF_UNSPEC;
+ return addr->a_family;
}
void rtnl_addr_set_prefixlen(struct rtnl_addr *addr, int prefix)
diff --git a/lib/route/link.c b/lib/route/link.c
index 182aba8..510932f 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -1092,11 +1092,11 @@ char * rtnl_link_i2name(struct nl_cache *cache, int ifindex, char *dst,
* @arg cache link cache
* @arg name link name
*
- * @return interface index or RTNL_LINK_NOT_FOUND if no match was found.
+ * @return interface index or 0 if no match was found.
*/
int rtnl_link_name2i(struct nl_cache *cache, const char *name)
{
- int ifindex = RTNL_LINK_NOT_FOUND;
+ int ifindex = 0;
struct rtnl_link *link;
link = rtnl_link_get_by_name(cache, name);
@@ -1366,10 +1366,7 @@ void rtnl_link_set_ifindex(struct rtnl_link *link, int ifindex)
int rtnl_link_get_ifindex(struct rtnl_link *link)
{
- if (link->ce_mask & LINK_ATTR_IFINDEX)
- return link->l_index;
- else
- return RTNL_LINK_NOT_FOUND;
+ return link->l_index;
}
void rtnl_link_set_mtu(struct rtnl_link *link, unsigned int mtu)
@@ -1422,10 +1419,7 @@ void rtnl_link_set_link(struct rtnl_link *link, int ifindex)
int rtnl_link_get_link(struct rtnl_link *link)
{
- if (link->ce_mask & LINK_ATTR_LINK)
- return link->l_link;
- else
- return RTNL_LINK_NOT_FOUND;
+ return link->l_link;
}
void rtnl_link_set_master(struct rtnl_link *link, int ifindex)
@@ -1436,10 +1430,7 @@ void rtnl_link_set_master(struct rtnl_link *link, int ifindex)
int rtnl_link_get_master(struct rtnl_link *link)
{
- if (link->ce_mask & LINK_ATTR_MASTER)
- return link->l_master;
- else
- return RTNL_LINK_NOT_FOUND;
+ return link->l_master;
}
void rtnl_link_set_operstate(struct rtnl_link *link, uint8_t operstate)
diff --git a/lib/route/neigh.c b/lib/route/neigh.c
index 723df7b..3c8fb1c 100644
--- a/lib/route/neigh.c
+++ b/lib/route/neigh.c
@@ -883,10 +883,7 @@ void rtnl_neigh_set_ifindex(struct rtnl_neigh *neigh, int ifindex)
int rtnl_neigh_get_ifindex(struct rtnl_neigh *neigh)
{
- if (neigh->ce_mask & NEIGH_ATTR_IFINDEX)
- return neigh->n_ifindex;
- else
- return RTNL_LINK_NOT_FOUND;
+ return neigh->n_ifindex;
}
static inline int __assign_addr(struct rtnl_neigh *neigh, struct nl_addr **pos,
diff --git a/lib/route/tc.c b/lib/route/tc.c
index de909be..15e88d4 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -274,10 +274,7 @@ void tca_set_ifindex(struct rtnl_tca *t, int ifindex)
int tca_get_ifindex(struct rtnl_tca *t)
{
- if (t->ce_mask & TCA_ATTR_IFINDEX)
- return t->tc_ifindex;
- else
- return RTNL_LINK_NOT_FOUND;
+ return t->tc_ifindex;
}
void tca_set_handle(struct rtnl_tca *t, uint32_t handle)