diff mbox

[v2] tap-bsd: OpenBSD uses tap(4) now

Message ID 20161007012832.nfv2ctxri3z76pnp@humpty.home.comstyle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brad Smith Oct. 7, 2016, 1:28 a.m. UTC
Update the tap-bsd code now that OpenBSD uses tap(4).

Signed-off-by: Brad Smith <brad@comstyle.com>
---
v2: Allow the code to deal with newer vs older OpenBSD releases

Comments

Brad Smith Oct. 15, 2016, 9:44 p.m. UTC | #1
On 10/06/16 21:28, Brad Smith wrote:
> Update the tap-bsd code now that OpenBSD uses tap(4).
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> v2: Allow the code to deal with newer vs older OpenBSD releases

ping.

> diff --git a/net/tap-bsd.c b/net/tap-bsd.c
> index c506ac3..6c96922 100644
> --- a/net/tap-bsd.c
> +++ b/net/tap-bsd.c
> @@ -35,6 +35,10 @@
>  #include <net/if_tap.h>
>  #endif
>
> +#if defined(__OpenBSD__)
> +#include <sys/param.h>
> +#endif
> +
>  #ifndef __FreeBSD__
>  int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
>               int vnet_hdr_required, int mq_required, Error **errp)
> @@ -55,7 +59,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
>          if (*ifname) {
>              snprintf(dname, sizeof dname, "/dev/%s", ifname);
>          } else {
> -#if defined(__OpenBSD__)
> +#if defined(__OpenBSD__) && OpenBSD < 201605
>              snprintf(dname, sizeof dname, "/dev/tun%d", i);
>  #else
>              snprintf(dname, sizeof dname, "/dev/tap%d", i);
>
Jason Wang Oct. 20, 2016, 2:28 a.m. UTC | #2
On 2016年10月07日 09:28, Brad Smith wrote:
> Update the tap-bsd code now that OpenBSD uses tap(4).
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> v2: Allow the code to deal with newer vs older OpenBSD releases
>
> diff --git a/net/tap-bsd.c b/net/tap-bsd.c
> index c506ac3..6c96922 100644
> --- a/net/tap-bsd.c
> +++ b/net/tap-bsd.c
> @@ -35,6 +35,10 @@
>   #include <net/if_tap.h>
>   #endif
>   
> +#if defined(__OpenBSD__)
> +#include <sys/param.h>
> +#endif
> +
>   #ifndef __FreeBSD__
>   int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
>                int vnet_hdr_required, int mq_required, Error **errp)
> @@ -55,7 +59,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
>           if (*ifname) {
>               snprintf(dname, sizeof dname, "/dev/%s", ifname);
>           } else {
> -#if defined(__OpenBSD__)
> +#if defined(__OpenBSD__) && OpenBSD < 201605
>               snprintf(dname, sizeof dname, "/dev/tun%d", i);
>   #else
>               snprintf(dname, sizeof dname, "/dev/tap%d", i);

Applied, thanks.
diff mbox

Patch

diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index c506ac3..6c96922 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -35,6 +35,10 @@ 
 #include <net/if_tap.h>
 #endif
 
+#if defined(__OpenBSD__)
+#include <sys/param.h>
+#endif
+
 #ifndef __FreeBSD__
 int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
              int vnet_hdr_required, int mq_required, Error **errp)
@@ -55,7 +59,7 @@  int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
         if (*ifname) {
             snprintf(dname, sizeof dname, "/dev/%s", ifname);
         } else {
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) && OpenBSD < 201605
             snprintf(dname, sizeof dname, "/dev/tun%d", i);
 #else
             snprintf(dname, sizeof dname, "/dev/tap%d", i);