mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
platform: set link scope for IP4LL addresses
https://bugzilla.gnome.org/show_bug.cgi?id=728595 [thaller@redhat.com: minor change in coding style] Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
c0254336ce
commit
a2eb4789ac
1 changed files with 13 additions and 0 deletions
|
|
@ -2989,6 +2989,15 @@ addr4_to_broadcast (struct in_addr *dst, const struct in_addr *src, guint8 plen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define IPV4LL_NETWORK (htonl (0xA9FE0000L))
|
||||||
|
#define IPV4LL_NETMASK (htonl (0xFFFF0000L))
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
ip4_is_link_local (const struct in_addr *src)
|
||||||
|
{
|
||||||
|
return (src->s_addr & IPV4LL_NETMASK) == IPV4LL_NETWORK;
|
||||||
|
}
|
||||||
|
|
||||||
static struct nl_object *
|
static struct nl_object *
|
||||||
build_rtnl_addr (int family,
|
build_rtnl_addr (int family,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
|
|
@ -3012,6 +3021,10 @@ build_rtnl_addr (int family,
|
||||||
nle = rtnl_addr_set_local (rtnladdr, nladdr);
|
nle = rtnl_addr_set_local (rtnladdr, nladdr);
|
||||||
g_assert (!nle);
|
g_assert (!nle);
|
||||||
|
|
||||||
|
/* Tighten scope (IPv4 only) */
|
||||||
|
if (family == AF_INET && ip4_is_link_local (addr))
|
||||||
|
rtnl_addr_set_scope (rtnladdr, rtnl_str2scope ("link"));
|
||||||
|
|
||||||
/* IPv4 Broadcast address */
|
/* IPv4 Broadcast address */
|
||||||
if (family == AF_INET) {
|
if (family == AF_INET) {
|
||||||
struct in_addr bcast;
|
struct in_addr bcast;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue