Check if IP_TOS is defined before using.
This commit is contained in:
parent
764d51e044
commit
d500b59a82
|
@ -1181,11 +1181,13 @@ set_common_sockopts(int s)
|
|||
&x, sizeof(x)) == -1)
|
||||
err(1, "setsockopt");
|
||||
}
|
||||
#ifdef IP_TOS
|
||||
if (Tflag != -1) {
|
||||
if (setsockopt(s, IPPROTO_IP, IP_TOS,
|
||||
&Tflag, sizeof(Tflag)) == -1)
|
||||
err(1, "set IP ToS");
|
||||
}
|
||||
#endif
|
||||
if (Iflag) {
|
||||
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
|
||||
&Iflag, sizeof(Iflag)) == -1)
|
||||
|
@ -1201,6 +1203,7 @@ set_common_sockopts(int s)
|
|||
int
|
||||
map_tos(char *s, int *val)
|
||||
{
|
||||
#ifdef IP_TOS
|
||||
/* DiffServ Codepoints and other TOS mappings */
|
||||
const struct toskeywords {
|
||||
const char *keyword;
|
||||
|
@ -1242,6 +1245,7 @@ map_tos(char *s, int *val)
|
|||
return (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue