1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-15 15:43:24 +00:00

UDP-DATAGRAM no longer checks peerport by default

This commit is contained in:
Gerhard Rieger 2020-12-27 20:43:08 +01:00
parent 583e14d7fa
commit 50bdb453dd
6 changed files with 102 additions and 8 deletions

View file

@ -453,6 +453,13 @@ int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
return STAT_RETRYLATER;
}
/* only accept packets with correct remote ports */
if (retropt_ushort(opts, OPT_SOURCEPORT, &xfd->para.socket.ip.sourceport)
>= 0) {
xfd->para.socket.ip.dosourceport = true;
xfd->para.socket.ip.sourceport = ntohs(xfd->peersa.ip4.sin_port);
}
retropt_socket_pf(opts, &pf);
result =
_xioopen_udp_sendto(hostname, argv[2], opts, xioflags, xxfd, groups,
@ -466,10 +473,6 @@ int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
xfd->para.socket.la.soa.sa_family = xfd->peersa.soa.sa_family;
/* only accept packets with correct remote ports */
xfd->para.socket.ip.sourceport = ntohs(xfd->peersa.ip4.sin_port);
xfd->para.socket.ip.dosourceport = true;
/* which reply packets will be accepted - determine by range option */
if (retropt_string(opts, OPT_RANGE, &rangename)
>= 0) {