diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-09 07:16:14 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-09 08:58:08 +0300 |
| commit | 0d7cd3a4ae6beed4eab485052a5e27b0772f15c6 (patch) | |
| tree | 8424afce39023890bbcfd7a60025cc42e910763a | |
| parent | a9f666ea84927427a27261b81aa77435d4296d28 (diff) | |
| download | accel-ppp-0d7cd3a4ae6beed4eab485052a5e27b0772f15c6.tar.gz accel-ppp-0d7cd3a4ae6beed4eab485052a5e27b0772f15c6.zip | |
pptp: pass a proper value to SO_REUSEADDR
The option value was the address of the listening descriptor rather than
a boolean, so the effect depended on the descriptor number: it enabled
SO_REUSEADDR only because that number happened to be non-zero, and would
disable it if the daemon were ever started with the lower descriptors
closed. Use a dedicated flag, as cli/telnet.c does.
| -rw-r--r-- | accel-pppd/ctrl/pptp/pptp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index 6b00666e..ec054e67 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -895,7 +895,7 @@ static void pptp_init(void) { struct sockaddr_in addr; char *opt; - int fd; + int fd, f = 1; fd = socket(AF_PPPOX, SOCK_STREAM, PX_PROTO_PPTP); if (fd >= 0) @@ -925,7 +925,7 @@ static void pptp_init(void) else addr.sin_port = htons(PPTP_PORT); - setsockopt(serv.hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv.hnd.fd, 4); + setsockopt(serv.hnd.fd, SOL_SOCKET, SO_REUSEADDR, &f, sizeof(f)); if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { log_emerg("pptp: failed to bind socket: %s\n", strerror(errno)); close(serv.hnd.fd); |
