Skip to content

Commit 5302507

Browse files
committed
Move IPPROTO_MPTCP test into anet.h
Signed-off-by: zhenwei pi <[email protected]>
1 parent 6515509 commit 5302507

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/anet.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,12 @@ int anetSetSockMarkId(char *err, int fd, uint32_t id);
7575
int anetGetError(int fd);
7676
int anetIsFifo(char *filepath);
7777

78+
static inline int anetHasMptcp(void) {
79+
#ifdef IPPROTO_MPTCP
80+
return 1;
81+
#else
82+
return 0;
83+
#endif
84+
}
85+
7886
#endif

src/config.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,15 +2428,11 @@ static int isValidIpV6(char *val, const char **err) {
24282428
}
24292429

24302430
static int isValidMptcp(int val, const char **err) {
2431-
#ifndef IPPROTO_MPTCP
2432-
if (val) {
2431+
if (val && !anetHasMptcp()) {
24332432
*err = "MPTCP is not supported on this platform";
24342433
return 0;
24352434
}
2436-
#else
2437-
UNUSED(val);
2438-
UNUSED(err);
2439-
#endif
2435+
24402436
return 1;
24412437
}
24422438

0 commit comments

Comments
 (0)