platform: change @plen field of NMPlatformIPxRoute to type guint8

On netlink layer, this field is uint8_t/uchar.

A larger (signed) plen makes no sense. Adjust the signatures
to have only guint8.
This commit is contained in:
Thomas Haller
2016-04-06 14:19:05 +02:00
parent b1e3deaf2f
commit 14ee5dd2f8
18 changed files with 83 additions and 62 deletions

View File

@@ -330,9 +330,8 @@ _nm_ip_config_source_from_rtprot (guint rtprot)
}
static void
clear_host_address (int family, const void *network, int plen, void *dst)
clear_host_address (int family, const void *network, guint8 plen, void *dst)
{
g_return_if_fail (plen == (guint8)plen);
g_return_if_fail (network);
switch (family) {
@@ -1779,6 +1778,9 @@ _new_from_nl_route (struct nlmsghdr *nlh, gboolean id_only)
? sizeof (in_addr_t)
: sizeof (struct in6_addr);
if (rtm->rtm_dst_len > (is_v4 ? 32 : 128))
goto errout;
/*****************************************************************
* parse nexthops. Only handle routes with one nh.
*****************************************************************/
@@ -2255,7 +2257,7 @@ _nl_msg_new_route (int nlmsg_type,
NMIPConfigSource source,
unsigned char scope,
gconstpointer network,
int plen,
guint8 plen,
gconstpointer gateway,
guint32 metric,
guint32 mss,
@@ -5454,7 +5456,7 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, NMPlatformGetRouteFlags fl
static gboolean
ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
in_addr_t network, guint8 plen, in_addr_t gateway,
in_addr_t pref_src, guint32 metric, guint32 mss)
{
NMPObject obj_id;
@@ -5479,7 +5481,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
static gboolean
ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
struct in6_addr network, guint8 plen, struct in6_addr gateway,
guint32 metric, guint32 mss)
{
NMPObject obj_id;
@@ -5503,7 +5505,7 @@ ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
}
static gboolean
ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, int plen, guint32 metric)
ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, guint8 plen, guint32 metric)
{
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
@@ -5559,7 +5561,7 @@ ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, int plen
}
static gboolean
ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, int plen, guint32 metric)
ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, guint8 plen, guint32 metric)
{
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
NMPObject obj_id;
@@ -5587,7 +5589,7 @@ ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, in
}
static const NMPlatformIP4Route *
ip4_route_get (NMPlatform *platform, int ifindex, in_addr_t network, int plen, guint32 metric)
ip4_route_get (NMPlatform *platform, int ifindex, in_addr_t network, guint8 plen, guint32 metric)
{
NMPObject obj_id;
const NMPObject *obj;
@@ -5600,7 +5602,7 @@ ip4_route_get (NMPlatform *platform, int ifindex, in_addr_t network, int plen, g
}
static const NMPlatformIP6Route *
ip6_route_get (NMPlatform *platform, int ifindex, struct in6_addr network, int plen, guint32 metric)
ip6_route_get (NMPlatform *platform, int ifindex, struct in6_addr network, guint8 plen, guint32 metric)
{
NMPObject obj_id;
const NMPObject *obj;