aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/profile-m-z/youtube-viewers-common.profile2
-rw-r--r--src/firejail/arp.c14
2 files changed, 11 insertions, 5 deletions
diff --git a/etc/profile-m-z/youtube-viewers-common.profile b/etc/profile-m-z/youtube-viewers-common.profile
index a6d8c164f..a05f05c51 100644
--- a/etc/profile-m-z/youtube-viewers-common.profile
+++ b/etc/profile-m-z/youtube-viewers-common.profile
@@ -50,7 +50,7 @@ shell none
50tracelog 50tracelog
51 51
52disable-mnt 52disable-mnt
53private-bin bash,ffmpeg,ffprobe,firefox,mpv,perl,python*,sh,smplayer,stty,wget,which,xterm,youtube-dl 53private-bin bash,ffmpeg,ffprobe,firefox,mpv,perl,python*,sh,smplayer,stty,wget,which,xterm,youtube-dl,yt-dlp
54private-cache 54private-cache
55private-dev 55private-dev
56private-etc alsa,alternatives,asound.conf,ca-certificates,crypto-policies,fonts,gtk-2.0,gtk-3.0,host.conf,hostname,hosts,machine-id,mime.types,nsswitch.conf,passwd,pki,pulse,resolv.conf,ssl,X11,xdg 56private-etc alsa,alternatives,asound.conf,ca-certificates,crypto-policies,fonts,gtk-2.0,gtk-3.0,host.conf,hostname,hosts,machine-id,mime.types,nsswitch.conf,passwd,pki,pulse,resolv.conf,ssl,X11,xdg
diff --git a/src/firejail/arp.c b/src/firejail/arp.c
index bbab9a6d9..c259fc0ad 100644
--- a/src/firejail/arp.c
+++ b/src/firejail/arp.c
@@ -20,6 +20,7 @@
20#include "firejail.h" 20#include "firejail.h"
21#include <sys/socket.h> 21#include <sys/socket.h>
22#include <sys/ioctl.h> 22#include <sys/ioctl.h>
23#include <sys/time.h>
23#include <linux/if_ether.h> //TCP/IP Protocol Suite for Linux 24#include <linux/if_ether.h> //TCP/IP Protocol Suite for Linux
24#include <net/if.h> 25#include <net/if.h>
25#include <netinet/in.h> 26#include <netinet/in.h>
@@ -188,9 +189,14 @@ int arp_check(const char *dev, uint32_t destaddr) {
188 FD_SET(sock, &fds); 189 FD_SET(sock, &fds);
189 int maxfd = sock; 190 int maxfd = sock;
190 struct timeval ts; 191 struct timeval ts;
191 ts.tv_sec = 0; // 0.5 seconds wait time 192 gettimeofday(&ts, NULL);
192 ts.tv_usec = 500000; 193 double timerend = ts.tv_sec + ts.tv_usec / 1000000.0 + 0.5;
193 while (1) { 194 while (1) {
195 gettimeofday(&ts, NULL);
196 double now = ts.tv_sec + ts.tv_usec / 1000000.0;
197 double timeout = timerend - now;
198 ts.tv_sec = timeout;
199 ts.tv_usec = (timeout - ts.tv_sec) * 1000000;
194 int nready = select(maxfd + 1, &fds, (fd_set *) 0, (fd_set *) 0, &ts); 200 int nready = select(maxfd + 1, &fds, (fd_set *) 0, (fd_set *) 0, &ts);
195 if (nready < 0) 201 if (nready < 0)
196 errExit("select"); 202 errExit("select");
@@ -201,8 +207,8 @@ int arp_check(const char *dev, uint32_t destaddr) {
201 } 207 }
202 if (sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr)) <= 0) 208 if (sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr)) <= 0)
203 errExit("send"); 209 errExit("send");
204 ts.tv_sec = 0; // 0.5 seconds wait time 210 gettimeofday(&ts, NULL);
205 ts.tv_usec = 500000; 211 timerend = ts.tv_sec + ts.tv_usec / 1000000.0 + 0.5;
206 fflush(0); 212 fflush(0);
207 } 213 }
208 else { 214 else {