rtnl: Minor cleanup
In l_rtnl_route_get_gateway return NULL if route is for an onlink prefix
(no gateway). Remove empty lines and use L_IN_SET in one instance.
diff --git a/ell/rtnl.c b/ell/rtnl.c
index 22f4552..126fb9d 100644
--- a/ell/rtnl.c
+++ b/ell/rtnl.c
@@ -469,6 +469,9 @@
if (unlikely(!rt))
return false;
+ if (address_is_null(rt->family, &rt->gw.in_addr, &rt->gw.in6_addr))
+ return false;
+
return !address_to_string(rt->family, &rt->gw.in_addr, &rt->gw.in6_addr,
out_buf);
}
@@ -583,9 +586,8 @@
if (unlikely(!rt))
return false;
- if (preference != ICMPV6_ROUTER_PREF_LOW &&
- preference != ICMPV6_ROUTER_PREF_HIGH &&
- preference != ICMPV6_ROUTER_PREF_MEDIUM)
+ if (!L_IN_SET(preference, ICMPV6_ROUTER_PREF_LOW,
+ ICMPV6_ROUTER_PREF_HIGH, ICMPV6_ROUTER_PREF_MEDIUM))
return false;
rt->preference = preference;
@@ -602,7 +604,6 @@
&rt->prefsrc.in6_addr))
return false;
-
return !address_to_string(rt->family, &rt->prefsrc.in_addr,
&rt->prefsrc.in6_addr,
out_address);
@@ -1079,7 +1080,6 @@
if (!inet_ntop(AF_INET6, &in6_addr, address,
INET6_ADDRSTRLEN)) {
-
l_error("rtnl: Failed to extract IPv6 address");
break;
}