diff options
author | zhenwei pi <pizhenwei@bytedance.com> | 2025-03-11 15:52:39 +0800 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-03-12 14:23:57 -0300 |
commit | a8e9022e0f829d44a818c642fc85b3bfbd26a514 (patch) | |
tree | aecd7b8c8490b449e0a96c55b20d74a54ba69731 | |
parent | 3e8814903c584b582740b42fa5fb0ad4e0e480bf (diff) | |
download | glibc-a8e9022e0f829d44a818c642fc85b3bfbd26a514.zip glibc-a8e9022e0f829d44a818c642fc85b3bfbd26a514.tar.gz glibc-a8e9022e0f829d44a818c642fc85b3bfbd26a514.tar.bz2 |
getaddrinfo.c: support MPTCP (BZ #29609)
There is a lack of MPTCP support from gaih_inet_typeproto array, add
MPTCP entry.
Signed-off-by: zhenwei pi <zhenwei.pi@linux.dev>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-rw-r--r-- | nss/getaddrinfo.c | 3 | ||||
-rw-r--r-- | nss/tst-getaddrinfo3.c | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/nss/getaddrinfo.c b/nss/getaddrinfo.c index 21e899f..efe6ad3 100644 --- a/nss/getaddrinfo.c +++ b/nss/getaddrinfo.c @@ -144,6 +144,9 @@ static const struct gaih_typeproto gaih_inet_typeproto[] = { SOCK_STREAM, IPPROTO_SCTP, 0, false, "sctp" }, { SOCK_SEQPACKET, IPPROTO_SCTP, 0, false, "sctp" }, #endif +#ifdef IPPROTO_MPTCP + { SOCK_STREAM, IPPROTO_MPTCP, 0, false, "mptcp" }, +#endif { SOCK_RAW, 0, GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE, true, "raw" }, { 0, 0, 0, false, "" } }; diff --git a/nss/tst-getaddrinfo3.c b/nss/tst-getaddrinfo3.c index 5077f31..caea19b 100644 --- a/nss/tst-getaddrinfo3.c +++ b/nss/tst-getaddrinfo3.c @@ -144,6 +144,32 @@ getaddrinfo test %d return address of family %d, expected %d\n", \ hints.ai_socktype = SOCK_STREAM; T (10, 0, "::ffff:127.0.0.1", AF_INET6, "::ffff:127.0.0.1"); +#ifdef IPPROTO_MPTCP + memset (&hints, '\0', sizeof (hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_MPTCP; + T (11, 0, "127.0.0.1", AF_INET, "127.0.0.1"); + + memset (&hints, '\0', sizeof (hints)); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_MPTCP; + T (12, 0, "127.0.0.1", AF_INET, "127.0.0.1"); + + memset (&hints, '\0', sizeof (hints)); + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_MPTCP; + T (13, 0, "::ffff:127.0.0.1", AF_INET6, "::ffff:127.0.0.1"); + + memset (&hints, '\0', sizeof (hints)); + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_MPTCP; + T (14, 0, "::ffff:127.0.0.1", AF_INET6, "::ffff:127.0.0.1"); +#endif + return result; } |