Check -s option source address for validity.
PR: bin/29026 MFC after: 1 week
This commit is contained in:
parent
4f31891e2d
commit
bc5cfff933
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128365
@ -880,13 +880,13 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
outip->ip_src = from->sin_addr;
|
outip->ip_src = from->sin_addr;
|
||||||
#ifndef IP_HDRINCL
|
|
||||||
|
/* Check the source address (-s), if any, is valid */
|
||||||
if (bind(sndsock, (struct sockaddr *)from, sizeof(*from)) < 0) {
|
if (bind(sndsock, (struct sockaddr *)from, sizeof(*from)) < 0) {
|
||||||
Fprintf(stderr, "%s: bind: %s\n",
|
Fprintf(stderr, "%s: bind: %s\n",
|
||||||
prog, strerror(errno));
|
prog, strerror(errno));
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
|
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
|
||||||
if (setpolicy(sndsock, "in bypass") < 0)
|
if (setpolicy(sndsock, "in bypass") < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user