virtualsquare / virtualsquare/vde-2
Support for NetBSD
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 255
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
Some of these are already in #70.
Add NetBSD.
https://github.com/virtualsquare/vde-2/issues/70
--- CMakeLists.txt.orig 2026-08-03 10:48:09.000000000 +0000
+++ CMakeLists.txt
@@ -30,6 +30,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin
cm_define_var(VDE_DARWIN 1)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
cm_define_var(VDE_FREEBSD 1)
+elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ cm_define_var(VDE_NETBSD 1)
else()
message(FATAL_ERROR "Unsupported OS: ${CMAKE_SYSTEM_NAME}")
endif()
@@ -250,9 +252,9 @@ if(ENABLE_TUNTAP)
set(ENABLE_TUNTAP OFF)
endif()
- elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|NetBSD")
include(CheckIncludeFile)
- cm_check_include("net/if_tun.h" HAVE_NET_IF_TUN_H)
+ cm_check_include("net/if.h;net/if_tun.h" HAVE_NET_IF_TUN_H)
if(HAVE_NET_IF_TUN_H)
add_definitions(-DHAVE_TUNTAP=1)
else()
from https://github.com/virtualsquare/vde-2/issues/70
--- Macros.cmake.orig 2026-08-03 10:48:09.000000000 +0000
+++ Macros.cmake
@@ -1,4 +1,4 @@
-include(CheckIncludeFile)
+include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckTypeSize)
@@ -30,7 +30,7 @@ macro(cm_check_lib libname)
endmacro()
macro(cm_check_include include var)
- check_include_file(${include} ${var})
+ check_include_files("${include}" ${var})
if(${var})
set(defines ${defines} "#cmakedefine ${var}\n\n")
else()
@@ -73,4 +73,4 @@ macro(cm_configure_file to_file)
file(WRITE ${default_conf_file} ${defines})
configure_file(${default_conf_file} ${to_file})
file(REMOVE ${default_conf_file}) # uncomment if you want to check the template
-endmacro()
\ No newline at end of file
+endmacro()
setpgrp() without args is System V-style.
--- src/dpipe.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/dpipe.c
@@ -201,7 +201,11 @@ int main(int argc, char *argv[])
if (daemonize != 0)
daemon(0,0);
+#if VDE_NETBSD
+ else if (setpgid(0, 0) == -1) {
+#else
else if (setpgrp() == -1) {
+#endif
fprintf(stderr,"Err: cannot create pgrp\n");
perror("setpgrp");
exit(1);
Fix bad ctype calls.
--- src/lib/libvdehist.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/lib/libvdehist.c
@@ -297,16 +297,16 @@ void vdehist_mgmt_to_term(struct vdehist
char *message=st->vlinebuf;
//fprintf(stderr,"MSG1 \"%s\"\n",message);
while (*message != '\0' &&
- !(isdigit(message[0]) &&
- isdigit(message[1]) &&
- isdigit(message[2]) &&
- isdigit(message[3])))
+ !(isdigit((unsigned char)message[0]) &&
+ isdigit((unsigned char)message[1]) &&
+ isdigit((unsigned char)message[2]) &&
+ isdigit((unsigned char)message[3])))
message++;
if (strncmp(message,"0000",4)==0)
st->vindata=1;
- else if (isdigit(message[1]) &&
- isdigit(message[2]) &&
- isdigit(message[3])) {
+ else if (isdigit((unsigned char)message[1]) &&
+ isdigit((unsigned char)message[2]) &&
+ isdigit((unsigned char)message[3])) {
if(message[0]=='1') {
message+=5;
vdehist_termwrite(st->termfd,message,strlen(message));
from https://github.com/virtualsquare/vde-2/issues/70
--- src/vde_pcapplug.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_pcapplug.c
@@ -32,7 +32,6 @@
#include <libgen.h>
#define _GNU_SOURCE
#include <getopt.h>
-#include <pcap.h>
#include <limits.h>
#include <config.h>
@@ -40,11 +39,14 @@
#include <vdecommon.h>
#include <libvdeplug.h>
-#ifdef VDE_FREEBSD
+#if defined(VDE_FREEBSD) || defined(VDE_NETBSD)
+#include <net/bpf.h>
#include <sys/socket.h>
#endif
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#include <pcap.h>
+
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
# if defined HAVE_SYSLIMITS_H
# include <syslimits.h>
# elif defined HAVE_SYS_SYSLIMITS_H
Fix bad ctype calls.
--- src/vde_plug.c.orig 2026-08-08 13:52:08.513903724 +0000
+++ src/vde_plug.c
@@ -64,7 +64,7 @@ void write_syslog_entry(char *message)
//TNX Giordani-Macchia code from vish.c
if ((ssh_client=getenv("SSH_CLIENT"))!=NULL)
{
- for (ip_length=0;ip_length<sizeof(host)&&ssh_client[ip_length]!=0&&!isspace(ssh_client[ip_length]);ip_length++);
+ for (ip_length=0;ip_length<sizeof(host)&&ssh_client[ip_length]!=0&&!isspace((unsigned char)ssh_client[ip_length]);ip_length++);
if (ip_length>=sizeof(host))
ip_length=sizeof(host)-1;
memcpy(host,ssh_client,ip_length);
Add NetBSD.
--- src/vde_plug2tap.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_plug2tap.c
@@ -34,13 +34,13 @@
#include <linux/if_tun.h>
#endif
-#ifdef VDE_FREEBSD
+#if defined(VDE_FREEBSD) || defined(VDE_NETNSD)
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_tun.h>
#endif
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
# define TAP_PREFIX "/dev/"
# if defined HAVE_SYSLIMITS_H
# include <syslimits.h>
@@ -195,7 +195,7 @@ int open_tap(char *dev)
}
#endif
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
int open_tap(char *dev)
{
int fd;
Add NetBSD.
--- src/vde_router/vde_headers.h.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_router/vde_headers.h
@@ -22,7 +22,7 @@
#define PROTO_TCP 6
#define PROTO_UDP 17
-#if defined(VDE_FREEBSD) || defined(VDE_DARWIN)
+#if defined(VDE_FREEBSD) || defined(VDE_DARWIN) || defined(VDE_NETBSD)
struct iphdr
{
#if BYTE_ORDER == LITTLE_ENDIAN
Use proper name of icmp message.
--- src/vde_router/vder_icmp.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_router/vder_icmp.c
@@ -59,6 +59,10 @@ int vder_icmp_ttl_expired(uint32_t dst,
return vder_icmp_send(dst, ICMP_TIME_EXCEEDED, ICMP_TIMXCEED_INTRANS, foot);
}
+#ifndef ICMP_UNREACH_FILTER_PROHIB
+#define ICMP_UNREACH_FILTER_PROHIB ICMP_UNREACH_ADMIN_PROHIBIT
+#endif
+
int vder_icmp_filter(uint32_t dst, uint8_t *foot)
{
return vder_icmp_send(dst, ICMP_UNREACH, ICMP_UNREACH_FILTER_PROHIB, foot);
Forward declare struct so its scope isn't limited to the func declaration.
--- src/vde_router/vder_packet.h.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_router/vder_packet.h
@@ -6,6 +6,8 @@
#ifndef _VDER_PACKET
#define _VDER_PACKET
+struct iphdr;
+
#define DEFAULT_TTL 64
uint16_t vder_ip_checksum(struct iphdr *iph);
void vder_packet_recv(struct vder_iface *vif, int timeout);
Add NetBSD.
--- src/vde_switch/datasock.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_switch/datasock.c
@@ -90,7 +90,7 @@ static int send_datasock(int fd_ctl, int
{
while (send(fd_data, packet, len, 0) < 0) {
int rv=errno;
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
if(rv == ENOBUFS) {
sched_yield();
continue;
Fix bad ctype calls.
--- src/vde_switch/port.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_switch/port.c
@@ -843,7 +843,7 @@ static int portsetuser(char *arg)
return ENXIO;
if ((pw=getpwnam(portuid)) != NULL)
portv[port]->user=pw->pw_uid;
- else if (isdigit(*portuid))
+ else if (isdigit((unsigned char)*portuid))
portv[port]->user=atoi(portuid);
else if (strcmp(portuid,"NONE")==0 || strcmp(portuid,"ANY")==0)
portv[port]->user= -1;
@@ -868,7 +868,7 @@ static int portsetgroup(char *arg)
return ENXIO;
if ((gr=getgrnam(portgid)) != NULL)
portv[port]->group=gr->gr_gid;
- else if (isdigit(*portgid))
+ else if (isdigit((unsigned char)*portgid))
portv[port]->group=atoi(portgid);
else if (strcmp(portgid,"NONE")==0 || strcmp(portgid,"ANY")==0)
portv[port]->group= -1;
Add NetBSD.
--- src/vde_switch/tuntap.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_switch/tuntap.c
@@ -34,7 +34,7 @@
#include <linux/if_tun.h>
#endif
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
#define TAP_PREFIX "/dev/"
#endif
@@ -202,7 +202,7 @@ int open_tap(char *dev)
}
#endif
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
int open_tap(char *dev)
{
int fd;
Required header.
--- src/vde_vxlan/vxlan.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/vde_vxlan/vxlan.c
@@ -24,6 +24,7 @@
#include <netinet/in.h>
#include <sys/un.h>
+#include <sys/socket.h>
#include "vxlan_hash.h"
#include "log.h"
Add NetBSD.
--- src/wirefilter.c.orig 2026-08-03 10:48:09.000000000 +0000
+++ src/wirefilter.c
@@ -39,7 +39,7 @@
#include <vdecommon.h>
#include <libvdeplug.h>
-#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
+#if defined(VDE_DARWIN) || defined(VDE_FREEBSD) || defined(VDE_NETBSD)
# if defined HAVE_SYSLIMITS_H
# include <syslimits.h>
# elif defined HAVE_SYS_SYSLIMITS_H
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with CMakeLists.txt and Macros.cmake to understand how platform defines and header checks are generated. Review the listed NetBSD changes across src/dpipe.c, tap, router, switch, VXLAN, and wirefilter files, then configure and build on NetBSD. Done means the project recognizes NetBSD and the affected components compile with the required interfaces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake
- Domain
- build-system, networking, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100