From c3239d8d309dc75f44839c0e715b1351d6d45758 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 13 Nov 2020 17:07:25 +0100 Subject: [PATCH 1/2] mptcp: make ALG bind failure fatal If the algo is not supported -- i.e. CRYPTO_SHA1 kconfig not enabled -- better to fail at the problems source instead of just print a message in debug and continue. Signed-off-by: Matthieu Baerts --- gtests/net/packetdrill/mptcp_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtests/net/packetdrill/mptcp_utils.c b/gtests/net/packetdrill/mptcp_utils.c index 5302f420..f4d84369 100644 --- a/gtests/net/packetdrill/mptcp_utils.c +++ b/gtests/net/packetdrill/mptcp_utils.c @@ -246,7 +246,7 @@ static int linux_af_alg_socket(const char *type, const char *name) strncpy((char *) sa.salg_type, type, sizeof(sa.salg_type)); strncpy((char *) sa.salg_name, name, sizeof(sa.salg_type)); if (bind(s, (struct sockaddr *) &sa, sizeof(sa)) < 0) { - DEBUGP("%s: Failed to bind AF_ALG socket(%s,%s): %s", + die("%s: Failed to bind AF_ALG socket(%s,%s): %s\n", __func__, type, name, strerror(errno)); close(s); return -1; From 7a85a3fbeb8dde923c90812fbb0f7b4d74e7b278 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 13 Nov 2020 17:09:41 +0100 Subject: [PATCH 2/2] mptcp: do not limit ALG algo to 14 char We were wrongly taking the size of 'type' instead of 'name'. Signed-off-by: Matthieu Baerts --- gtests/net/packetdrill/mptcp_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtests/net/packetdrill/mptcp_utils.c b/gtests/net/packetdrill/mptcp_utils.c index f4d84369..70cba26e 100644 --- a/gtests/net/packetdrill/mptcp_utils.c +++ b/gtests/net/packetdrill/mptcp_utils.c @@ -244,7 +244,7 @@ static int linux_af_alg_socket(const char *type, const char *name) memset(&sa, 0, sizeof(sa)); sa.salg_family = AF_ALG; strncpy((char *) sa.salg_type, type, sizeof(sa.salg_type)); - strncpy((char *) sa.salg_name, name, sizeof(sa.salg_type)); + strncpy((char *) sa.salg_name, name, sizeof(sa.salg_name)); if (bind(s, (struct sockaddr *) &sa, sizeof(sa)) < 0) { die("%s: Failed to bind AF_ALG socket(%s,%s): %s\n", __func__, type, name, strerror(errno));