You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
5.4 KiB
149 lines
5.4 KiB
diff --git a/pppd/plugins/pppoatm/pppoatm.c b/pppd/plugins/pppoatm/pppoatm.c |
|
index d693350..c31bb34 100644 |
|
--- a/pppd/plugins/pppoatm/pppoatm.c |
|
+++ b/pppd/plugins/pppoatm/pppoatm.c |
|
@@ -135,7 +135,7 @@ static int connect_pppoatm(void) |
|
|
|
if (!device_got_set) |
|
no_device_given_pppoatm(); |
|
- fd = socket(AF_ATMPVC, SOCK_DGRAM, 0); |
|
+ fd = socket(AF_ATMPVC, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (fd < 0) |
|
fatal("failed to create socket: %m"); |
|
memset(&qos, 0, sizeof qos); |
|
diff --git a/pppd/plugins/pppol2tp/openl2tp.c b/pppd/plugins/pppol2tp/openl2tp.c |
|
index 9643b96..1099575 100644 |
|
--- a/pppd/plugins/pppol2tp/openl2tp.c |
|
+++ b/pppd/plugins/pppol2tp/openl2tp.c |
|
@@ -83,7 +83,7 @@ static int openl2tp_client_create(void) |
|
int result; |
|
|
|
if (openl2tp_fd < 0) { |
|
- openl2tp_fd = socket(PF_UNIX, SOCK_DGRAM, 0); |
|
+ openl2tp_fd = socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (openl2tp_fd < 0) { |
|
error("openl2tp connection create: %m"); |
|
return -ENOTCONN; |
|
diff --git a/pppd/plugins/pppol2tp/pppol2tp.c b/pppd/plugins/pppol2tp/pppol2tp.c |
|
index a7e3400..e64a778 100644 |
|
--- a/pppd/plugins/pppol2tp/pppol2tp.c |
|
+++ b/pppd/plugins/pppol2tp/pppol2tp.c |
|
@@ -208,7 +208,7 @@ static void send_config_pppol2tp(int mtu, |
|
struct ifreq ifr; |
|
int fd; |
|
|
|
- fd = socket(AF_INET, SOCK_DGRAM, 0); |
|
+ fd = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (fd >= 0) { |
|
memset (&ifr, '\0', sizeof (ifr)); |
|
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); |
|
diff --git a/pppd/plugins/pppoe/if.c b/pppd/plugins/pppoe/if.c |
|
index 91e9a57..72aba41 100644 |
|
--- a/pppd/plugins/pppoe/if.c |
|
+++ b/pppd/plugins/pppoe/if.c |
|
@@ -116,7 +116,7 @@ openInterface(char const *ifname, UINT16_t type, unsigned char *hwaddr) |
|
stype = SOCK_PACKET; |
|
#endif |
|
|
|
- if ((fd = socket(domain, stype, htons(type))) < 0) { |
|
+ if ((fd = socket(domain, stype | SOCK_CLOEXEC, htons(type))) < 0) { |
|
/* Give a more helpful message for the common error case */ |
|
if (errno == EPERM) { |
|
fatal("Cannot create raw socket -- pppoe must be run as root."); |
|
diff --git a/pppd/plugins/pppoe/plugin.c b/pppd/plugins/pppoe/plugin.c |
|
index a8c2bb4..24bdf8f 100644 |
|
--- a/pppd/plugins/pppoe/plugin.c |
|
+++ b/pppd/plugins/pppoe/plugin.c |
|
@@ -137,7 +137,7 @@ PPPOEConnectDevice(void) |
|
/* server equipment). */ |
|
/* Opening this socket just before waitForPADS in the discovery() */ |
|
/* function would be more appropriate, but it would mess-up the code */ |
|
- conn->sessionSocket = socket(AF_PPPOX, SOCK_STREAM, PX_PROTO_OE); |
|
+ conn->sessionSocket = socket(AF_PPPOX, SOCK_STREAM | SOCK_CLOEXEC, PX_PROTO_OE); |
|
if (conn->sessionSocket < 0) { |
|
error("Failed to create PPPoE socket: %m"); |
|
return -1; |
|
@@ -148,7 +148,7 @@ PPPOEConnectDevice(void) |
|
lcp_wantoptions[0].mru = conn->mru; |
|
|
|
/* Update maximum MRU */ |
|
- s = socket(AF_INET, SOCK_DGRAM, 0); |
|
+ s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (s < 0) { |
|
error("Can't get MTU for %s: %m", conn->ifName); |
|
goto errout; |
|
@@ -320,7 +320,7 @@ PPPoEDevnameHook(char *cmd, char **argv, int doit) |
|
} |
|
|
|
/* Open a socket */ |
|
- if ((fd = socket(PF_PACKET, SOCK_RAW, 0)) < 0) { |
|
+ if ((fd = socket(PF_PACKET, SOCK_RAW | SOCK_CLOEXEC, 0)) < 0) { |
|
r = 0; |
|
} |
|
|
|
diff --git a/pppd/plugins/pppoe/pppoe-discovery.c b/pppd/plugins/pppoe/pppoe-discovery.c |
|
index 3d3bf4e..c0d927d 100644 |
|
--- a/pppd/plugins/pppoe/pppoe-discovery.c |
|
+++ b/pppd/plugins/pppoe/pppoe-discovery.c |
|
@@ -121,7 +121,7 @@ openInterface(char const *ifname, UINT16_t type, unsigned char *hwaddr) |
|
stype = SOCK_PACKET; |
|
#endif |
|
|
|
- if ((fd = socket(domain, stype, htons(type))) < 0) { |
|
+ if ((fd = socket(domain, stype | SOCK_CLOEXEC, htons(type))) < 0) { |
|
/* Give a more helpful message for the common error case */ |
|
if (errno == EPERM) { |
|
fatal("Cannot create raw socket -- pppoe must be run as root."); |
|
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c |
|
index 00a2cf5..0690019 100644 |
|
--- a/pppd/sys-linux.c |
|
+++ b/pppd/sys-linux.c |
|
@@ -308,12 +308,12 @@ static int modify_flags(int fd, int clear_bits, int set_bits) |
|
void sys_init(void) |
|
{ |
|
/* Get an internet socket for doing socket ioctls. */ |
|
- sock_fd = socket(AF_INET, SOCK_DGRAM, 0); |
|
+ sock_fd = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (sock_fd < 0) |
|
fatal("Couldn't create IP socket: %m(%d)", errno); |
|
|
|
#ifdef INET6 |
|
- sock6_fd = socket(AF_INET6, SOCK_DGRAM, 0); |
|
+ sock6_fd = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (sock6_fd < 0) |
|
sock6_fd = -errno; /* save errno for later */ |
|
#endif |
|
@@ -1857,7 +1857,7 @@ get_if_hwaddr(u_char *addr, char *name) |
|
struct ifreq ifreq; |
|
int ret, sock_fd; |
|
|
|
- sock_fd = socket(AF_INET, SOCK_DGRAM, 0); |
|
+ sock_fd = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (sock_fd < 0) |
|
return -1; |
|
memset(&ifreq.ifr_hwaddr, 0, sizeof(struct sockaddr)); |
|
@@ -2067,7 +2067,7 @@ int ppp_available(void) |
|
/* |
|
* Open a socket for doing the ioctl operations. |
|
*/ |
|
- s = socket(AF_INET, SOCK_DGRAM, 0); |
|
+ s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
|
if (s < 0) |
|
return 0; |
|
|
|
diff --git a/pppd/tty.c b/pppd/tty.c |
|
index bc96695..8e76a5d 100644 |
|
--- a/pppd/tty.c |
|
+++ b/pppd/tty.c |
|
@@ -896,7 +896,7 @@ open_socket(dest) |
|
*sep = ':'; |
|
|
|
/* get a socket and connect it to the other end */ |
|
- sock = socket(PF_INET, SOCK_STREAM, 0); |
|
+ sock = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); |
|
if (sock < 0) { |
|
error("Can't create socket: %m"); |
|
return -1; |
|
-- |
|
1.8.3.1 |
|
|
|
|