|
Line 0
Link Here
|
|
|
1 |
# This patch by Stefan Bethke fixes FreeBSD 8 compatibility |
| 2 |
# in topology subnet mode, # and makes sure that the tun interface is |
| 3 |
# correctly configured. Contact: stb at lassitu dot de |
| 4 |
|
| 5 |
--- /home/stb/tun.c.orig 2009-08-05 14:25:55.204943408 +0200 |
| 6 |
+++ tun.c 2009-08-05 17:57:51.886753309 +0200 |
| 7 |
@@ -863,11 +863,10 @@ |
| 8 |
else { |
| 9 |
if (tt->topology == TOP_SUBNET) |
| 10 |
argv_printf (&argv, |
| 11 |
- "%s %s %s %s netmask %s mtu %d up", |
| 12 |
+ "%s %s %s netmask %s mtu %d up", |
| 13 |
IFCONFIG_PATH, |
| 14 |
actual, |
| 15 |
ifconfig_local, |
| 16 |
- ifconfig_local, |
| 17 |
ifconfig_remote_netmask, |
| 18 |
tun_mtu |
| 19 |
); |
| 20 |
@@ -1745,14 +1744,19 @@ |
| 21 |
{ |
| 22 |
open_tun_generic (dev, dev_type, dev_node, ipv6, true, true, tt); |
| 23 |
|
| 24 |
- if (tt->fd >= 0) |
| 25 |
+ if (tt->fd >= 0 && tt->type == DEV_TYPE_TUN) |
| 26 |
{ |
| 27 |
int i = 0; |
| 28 |
|
| 29 |
- /* Disable extended modes */ |
| 30 |
- ioctl (tt->fd, TUNSLMODE, &i); |
| 31 |
+ i = tt->topology == TOP_SUBNET ? IFF_BROADCAST : IFF_POINTOPOINT; |
| 32 |
+ i |= IFF_MULTICAST; |
| 33 |
+ if (ioctl (tt->fd, TUNSIFMODE, &i) < 0) { |
| 34 |
+ msg (M_WARN | M_ERRNO, "ioctl(TUNSIFMODE): %s", strerror(errno)); |
| 35 |
+ } |
| 36 |
i = 1; |
| 37 |
- ioctl (tt->fd, TUNSIFHEAD, &i); |
| 38 |
+ if (ioctl (tt->fd, TUNSIFHEAD, &i) < 0) { |
| 39 |
+ msg (M_WARN | M_ERRNO, "ioctl(TUNSIFHEAD): %s", strerror(errno)); |
| 40 |
+ } |
| 41 |
} |
| 42 |
} |
| 43 |
|