OpenBSD only has identical /dev/bpf and /dev/bpf0, nothing in base uses
bpf0 anymore and bpf(4) is clonable, meaning you can open it up to
1024(?) times.

This should eventually allow us to remove bpf0.

Use strlcpy(3) now that the format string is constant.

Builds fine.
OK?


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/dnsmasq/Makefile,v
retrieving revision 1.62
diff -u -p -r1.62 Makefile
--- Makefile    24 Apr 2022 19:16:29 -0000      1.62
+++ Makefile    23 Aug 2022 15:18:41 -0000
@@ -1,7 +1,7 @@
 COMMENT=       lightweight caching DNS forwarder, DHCP and TFTP server
 
 DISTNAME=      dnsmasq-2.86
-REVISION=      0
+REVISION=      1
 CATEGORIES=    net
 MASTER_SITES=  https://www.thekelleys.org.uk/dnsmasq/
 EXTRACT_SUFX=  .tar.xz
Index: patches/patch-src_bpf_c
===================================================================
RCS file: patches/patch-src_bpf_c
diff -N patches/patch-src_bpf_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_bpf_c     23 Aug 2022 15:55:00 -0000
@@ -0,0 +1,23 @@
+Index: src/bpf.c
+--- src/bpf.c.orig
++++ src/bpf.c
+@@ -249,17 +249,9 @@ int iface_enumerate(int family, void *parm, int (*call
+ 
+ void init_bpf(void)
+ {
+-  int i = 0;
+-
+-  while (1) 
+-    {
+-      sprintf(daemon->dhcp_buff, "/dev/bpf%d", i++);
+-      if ((daemon->dhcp_raw_fd = open(daemon->dhcp_buff, O_RDWR, 0)) != -1)
++  strlcpy(daemon->dhcp_buff, "/dev/bpf", sizeof(daemon->dhcp_buff));
++  if ((daemon->dhcp_raw_fd = open(daemon->dhcp_buff, O_RDWR, 0)) != -1)
+       return;
+-
+-      if (errno != EBUSY)
+-      die(_("cannot create DHCP BPF socket: %s"), NULL, EC_BADNET);
+-    }      
+ }
+ 
+ void send_via_bpf(struct dhcp_packet *mess, size_t len,

Reply via email to