Skip to content

Commit 5105633

Browse files
committed
UCS/NETLINK: use a designated flag to allow using the default GW
1 parent a806b27 commit 5105633

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/ucs/sys/netlink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ ucs_netlink_get_route_info(const struct rtattr *rta, int len, int *if_index_p,
189189
}
190190
}
191191

192+
/* In some kernel versions, RTA_DST attribute is not set for default
193+
* gateway routes */
192194
if ((*if_index_p == -1) || ((*dst_in_addr == NULL) && (rtm_dst_len != 0))) {
193195
return UCS_ERR_INVALID_PARAM;
194196
}

src/uct/tcp/tcp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ typedef enum uct_tcp_device_addr_flags {
295295
* Device address is extended by additional information:
296296
* @ref uct_iface_local_addr_ns_t for loopback reachability
297297
*/
298-
UCT_TCP_DEVICE_ADDR_FLAG_LOOPBACK = UCS_BIT(0),
298+
UCT_TCP_DEVICE_ADDR_FLAG_LOOPBACK = UCS_BIT(0),
299299

300300
/**
301-
* Interface is IPoIB (IP over InfiniBand)
301+
* Allow communication with default gateway
302302
*/
303-
UCT_TCP_DEVICE_ADDR_FLAG_LINK_LAYER_IB = UCS_BIT(1)
303+
UCT_TCP_DEVICE_ADDR_FLAG_ALLOW_DEFAULT_GW = UCS_BIT(1)
304304
} uct_tcp_device_addr_flags_t;
305305

306306

src/uct/tcp/tcp_iface.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ static ucs_status_t uct_tcp_iface_get_device_address(uct_iface_h tl_iface,
139139
dev_addr->flags = 0;
140140
dev_addr->sa_family = saddr->sa_family;
141141

142-
if (ucs_netif_is_ipoib(iface->if_name)) {
143-
dev_addr->flags |= UCT_TCP_DEVICE_ADDR_FLAG_LINK_LAYER_IB;
142+
if (!ucs_netif_is_ipoib(iface->if_name)) {
143+
dev_addr->flags |= UCT_TCP_DEVICE_ADDR_FLAG_ALLOW_DEFAULT_GW;
144144
}
145145

146146
if (ucs_sockaddr_is_inaddr_loopback(saddr)) {
@@ -270,8 +270,8 @@ uct_tcp_iface_is_reachable_v2(const uct_iface_h tl_iface,
270270
}
271271

272272
/* Default gateway is not relevant for IPoIB interfaces */
273-
allow_default_gw = !(tcp_dev_addr->flags &
274-
UCT_TCP_DEVICE_ADDR_FLAG_LINK_LAYER_IB);
273+
allow_default_gw = !!(tcp_dev_addr->flags &
274+
UCT_TCP_DEVICE_ADDR_FLAG_ALLOW_DEFAULT_GW);
275275

276276
if (!ucs_netlink_route_exists(ndev_index,
277277
(const struct sockaddr *)&remote_addr,

0 commit comments

Comments
 (0)