nsna_ping EADDRNOTAVAIL
by Ivan Afonichev
Hello
nsna_ping seems to convert target_host address to some multicast address and try to do something with it which is failing:
[root@osho ~]# ps aux | grep team
root 475399 0.0 0.0 8580 4064 ? S 01:35 0:00 /usr/bin/teamd -o -n -U -D -N -t team0 -c { "runner": { "name": "activebackup" }, "link_watch": { "name": "nsna_ping", "target_host": "fe80::1e98:ecff:febf:8000" } }
root 475970 0.0 0.0 6164 2256 pts/0 S+ 01:47 0:00 grep --color=auto team
[root@osho ~]# LC_ALL=C strace -p 475399
strace: Process 475399 attached
pselect6(23, [3 9 10 14 15 16 19 20 22], [], [15], NULL, NULL) = 1 (in [22])
read(22, "\1\0\0\0\0\0\0\0", 8) = 8
getsockname(20, {sa_family=AF_PACKET, sa_data="\0\3\3\0\0\0\1\0\0\6<\354\357rE\327"}, [20 => 18]) = 0
sendto(21, "\207\0\0\0\0\0\0\0\376\200\0\0\0\0\0\0\36\230\354\377\376\277\200\0\1\1<\354\357rE\327", 32, 0, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "ff02::1:ffbf:8000", &sin6_addr), sin6_scope_id=if_nametoindex("eno2np1")}, 28) = -1 EADDRNOTAVAIL (Cannot assign requested address)
pselect6(23, [3 9 10 14 15 16 19 20 22], [], [15], NULL, NULL) = 1 (in [22])
read(22, "\1\0\0\0\0\0\0\0", 8) = 8
getsockname(20, {sa_family=AF_PACKET, sa_data="\0\3\3\0\0\0\1\0\0\6<\354\357rE\327"}, [20 => 18]) = 0
sendto(21, "\207\0\0\0\0\0\0\0\376\200\0\0\0\0\0\0\36\230\354\377\376\277\200\0\1\1<\354\357rE\327", 32, 0, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "ff02::1:ffbf:8000", &sin6_addr), sin6_scope_id=if_nametoindex("eno2np1")}, 28) = -1 EADDRNOTAVAIL (Cannot assign requested address)
pselect6(23, [3 9 10 14 15 16 19 20 22], [], [15], NULL, NULL) = 1 (in [22])
read(22, "\1\0\0\0\0\0\0\0", 8) = 8
getsockname(20, {sa_family=AF_PACKET, sa_data="\0\3\3\0\0\0\1\0\0\6<\354\357rE\327"}, [20 => 18]) = 0
sendto(21, "\207\0\0\0\0\0\0\0\376\200\0\0\0\0\0\0\36\230\354\377\376\277\200\0\1\1<\354\357rE\327", 32, 0, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "ff02::1:ffbf:8000", &sin6_addr), sin6_scope_id=if_nametoindex("eno2np1")}, 28) = -1 EADDRNOTAVAIL (Cannot assign requested address)
pselect6(23, [3 9 10 14 15 16 19 20 22], [], [15], NULL, NULL^Cstrace: Process 475399 detached
<detached ...>
How is it intended to be working?
1 year, 6 months
[patch v2 libteam 1/2] Collect and export statistics about total
probes sent
by Daniele Di Proietto
Collect statistics about the total number of probes sent for a
link-watcher. Only count a probe if send() doesn't return an error. If
send() returns an error (for example because the port is not currently
active), do not count it.
Export the value as a string, because int in jansson is limited to
32-bits (and, in general, JSON implementations do not handle 64-bits
values very well).
This is useful to monitor the arp_ping and nsna_ping link-watchers.
Signed-off-by: Daniele Di Proietto <ddiproietto(a)google.com>
---
v1->v2:
* Reword commit message to use imperative mood.
* Only count probes that were effectively sent on the wire by checking
the send() return value.
---
teamd/teamd_link_watch.h | 7 +++++++
teamd/teamd_lw_arp_ping.c | 21 +++++++++++++++------
teamd/teamd_lw_nsna_ping.c | 7 +++++++
teamd/teamd_lw_psr.c | 27 +++++++++++++++++++++++++--
4 files changed, 54 insertions(+), 8 deletions(-)
diff --git a/teamd/teamd_link_watch.h b/teamd/teamd_link_watch.h
index ea7ef87..9c404be 100644
--- a/teamd/teamd_link_watch.h
+++ b/teamd/teamd_link_watch.h
@@ -1,6 +1,8 @@
#ifndef _TEAMD_LINK_WATCH_H_
#define _TEAMD_LINK_WATCH_H_
+#include <stdint.h>
+
#include "teamd_state.h"
struct teamd_link_watch {
@@ -40,6 +42,8 @@ struct lw_psr_port_priv {
unsigned int missed_max;
int sock;
unsigned int missed;
+ uint64_t total_probes_sent;
+ bool probe_sent;
bool reply_received;
};
@@ -77,5 +81,8 @@ int lw_psr_state_missed_max_get(struct teamd_context *ctx,
int lw_psr_state_missed_get(struct teamd_context *ctx,
struct team_state_gsc *gsc,
void *priv);
+int lw_psr_state_total_probes_sent_get(struct teamd_context *ctx,
+ struct team_state_gsc *gsc,
+ void *priv);
#endif
diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c
index c3d4710..153a2e8 100644
--- a/teamd/teamd_lw_arp_ping.c
+++ b/teamd/teamd_lw_arp_ping.c
@@ -296,15 +296,19 @@ static int lw_ap_send(struct lw_psr_port_priv *psr_ppriv)
avp.vlanh.h_vlan_encapsulated_proto = htons(ETH_P_ARP);
avp.vlanh.h_vlan_TCI = htons(ap_ppriv->vlanid);
ll_bcast.sll_protocol = htons(ETH_P_8021Q);
- return teamd_sendto(psr_ppriv->sock, &avp, sizeof(avp),
- 0, (struct sockaddr *) &ll_bcast,
- sizeof(ll_bcast));
+ err = teamd_sendto(psr_ppriv->sock, &avp, sizeof(avp),
+ 0, (struct sockaddr *) &ll_bcast,
+ sizeof(ll_bcast));
} else {
ll_bcast.sll_protocol = htons(ETH_P_ARP);
- return teamd_sendto(psr_ppriv->sock, &ap, sizeof(ap),
- 0, (struct sockaddr *) &ll_bcast,
- sizeof(ll_bcast));
+ err = teamd_sendto(psr_ppriv->sock, &ap, sizeof(ap),
+ 0, (struct sockaddr *) &ll_bcast,
+ sizeof(ll_bcast));
}
+
+ if (!err)
+ psr_ppriv->probe_sent = true;
+ return err;
}
static int lw_ap_receive(struct lw_psr_port_priv *psr_ppriv)
@@ -477,6 +481,11 @@ static const struct teamd_state_val lw_ap_state_vals[] = {
.type = TEAMD_STATE_ITEM_TYPE_INT,
.getter = lw_psr_state_missed_get,
},
+ {
+ .subpath = "total_probes_sent",
+ .type = TEAMD_STATE_ITEM_TYPE_STRING,
+ .getter = lw_psr_state_total_probes_sent_get,
+ },
};
const struct teamd_link_watch teamd_link_watch_arp_ping = {
diff --git a/teamd/teamd_lw_nsna_ping.c b/teamd/teamd_lw_nsna_ping.c
index 9273462..b5648a7 100644
--- a/teamd/teamd_lw_nsna_ping.c
+++ b/teamd/teamd_lw_nsna_ping.c
@@ -227,6 +227,8 @@ static int lw_nsnap_send(struct lw_psr_port_priv *psr_ppriv)
err = teamd_sendto(nsnap_ppriv->tx_sock, &nsp, sizeof(nsp), 0,
(struct sockaddr *) &sendto_addr,
sizeof(sendto_addr));
+ if (!err)
+ psr_ppriv->probe_sent = true;
return err;
}
@@ -324,6 +326,11 @@ static const struct teamd_state_val lw_nsnap_state_vals[] = {
.type = TEAMD_STATE_ITEM_TYPE_INT,
.getter = lw_psr_state_missed_get,
},
+ {
+ .subpath = "total_probes_sent",
+ .type = TEAMD_STATE_ITEM_TYPE_STRING,
+ .getter = lw_psr_state_total_probes_sent_get,
+ },
};
const struct teamd_link_watch teamd_link_watch_nsnap = {
diff --git a/teamd/teamd_lw_psr.c b/teamd/teamd_lw_psr.c
index b0a41f4..d84e4a5 100644
--- a/teamd/teamd_lw_psr.c
+++ b/teamd/teamd_lw_psr.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
+#include <stdio.h>
#include <private/misc.h>
#include "teamd.h"
#include "teamd_link_watch.h"
@@ -57,8 +59,11 @@ static int lw_psr_callback_periodic(struct teamd_context *ctx, int events, void
if (err)
return err;
psr_ppriv->reply_received = false;
-
- return psr_ppriv->ops->send(psr_ppriv);
+ psr_ppriv->probe_sent = false;
+ err = psr_ppriv->ops->send(psr_ppriv);
+ if (!err && psr_ppriv->probe_sent)
+ psr_ppriv->total_probes_sent++;
+ return err;
}
#define LW_SOCKET_CB_NAME "lw_socket"
@@ -235,3 +240,21 @@ int lw_psr_state_missed_get(struct teamd_context *ctx,
gsc->data.int_val = psr_ppriv->missed;
return 0;
}
+
+int lw_psr_state_total_probes_sent_get(struct teamd_context *ctx,
+ struct team_state_gsc *gsc,
+ void *priv)
+{
+ struct lw_common_port_priv *common_ppriv = priv;
+ struct lw_psr_port_priv *psr_ppriv = lw_psr_ppriv_get(common_ppriv);
+ char *str;
+ int err;
+
+ err = asprintf(&str, "%"PRIu64, psr_ppriv->total_probes_sent);
+ if (err == -1)
+ return -ENOMEM;
+
+ gsc->data.str_val.ptr = str;
+ gsc->data.str_val.free = true;
+ return 0;
+}
--
2.33.0.259.gc128427fd7-goog
1 year, 6 months
[patch libteam 1/2] Collect and export statistics about total probes sent
by Daniele Di Proietto
From: Daniele Di Proietto <ddiproietto(a)google.com>
This is useful to monitor the arp_ping and nsna_ping link watches.
The value is exported as a string, because int in jansson is limited to
32-bits (and in general JSON implementations do not handle 64-bits
values very well).
Signed-off-by: Daniele Di Proietto <ddiproietto(a)google.com>
---
teamd/teamd_link_watch.h | 6 ++++++
teamd/teamd_lw_arp_ping.c | 5 +++++
teamd/teamd_lw_nsna_ping.c | 5 +++++
teamd/teamd_lw_psr.c | 25 ++++++++++++++++++++++++-
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/teamd/teamd_link_watch.h b/teamd/teamd_link_watch.h
index ea7ef87..46030aa 100644
--- a/teamd/teamd_link_watch.h
+++ b/teamd/teamd_link_watch.h
@@ -1,6 +1,8 @@
#ifndef _TEAMD_LINK_WATCH_H_
#define _TEAMD_LINK_WATCH_H_
+#include <stdint.h>
+
#include "teamd_state.h"
struct teamd_link_watch {
@@ -40,6 +42,7 @@ struct lw_psr_port_priv {
unsigned int missed_max;
int sock;
unsigned int missed;
+ uint64_t total_probes_sent;
bool reply_received;
};
@@ -77,5 +80,8 @@ int lw_psr_state_missed_max_get(struct teamd_context *ctx,
int lw_psr_state_missed_get(struct teamd_context *ctx,
struct team_state_gsc *gsc,
void *priv);
+int lw_psr_state_total_probes_sent_get(struct teamd_context *ctx,
+ struct team_state_gsc *gsc,
+ void *priv);
#endif
diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c
index c3d4710..d429e31 100644
--- a/teamd/teamd_lw_arp_ping.c
+++ b/teamd/teamd_lw_arp_ping.c
@@ -477,6 +477,11 @@ static const struct teamd_state_val lw_ap_state_vals[] = {
.type = TEAMD_STATE_ITEM_TYPE_INT,
.getter = lw_psr_state_missed_get,
},
+ {
+ .subpath = "total_probes_sent",
+ .type = TEAMD_STATE_ITEM_TYPE_STRING,
+ .getter = lw_psr_state_total_probes_sent_get,
+ },
};
const struct teamd_link_watch teamd_link_watch_arp_ping = {
diff --git a/teamd/teamd_lw_nsna_ping.c b/teamd/teamd_lw_nsna_ping.c
index 9273462..9468788 100644
--- a/teamd/teamd_lw_nsna_ping.c
+++ b/teamd/teamd_lw_nsna_ping.c
@@ -324,6 +324,11 @@ static const struct teamd_state_val lw_nsnap_state_vals[] = {
.type = TEAMD_STATE_ITEM_TYPE_INT,
.getter = lw_psr_state_missed_get,
},
+ {
+ .subpath = "total_probes_sent",
+ .type = TEAMD_STATE_ITEM_TYPE_STRING,
+ .getter = lw_psr_state_total_probes_sent_get,
+ },
};
const struct teamd_link_watch teamd_link_watch_nsnap = {
diff --git a/teamd/teamd_lw_psr.c b/teamd/teamd_lw_psr.c
index b0a41f4..68e028d 100644
--- a/teamd/teamd_lw_psr.c
+++ b/teamd/teamd_lw_psr.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
+#include <stdio.h>
#include <private/misc.h>
#include "teamd.h"
#include "teamd_link_watch.h"
@@ -58,7 +60,10 @@ static int lw_psr_callback_periodic(struct teamd_context *ctx, int events, void
return err;
psr_ppriv->reply_received = false;
- return psr_ppriv->ops->send(psr_ppriv);
+ err = psr_ppriv->ops->send(psr_ppriv);
+ if (!err)
+ psr_ppriv->total_probes_sent++;
+ return err;
}
#define LW_SOCKET_CB_NAME "lw_socket"
@@ -235,3 +240,21 @@ int lw_psr_state_missed_get(struct teamd_context *ctx,
gsc->data.int_val = psr_ppriv->missed;
return 0;
}
+
+int lw_psr_state_total_probes_sent_get(struct teamd_context *ctx,
+ struct team_state_gsc *gsc,
+ void *priv)
+{
+ struct lw_common_port_priv *common_ppriv = priv;
+ struct lw_psr_port_priv *psr_ppriv = lw_psr_ppriv_get(common_ppriv);
+ char *str;
+ int err;
+
+ err = asprintf(&str, "%"PRIu64, psr_ppriv->total_probes_sent);
+ if (err == -1)
+ return -ENOMEM;
+
+ gsc->data.str_val.ptr = str;
+ gsc->data.str_val.free = true;
+ return 0;
+}
--
2.32.0.93.g670b81a890-goog
1 year, 9 months
Re: [PATCH 1/1] teamd: better handle failures to
chown(TEAMD_RUN_DIR) during teamd_drop_privileges()
by Jiri Pirko
Fri, May 21, 2021 at 06:47:12PM CEST, thaller(a)redhat.com wrote:
>NetworkManager is exec-ing teamd while running without CAP_CHOWN.
>
>When teamd is configured to drop privileges, then it will call chown
>while still running as root user. But the command will fail because of
>lack of CAP_CHOWN.
>
>Note that chown() succeeds if the calling process has CAP_CHOWN or if
>the file already is owned by the calling user/group (whereas, changing
>the group will still work, if the user is a member of that group).
>
>The directory might have already been prepared with the right user/group.
>Let's handle that. If the first chown() as root succeeds, we are good.
>If it fails, we will retry after changing the user id. If the directory
>already has the right/compatible user, this command will succeeds too
>and teamd can proceed.
From the text I'm unable to tell what you are changing. Could you please
adjust the test to use the imperative mood as you would tell the
codebase what to do?
Thanks!
1 year, 9 months
[patch libteam] utils/bond2team: convert resend_igmp to mcast_rejoin.count
by Jamie Bainbridge
Bonding has option "resend_igmp" to control the number of IGMP
membership reports announced on an active-backup failover.
Teaming has the equivalent functionality with "mcast_rejoin.count"
bond2team reports "parameter resend_igmp not supported, aborting"
Implement conversion of "resend_igmp" to "mcast_rejoin.count"
Signed-off-by: Jamie Bainbridge <jamie.bainbridge(a)gmail.com>
---
utils/bond2team | 58 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/utils/bond2team b/utils/bond2team
index 2aae3f5..a8487b7 100755
--- a/utils/bond2team
+++ b/utils/bond2team
@@ -552,6 +552,22 @@ team_master_set_config()
fi
+ nr_opt=${#MCAST_OPTS[@]}
+ if [ $nr_opt -gt 0 ]; then
+ team_config="${team_config}, \"mcast_rejoin\" : { "
+ # add mcast_rejoin_options
+ for pos in $(seq 0 $((${#MCAST_OPTS[@]} - 1)))
+ do
+ if [ $pos -ne 0 ]; then
+ team_config="${team_config}, "
+ fi
+
+ team_config="${team_config} ${MCAST_OPTS[$pos]}"
+ done
+
+ team_config="${team_config} }"
+ fi
+
team_config="${team_config} }'"
pr_dbg "built team_config=${team_config}"
vfile_add_line "TEAM_CONFIG=${team_config}"
@@ -679,6 +695,18 @@ teamd_config_create()
done
fi
+ local mrejoin_nr=${#MCAST_OPTS[@]}
+ if [ ${mrejoin_nr} -gt 0 ]; then
+ local last_pos=$((${mrejoin_nr} - 1))
+ for pos in $(seq 0 ${last_pos})
+ do
+ if [ $pos -eq ${last_pos} ]; then
+ vfile_add_line " ${MCAST_OPTS[$pos]}"
+ else
+ vfile_add_line " ${MCAST_OPTS[$pos]},"
+ fi
+ done
+ fi
vfile_add_line " },"
return 0
}
@@ -1032,6 +1060,31 @@ lwatch_parse_opt()
esac
}
+# mcast Functions
+mcast_add_opt()
+{
+ pr_dbg "${FUNCNAME} $*"
+ local pos=${#MCAST_OPTS[*]}
+ MCAST_OPTS[${pos}]="$1"
+}
+
+mcast_parse_opt()
+{
+ pr_dbg "${FUNCNAME} $*"
+ local param=$1
+ local value=$2
+
+ case $param in
+ "resend_igmp")
+ mcast_add_opt "\"count\" : $value" || return 1
+ ;;
+ *)
+ pr_error "parameter $param=$value is not supported"
+ return 1
+ ;;
+ esac
+}
+
port_parse_opt()
{
pr_dbg "${FUNCNAME} $*"
@@ -1079,7 +1132,7 @@ convert_bond_opts()
pr_info "parameter $key not supported, ignoring"
continue
;;
- "all_slaves_active"|"resend_igmp"|"num_grat_arp"|"num_unsol_na")
+ "all_slaves_active"|"num_grat_arp"|"num_unsol_na")
pr_error "parameter $key not supported, aborting"
return 1
;;
@@ -1092,6 +1145,9 @@ convert_bond_opts()
"primary"|"primary_reselect")
port_parse_opt $key $value || return 1
;;
+ "resend_igmp")
+ mcast_parse_opt $key $value || return 1
+ ;;
*)
pr_error "unknown parameter $key=$value, aborting"
return 1
--
2.25.1
1 year, 9 months