platform: return extack message from add address/route operations
This commit is contained in:
@@ -815,7 +815,7 @@ nm_netns_ip_route_ecmp_commit(NMNetns *self,
|
|||||||
if (changed || is_reapply) {
|
if (changed || is_reapply) {
|
||||||
_LOGT("ecmp-route: multi-hop %s",
|
_LOGT("ecmp-route: multi-hop %s",
|
||||||
nmp_object_to_string(route_obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf)));
|
nmp_object_to_string(route_obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf)));
|
||||||
nm_platform_ip_route_add(priv->platform, NMP_NLM_FLAG_APPEND, route_obj);
|
nm_platform_ip_route_add(priv->platform, NMP_NLM_FLAG_APPEND, route_obj, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,9 @@ static gboolean ip6_address_add(NMPlatform *platform,
|
|||||||
struct in6_addr peer_addr,
|
struct in6_addr peer_addr,
|
||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint flags);
|
guint flags,
|
||||||
|
char **out_extack_msg);
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ip6_address_delete(NMPlatform *platform, int ifindex, struct in6_addr addr, guint8 plen);
|
ip6_address_delete(NMPlatform *platform, int ifindex, struct in6_addr addr, guint8 plen);
|
||||||
|
|
||||||
@@ -542,7 +544,7 @@ link_changed(NMPlatform *platform,
|
|||||||
nm_platform_cache_update_emit_signal(platform, cache_op, obj_old, device->obj);
|
nm_platform_cache_update_emit_signal(platform, cache_op, obj_old, device->obj);
|
||||||
|
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED(&device->ip6_lladdr)) {
|
if (!IN6_IS_ADDR_UNSPECIFIED(&device->ip6_lladdr)) {
|
||||||
if (device->obj->link.connected)
|
if (device->obj->link.connected) {
|
||||||
ip6_address_add(platform,
|
ip6_address_add(platform,
|
||||||
device->obj->link.ifindex,
|
device->obj->link.ifindex,
|
||||||
device->ip6_lladdr,
|
device->ip6_lladdr,
|
||||||
@@ -550,8 +552,9 @@ link_changed(NMPlatform *platform,
|
|||||||
in6addr_any,
|
in6addr_any,
|
||||||
NM_PLATFORM_LIFETIME_PERMANENT,
|
NM_PLATFORM_LIFETIME_PERMANENT,
|
||||||
NM_PLATFORM_LIFETIME_PERMANENT,
|
NM_PLATFORM_LIFETIME_PERMANENT,
|
||||||
0);
|
0,
|
||||||
else
|
NULL);
|
||||||
|
} else
|
||||||
ip6_address_delete(platform, device->obj->link.ifindex, device->ip6_lladdr, 64);
|
ip6_address_delete(platform, device->obj->link.ifindex, device->ip6_lladdr, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,7 +868,10 @@ mesh_set_ssid(NMPlatform *platform, int ifindex, const guint8 *ssid, gsize len)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ipx_address_add(NMPlatform *platform, int addr_family, const NMPlatformObject *address)
|
ipx_address_add(NMPlatform *platform,
|
||||||
|
int addr_family,
|
||||||
|
const NMPlatformObject *address,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
nm_auto_nmpobj NMPObject *obj = NULL;
|
nm_auto_nmpobj NMPObject *obj = NULL;
|
||||||
NMPCacheOpsType cache_op;
|
NMPCacheOpsType cache_op;
|
||||||
@@ -874,6 +880,7 @@ ipx_address_add(NMPlatform *platform, int addr_family, const NMPlatformObject *a
|
|||||||
NMPCache *cache = nm_platform_get_cache(platform);
|
NMPCache *cache = nm_platform_get_cache(platform);
|
||||||
|
|
||||||
g_assert(NM_IN_SET(addr_family, AF_INET, AF_INET6));
|
g_assert(NM_IN_SET(addr_family, AF_INET, AF_INET6));
|
||||||
|
g_assert(!out_extack_msg || !*out_extack_msg);
|
||||||
|
|
||||||
obj = nmp_object_new(addr_family == AF_INET ? NMP_OBJECT_TYPE_IP4_ADDRESS
|
obj = nmp_object_new(addr_family == AF_INET ? NMP_OBJECT_TYPE_IP4_ADDRESS
|
||||||
: NMP_OBJECT_TYPE_IP6_ADDRESS,
|
: NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
@@ -894,7 +901,8 @@ ip4_address_add(NMPlatform *platform,
|
|||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint32 flags,
|
guint32 flags,
|
||||||
const char *label)
|
const char *label,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
NMPlatformIP4Address address;
|
NMPlatformIP4Address address;
|
||||||
|
|
||||||
@@ -914,7 +922,7 @@ ip4_address_add(NMPlatform *platform,
|
|||||||
if (label)
|
if (label)
|
||||||
g_strlcpy(address.label, label, sizeof(address.label));
|
g_strlcpy(address.label, label, sizeof(address.label));
|
||||||
|
|
||||||
return ipx_address_add(platform, AF_INET, (const NMPlatformObject *) &address);
|
return ipx_address_add(platform, AF_INET, (const NMPlatformObject *) &address, out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -925,7 +933,8 @@ ip6_address_add(NMPlatform *platform,
|
|||||||
struct in6_addr peer_addr,
|
struct in6_addr peer_addr,
|
||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint32 flags)
|
guint32 flags,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
NMPlatformIP6Address address;
|
NMPlatformIP6Address address;
|
||||||
|
|
||||||
@@ -942,7 +951,7 @@ ip6_address_add(NMPlatform *platform,
|
|||||||
address.preferred = preferred;
|
address.preferred = preferred;
|
||||||
address.n_ifa_flags = flags;
|
address.n_ifa_flags = flags;
|
||||||
|
|
||||||
return ipx_address_add(platform, AF_INET6, (const NMPlatformObject *) &address);
|
return ipx_address_add(platform, AF_INET6, (const NMPlatformObject *) &address, out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -1092,7 +1101,7 @@ object_delete(NMPlatform *platform, const NMPObject *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ip_route_add(NMPlatform *platform, NMPNlmFlags flags, NMPObject *obj_stack)
|
ip_route_add(NMPlatform *platform, NMPNlmFlags flags, NMPObject *obj_stack, char **out_extack_msg)
|
||||||
{
|
{
|
||||||
NMDedupMultiIter iter;
|
NMDedupMultiIter iter;
|
||||||
nm_auto_nmpobj NMPObject *obj = NULL;
|
nm_auto_nmpobj NMPObject *obj = NULL;
|
||||||
@@ -1114,6 +1123,7 @@ ip_route_add(NMPlatform *platform, NMPNlmFlags flags, NMPObject *obj_stack)
|
|||||||
g_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_stack),
|
g_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_stack),
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
NMP_OBJECT_TYPE_IP6_ROUTE));
|
NMP_OBJECT_TYPE_IP6_ROUTE));
|
||||||
|
g_assert(!out_extack_msg || !*out_extack_msg);
|
||||||
|
|
||||||
addr_family = NMP_OBJECT_GET_ADDR_FAMILY(obj_stack);
|
addr_family = NMP_OBJECT_GET_ADDR_FAMILY(obj_stack);
|
||||||
|
|
||||||
|
@@ -77,6 +77,7 @@ test_cleanup_internal(void)
|
|||||||
lifetime,
|
lifetime,
|
||||||
preferred,
|
preferred,
|
||||||
0,
|
0,
|
||||||
|
NULL,
|
||||||
NULL));
|
NULL));
|
||||||
g_assert(nm_platform_ip6_address_add(NM_PLATFORM_GET,
|
g_assert(nm_platform_ip6_address_add(NM_PLATFORM_GET,
|
||||||
ifindex,
|
ifindex,
|
||||||
@@ -85,7 +86,8 @@ test_cleanup_internal(void)
|
|||||||
in6addr_any,
|
in6addr_any,
|
||||||
lifetime,
|
lifetime,
|
||||||
preferred,
|
preferred,
|
||||||
flags));
|
flags,
|
||||||
|
NULL));
|
||||||
nmtstp_ip4_route_add(NM_PLATFORM_GET,
|
nmtstp_ip4_route_add(NM_PLATFORM_GET,
|
||||||
ifindex,
|
ifindex,
|
||||||
NM_IP_CONFIG_SOURCE_USER,
|
NM_IP_CONFIG_SOURCE_USER,
|
||||||
|
@@ -1809,7 +1809,8 @@ _ip_address_add(NMPlatform *platform,
|
|||||||
lifetime,
|
lifetime,
|
||||||
preferred,
|
preferred,
|
||||||
flags,
|
flags,
|
||||||
label);
|
label,
|
||||||
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
g_assert(label == NULL);
|
g_assert(label == NULL);
|
||||||
success = nm_platform_ip6_address_add(platform,
|
success = nm_platform_ip6_address_add(platform,
|
||||||
@@ -1819,7 +1820,8 @@ _ip_address_add(NMPlatform *platform,
|
|||||||
peer_address->addr6,
|
peer_address->addr6,
|
||||||
lifetime,
|
lifetime,
|
||||||
preferred,
|
preferred,
|
||||||
flags);
|
flags,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
g_assert(success);
|
g_assert(success);
|
||||||
}
|
}
|
||||||
|
@@ -421,7 +421,8 @@ test_ip6_route(void)
|
|||||||
in6addr_any,
|
in6addr_any,
|
||||||
NM_PLATFORM_LIFETIME_PERMANENT,
|
NM_PLATFORM_LIFETIME_PERMANENT,
|
||||||
NM_PLATFORM_LIFETIME_PERMANENT,
|
NM_PLATFORM_LIFETIME_PERMANENT,
|
||||||
0));
|
0,
|
||||||
|
NULL));
|
||||||
accept_signals(route_added, 0, 3);
|
accept_signals(route_added, 0, 3);
|
||||||
|
|
||||||
_wait_for_ipv6_addr_non_tentative(NM_PLATFORM_GET, 200, ifindex, 1, &pref_src);
|
_wait_for_ipv6_addr_non_tentative(NM_PLATFORM_GET, 200, ifindex, 1, &pref_src);
|
||||||
@@ -706,7 +707,8 @@ test_ip4_route_options(gconstpointer test_data)
|
|||||||
a->lifetime,
|
a->lifetime,
|
||||||
a->preferred,
|
a->preferred,
|
||||||
a->n_ifa_flags,
|
a->n_ifa_flags,
|
||||||
a->label));
|
a->label,
|
||||||
|
NULL));
|
||||||
if (a->peer_address == a->address)
|
if (a->peer_address == a->address)
|
||||||
_wait_for_ipv4_addr_device_route(NM_PLATFORM_GET, 200, a->ifindex, a->address, a->plen);
|
_wait_for_ipv4_addr_device_route(NM_PLATFORM_GET, 200, a->ifindex, a->address, a->plen);
|
||||||
}
|
}
|
||||||
@@ -878,7 +880,8 @@ test_ip6_route_options(gconstpointer test_data)
|
|||||||
addr[i].peer_address,
|
addr[i].peer_address,
|
||||||
addr[i].lifetime,
|
addr[i].lifetime,
|
||||||
addr[i].preferred,
|
addr[i].preferred,
|
||||||
addr[i].n_ifa_flags));
|
addr[i].n_ifa_flags,
|
||||||
|
NULL));
|
||||||
}
|
}
|
||||||
_wait_for_ipv6_addr_non_tentative(NM_PLATFORM_GET, 400, IFINDEX, addr_n, addr_in6);
|
_wait_for_ipv6_addr_non_tentative(NM_PLATFORM_GET, 400, IFINDEX, addr_n, addr_in6);
|
||||||
|
|
||||||
|
@@ -8041,7 +8041,8 @@ static int
|
|||||||
do_add_addrroute(NMPlatform *platform,
|
do_add_addrroute(NMPlatform *platform,
|
||||||
const NMPObject *obj_id,
|
const NMPObject *obj_id,
|
||||||
struct nl_msg *nlmsg,
|
struct nl_msg *nlmsg,
|
||||||
gboolean suppress_netlink_failure)
|
gboolean suppress_netlink_failure,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
||||||
WaitForNlResponseResult seq_result = WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN;
|
WaitForNlResponseResult seq_result = WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN;
|
||||||
@@ -8049,6 +8050,7 @@ do_add_addrroute(NMPlatform *platform,
|
|||||||
int nle;
|
int nle;
|
||||||
char s_buf[256];
|
char s_buf[256];
|
||||||
|
|
||||||
|
nm_assert(!out_extack_msg || !*out_extack_msg);
|
||||||
nm_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_id),
|
nm_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_id),
|
||||||
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
||||||
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||||
@@ -8064,6 +8066,7 @@ do_add_addrroute(NMPlatform *platform,
|
|||||||
nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, sbuf1, sizeof(sbuf1)),
|
nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, sbuf1, sizeof(sbuf1)),
|
||||||
nm_strerror(nle),
|
nm_strerror(nle),
|
||||||
-nle);
|
-nle);
|
||||||
|
NM_SET_OUT(out_extack_msg, g_steal_pointer(&extack_msg));
|
||||||
return -NME_PL_NETLINK;
|
return -NME_PL_NETLINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9489,7 +9492,8 @@ ip4_address_add(NMPlatform *platform,
|
|||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint32 flags,
|
guint32 flags,
|
||||||
const char *label)
|
const char *label,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
NMPObject obj_id;
|
NMPObject obj_id;
|
||||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||||
@@ -9509,7 +9513,7 @@ ip4_address_add(NMPlatform *platform,
|
|||||||
label);
|
label);
|
||||||
|
|
||||||
nmp_object_stackinit_id_ip4_address(&obj_id, ifindex, addr, plen, peer_addr);
|
nmp_object_stackinit_id_ip4_address(&obj_id, ifindex, addr, plen, peer_addr);
|
||||||
return (do_add_addrroute(platform, &obj_id, nlmsg, FALSE) >= 0);
|
return (do_add_addrroute(platform, &obj_id, nlmsg, FALSE, out_extack_msg) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -9520,7 +9524,8 @@ ip6_address_add(NMPlatform *platform,
|
|||||||
struct in6_addr peer_addr,
|
struct in6_addr peer_addr,
|
||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint32 flags)
|
guint32 flags,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
NMPObject obj_id;
|
NMPObject obj_id;
|
||||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||||
@@ -9540,7 +9545,7 @@ ip6_address_add(NMPlatform *platform,
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
nmp_object_stackinit_id_ip6_address(&obj_id, ifindex, &addr);
|
nmp_object_stackinit_id_ip6_address(&obj_id, ifindex, &addr);
|
||||||
return (do_add_addrroute(platform, &obj_id, nlmsg, FALSE) >= 0);
|
return (do_add_addrroute(platform, &obj_id, nlmsg, FALSE, out_extack_msg) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -9602,7 +9607,7 @@ ip6_address_delete(NMPlatform *platform, int ifindex, struct in6_addr addr, guin
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ip_route_add(NMPlatform *platform, NMPNlmFlags flags, NMPObject *obj_stack)
|
ip_route_add(NMPlatform *platform, NMPNlmFlags flags, NMPObject *obj_stack, char **out_extack_msg)
|
||||||
{
|
{
|
||||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||||
|
|
||||||
@@ -9612,7 +9617,8 @@ ip_route_add(NMPlatform *platform, NMPNlmFlags flags, NMPObject *obj_stack)
|
|||||||
return do_add_addrroute(platform,
|
return do_add_addrroute(platform,
|
||||||
obj_stack,
|
obj_stack,
|
||||||
nlmsg,
|
nlmsg,
|
||||||
NM_FLAGS_HAS(flags, NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE));
|
NM_FLAGS_HAS(flags, NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE),
|
||||||
|
out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@@ -3559,7 +3559,8 @@ nm_platform_ip4_address_add(NMPlatform *self,
|
|||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint32 flags,
|
guint32 flags,
|
||||||
const char *label)
|
const char *label,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
_CHECK_SELF(self, klass, FALSE);
|
_CHECK_SELF(self, klass, FALSE);
|
||||||
|
|
||||||
@@ -3569,6 +3570,7 @@ nm_platform_ip4_address_add(NMPlatform *self,
|
|||||||
g_return_val_if_fail(preferred <= lifetime, FALSE);
|
g_return_val_if_fail(preferred <= lifetime, FALSE);
|
||||||
g_return_val_if_fail(!label || strlen(label) < sizeof(((NMPlatformIP4Address *) NULL)->label),
|
g_return_val_if_fail(!label || strlen(label) < sizeof(((NMPlatformIP4Address *) NULL)->label),
|
||||||
FALSE);
|
FALSE);
|
||||||
|
nm_assert(!out_extack_msg || !*out_extack_msg);
|
||||||
|
|
||||||
if (_LOGD_ENABLED()) {
|
if (_LOGD_ENABLED()) {
|
||||||
char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
||||||
@@ -3601,7 +3603,8 @@ nm_platform_ip4_address_add(NMPlatform *self,
|
|||||||
lifetime,
|
lifetime,
|
||||||
preferred,
|
preferred,
|
||||||
flags,
|
flags,
|
||||||
label);
|
label,
|
||||||
|
out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -3612,7 +3615,8 @@ nm_platform_ip6_address_add(NMPlatform *self,
|
|||||||
struct in6_addr peer_address,
|
struct in6_addr peer_address,
|
||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred,
|
guint32 preferred,
|
||||||
guint32 flags)
|
guint32 flags,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
_CHECK_SELF(self, klass, FALSE);
|
_CHECK_SELF(self, klass, FALSE);
|
||||||
|
|
||||||
@@ -3620,6 +3624,7 @@ nm_platform_ip6_address_add(NMPlatform *self,
|
|||||||
g_return_val_if_fail(plen <= 128, FALSE);
|
g_return_val_if_fail(plen <= 128, FALSE);
|
||||||
g_return_val_if_fail(lifetime > 0, FALSE);
|
g_return_val_if_fail(lifetime > 0, FALSE);
|
||||||
g_return_val_if_fail(preferred <= lifetime, FALSE);
|
g_return_val_if_fail(preferred <= lifetime, FALSE);
|
||||||
|
nm_assert(!out_extack_msg || !*out_extack_msg);
|
||||||
|
|
||||||
if (_LOGD_ENABLED()) {
|
if (_LOGD_ENABLED()) {
|
||||||
char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
||||||
@@ -3640,8 +3645,15 @@ nm_platform_ip6_address_add(NMPlatform *self,
|
|||||||
|
|
||||||
nm_platform_ip6_dadfailed_set(self, ifindex, &address, FALSE);
|
nm_platform_ip6_dadfailed_set(self, ifindex, &address, FALSE);
|
||||||
|
|
||||||
return klass
|
return klass->ip6_address_add(self,
|
||||||
->ip6_address_add(self, ifindex, address, plen, peer_address, lifetime, preferred, flags);
|
ifindex,
|
||||||
|
address,
|
||||||
|
plen,
|
||||||
|
peer_address,
|
||||||
|
lifetime,
|
||||||
|
preferred,
|
||||||
|
flags,
|
||||||
|
out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -4464,7 +4476,8 @@ next_plat:;
|
|||||||
NM_FLAGS_HAS(flags, NMP_IP_ADDRESS_SYNC_FLAGS_WITH_NOPREFIXROUTE)
|
NM_FLAGS_HAS(flags, NMP_IP_ADDRESS_SYNC_FLAGS_WITH_NOPREFIXROUTE)
|
||||||
? IFA_F_NOPREFIXROUTE
|
? IFA_F_NOPREFIXROUTE
|
||||||
: 0,
|
: 0,
|
||||||
known_address->a4.label))
|
known_address->a4.label,
|
||||||
|
NULL))
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (!nm_platform_ip6_address_add(
|
if (!nm_platform_ip6_address_add(
|
||||||
@@ -4478,7 +4491,8 @@ next_plat:;
|
|||||||
(NM_FLAGS_HAS(flags, NMP_IP_ADDRESS_SYNC_FLAGS_WITH_NOPREFIXROUTE)
|
(NM_FLAGS_HAS(flags, NMP_IP_ADDRESS_SYNC_FLAGS_WITH_NOPREFIXROUTE)
|
||||||
? IFA_F_NOPREFIXROUTE
|
? IFA_F_NOPREFIXROUTE
|
||||||
: 0)
|
: 0)
|
||||||
| known_address->a6.n_ifa_flags))
|
| known_address->a6.n_ifa_flags,
|
||||||
|
NULL))
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4975,7 +4989,8 @@ sync_route_add:
|
|||||||
r = nm_platform_ip_route_add(self,
|
r = nm_platform_ip_route_add(self,
|
||||||
NMP_NLM_FLAG_APPEND
|
NMP_NLM_FLAG_APPEND
|
||||||
| NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE,
|
| NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE,
|
||||||
conf_o);
|
conf_o,
|
||||||
|
NULL);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
if (r == -EEXIST) {
|
if (r == -EEXIST) {
|
||||||
/* Don't fail for EEXIST. It's not clear that the existing route
|
/* Don't fail for EEXIST. It's not clear that the existing route
|
||||||
@@ -5085,7 +5100,8 @@ sync_route_add:
|
|||||||
r2 = nm_platform_ip_route_add(self,
|
r2 = nm_platform_ip_route_add(self,
|
||||||
NMP_NLM_FLAG_APPEND
|
NMP_NLM_FLAG_APPEND
|
||||||
| NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE,
|
| NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE,
|
||||||
&oo);
|
&oo,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (r2 < 0) {
|
if (r2 < 0) {
|
||||||
_LOG3D("route-sync: failure to add gateway IPv%c route: %s: %s",
|
_LOG3D("route-sync: failure to add gateway IPv%c route: %s: %s",
|
||||||
@@ -5250,7 +5266,7 @@ nm_platform_ip_route_normalize(int addr_family, NMPlatformIPRoute *route)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_ip_route_add(NMPlatform *self, NMPNlmFlags flags, NMPObject *obj_stack)
|
_ip_route_add(NMPlatform *self, NMPNlmFlags flags, NMPObject *obj_stack, char **out_extack_msg)
|
||||||
{
|
{
|
||||||
char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE];
|
||||||
int ifindex;
|
int ifindex;
|
||||||
@@ -5266,6 +5282,7 @@ _ip_route_add(NMPlatform *self, NMPNlmFlags flags, NMPObject *obj_stack)
|
|||||||
nm_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_stack),
|
nm_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_stack),
|
||||||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||||
NMP_OBJECT_TYPE_IP6_ROUTE));
|
NMP_OBJECT_TYPE_IP6_ROUTE));
|
||||||
|
nm_assert(!out_extack_msg || !*out_extack_msg);
|
||||||
|
|
||||||
nm_assert(NMP_OBJECT_GET_TYPE(obj_stack) != NMP_OBJECT_TYPE_IP4_ROUTE
|
nm_assert(NMP_OBJECT_GET_TYPE(obj_stack) != NMP_OBJECT_TYPE_IP4_ROUTE
|
||||||
|| obj_stack->ip4_route.n_nexthops <= 1u || obj_stack->_ip4_route.extra_nexthops);
|
|| obj_stack->ip4_route.n_nexthops <= 1u || obj_stack->_ip4_route.extra_nexthops);
|
||||||
@@ -5287,11 +5304,14 @@ _ip_route_add(NMPlatform *self, NMPNlmFlags flags, NMPObject *obj_stack)
|
|||||||
* is stack allocated (and the potential "extra_nexthops" array is
|
* is stack allocated (and the potential "extra_nexthops" array is
|
||||||
* guaranteed to stay alive too).
|
* guaranteed to stay alive too).
|
||||||
*/
|
*/
|
||||||
return klass->ip_route_add(self, flags, obj_stack);
|
return klass->ip_route_add(self, flags, obj_stack, out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nm_platform_ip_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPObject *obj)
|
nm_platform_ip_route_add(NMPlatform *self,
|
||||||
|
NMPNlmFlags flags,
|
||||||
|
const NMPObject *obj,
|
||||||
|
char **out_extack_msg)
|
||||||
{
|
{
|
||||||
nm_auto_nmpobj const NMPObject *obj_keep_alive = NULL;
|
nm_auto_nmpobj const NMPObject *obj_keep_alive = NULL;
|
||||||
NMPObject obj_stack;
|
NMPObject obj_stack;
|
||||||
@@ -5309,7 +5329,7 @@ nm_platform_ip_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPObject *o
|
|||||||
obj_stack._ip4_route.extra_nexthops = obj->_ip4_route.extra_nexthops;
|
obj_stack._ip4_route.extra_nexthops = obj->_ip4_route.extra_nexthops;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ip_route_add(self, flags, &obj_stack);
|
return _ip_route_add(self, flags, &obj_stack, out_extack_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -5341,7 +5361,7 @@ nm_platform_ip4_route_add(NMPlatform *self,
|
|||||||
&extra_nexthops_free);
|
&extra_nexthops_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ip_route_add(self, flags, &obj);
|
return _ip_route_add(self, flags, &obj, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -5350,7 +5370,7 @@ nm_platform_ip6_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformI
|
|||||||
NMPObject obj;
|
NMPObject obj;
|
||||||
|
|
||||||
nmp_object_stackinit(&obj, NMP_OBJECT_TYPE_IP6_ROUTE, (const NMPlatformObject *) route);
|
nmp_object_stackinit(&obj, NMP_OBJECT_TYPE_IP6_ROUTE, (const NMPlatformObject *) route);
|
||||||
return _ip_route_add(self, flags, &obj);
|
return _ip_route_add(self, flags, &obj, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@@ -1215,7 +1215,8 @@ typedef struct {
|
|||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred_lft,
|
guint32 preferred_lft,
|
||||||
guint32 flags,
|
guint32 flags,
|
||||||
const char *label);
|
const char *label,
|
||||||
|
char **out_extack_msg);
|
||||||
gboolean (*ip6_address_add)(NMPlatform *self,
|
gboolean (*ip6_address_add)(NMPlatform *self,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
struct in6_addr address,
|
struct in6_addr address,
|
||||||
@@ -1223,7 +1224,8 @@ typedef struct {
|
|||||||
struct in6_addr peer_address,
|
struct in6_addr peer_address,
|
||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred_lft,
|
guint32 preferred_lft,
|
||||||
guint32 flags);
|
guint32 flags,
|
||||||
|
char **out_extack_msg);
|
||||||
gboolean (*ip4_address_delete)(NMPlatform *self,
|
gboolean (*ip4_address_delete)(NMPlatform *self,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
in_addr_t address,
|
in_addr_t address,
|
||||||
@@ -1234,7 +1236,11 @@ typedef struct {
|
|||||||
struct in6_addr address,
|
struct in6_addr address,
|
||||||
guint8 plen);
|
guint8 plen);
|
||||||
|
|
||||||
int (*ip_route_add)(NMPlatform *self, NMPNlmFlags flags, NMPObject *obj_stack);
|
int (*ip_route_add)(NMPlatform *self,
|
||||||
|
NMPNlmFlags flags,
|
||||||
|
NMPObject *obj_stack,
|
||||||
|
char **out_extack_msg);
|
||||||
|
|
||||||
int (*ip_route_get)(NMPlatform *self,
|
int (*ip_route_get)(NMPlatform *self,
|
||||||
int addr_family,
|
int addr_family,
|
||||||
gconstpointer address,
|
gconstpointer address,
|
||||||
@@ -2130,7 +2136,8 @@ gboolean nm_platform_ip4_address_add(NMPlatform *self,
|
|||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred_lft,
|
guint32 preferred_lft,
|
||||||
guint32 flags,
|
guint32 flags,
|
||||||
const char *label);
|
const char *label,
|
||||||
|
char **out_extack_msg);
|
||||||
gboolean nm_platform_ip6_address_add(NMPlatform *self,
|
gboolean nm_platform_ip6_address_add(NMPlatform *self,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
struct in6_addr address,
|
struct in6_addr address,
|
||||||
@@ -2138,7 +2145,8 @@ gboolean nm_platform_ip6_address_add(NMPlatform *self,
|
|||||||
struct in6_addr peer_address,
|
struct in6_addr peer_address,
|
||||||
guint32 lifetime,
|
guint32 lifetime,
|
||||||
guint32 preferred_lft,
|
guint32 preferred_lft,
|
||||||
guint32 flags);
|
guint32 flags,
|
||||||
|
char **out_extack_msg);
|
||||||
gboolean nm_platform_ip4_address_delete(NMPlatform *self,
|
gboolean nm_platform_ip4_address_delete(NMPlatform *self,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
in_addr_t address,
|
in_addr_t address,
|
||||||
@@ -2251,7 +2259,10 @@ nm_platform_ip_route_get_gateway(int addr_family, const NMPlatformIPRoute *route
|
|||||||
return &((NMPlatformIP6Route *) route)->gateway;
|
return &((NMPlatformIP6Route *) route)->gateway;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nm_platform_ip_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPObject *route);
|
int nm_platform_ip_route_add(NMPlatform *self,
|
||||||
|
NMPNlmFlags flags,
|
||||||
|
const NMPObject *route,
|
||||||
|
char **out_extack_msg);
|
||||||
int nm_platform_ip4_route_add(NMPlatform *self,
|
int nm_platform_ip4_route_add(NMPlatform *self,
|
||||||
NMPNlmFlags flags,
|
NMPNlmFlags flags,
|
||||||
const NMPlatformIP4Route *route,
|
const NMPlatformIP4Route *route,
|
||||||
|
@@ -1101,7 +1101,7 @@ nmp_global_tracker_sync(NMPGlobalTracker *self, NMPObjectType obj_type, gboolean
|
|||||||
NMP_NLM_FLAG_ADD,
|
NMP_NLM_FLAG_ADD,
|
||||||
NMP_OBJECT_CAST_ROUTING_RULE(obj_data->obj));
|
NMP_OBJECT_CAST_ROUTING_RULE(obj_data->obj));
|
||||||
} else
|
} else
|
||||||
nm_platform_ip_route_add(self->platform, NMP_NLM_FLAG_APPEND, obj_data->obj);
|
nm_platform_ip_route_add(self->platform, NMP_NLM_FLAG_APPEND, obj_data->obj, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user