1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
Author: mpostaire <maxime_postaire@hotmail.fr>
Description: Code cleanup + IPPROTO_MPTCP in defines header.
https://github.com/openssh/openssh-portable/pull/335
diff --git a/defines.h b/defines.h
index 279e509a..d73550a9 100644
--- a/defines.h
+++ b/defines.h
@@ -892,6 +892,10 @@ struct winsize {
# define SSH_IOBUFSZ 8192
#endif
+#ifndef IPPROTO_MPTCP
+#define IPPROTO_MPTCP 262
+#endif
+
/*
* We want functions in openbsd-compat, if enabled, to override system ones.
* We no-op out the weak symbol definition rather than remove it to reduce
diff --git a/sshconnect.c b/sshconnect.c
index 308bd755..63035a9d 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -359,10 +359,8 @@ ssh_create_socket(struct addrinfo *ai)
#endif
char ntop[NI_MAXHOST];
- if (options.use_mptcp)
- sock = socket(ai->ai_family, ai->ai_socktype, IPPROTO_MPTCP);
- else
- sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ sock = socket(ai->ai_family, ai->ai_socktype,
+ options.use_mptcp ? IPPROTO_MPTCP : ai->ai_protocol);
if (sock == -1) {
error("socket: %s", strerror(errno));
return -1;
diff --git a/sshd.c b/sshd.c
index 3f12299b..102079ac 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1046,13 +1046,8 @@ listen_on_addrs(struct listenaddr *la)
continue;
}
/* Create socket for listening. */
- if (options.use_mptcp) {
- listen_sock = socket(ai->ai_family, ai->ai_socktype,
- IPPROTO_MPTCP);
- } else {
- listen_sock = socket(ai->ai_family, ai->ai_socktype,
- ai->ai_protocol);
- }
+ listen_sock = socket(ai->ai_family, ai->ai_socktype,
+ options.use_mptcp ? IPPROTO_MPTCP : ai->ai_protocol);
if (listen_sock == -1) {
/* kernel may not support ipv6 */
verbose("socket: %.100s", strerror(errno));
|