Make this work on SunOS.

This commit is contained in:
hans 2011-04-14 21:42:42 +00:00
parent 3734197534
commit f1b700b4f2
4 changed files with 91 additions and 10 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.26 2011/03/05 17:46:41 cegger Exp $
# $NetBSD: Makefile,v 1.27 2011/04/14 21:42:42 hans Exp $
#
DISTNAME= vpnc-0.5.3
@ -60,5 +60,13 @@ do-install:
.include "options.mk"
.include "../../mk/bsd.prefs.mk"
CFLAGS.SunOS= -DLOG_PERROR=0
.if ${OPSYS} == "SunOS"
.include "../../net/solaris-tap/buildlink3.mk"
.endif
.include "../../security/libgcrypt/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,11 +1,11 @@
$NetBSD: distinfo,v 1.15 2011/04/14 21:27:39 hans Exp $
$NetBSD: distinfo,v 1.16 2011/04/14 21:42:42 hans Exp $
SHA1 (vpnc-0.5.3.tar.gz) = 321527194e937371c83b5e7c38e46fca4f109304
RMD160 (vpnc-0.5.3.tar.gz) = 6f3926901e75dc98762f6ef45782930f2fb76a2f
Size (vpnc-0.5.3.tar.gz) = 98740 bytes
SHA1 (patch-aa) = d1ebdb0cc695001f0d5d7a88db332e0e5cc5c3b9
SHA1 (patch-ab) = 14aa011b36fcf1da54d506fd5398cfc55cb11748
SHA1 (patch-ac) = 75054f68e601f8883870f5bfa174c836bb1a9516
SHA1 (patch-ac) = 91f3614d52c81a8eff5cc189aeeeb19ba611b4eb
SHA1 (patch-ad) = 7e31f1804541eb4de9924edcc517304487aad0f2
SHA1 (patch-ae) = ae3e4be379965911dec27b6bb407ae1af017d88e
SHA1 (patch-af) = d41aaab81061db058c4b38013f07815e1e8cf506
@ -14,3 +14,4 @@ SHA1 (patch-ah) = 8180c569137f5d6de89b1a495dcba91dc374e2c2
SHA1 (patch-ba) = 7cd58afdf4888ed9868644b071052ae9abcc5bfb
SHA1 (patch-bb) = 015e3a6c3d0ec68a75694a03334d8116b381c46a
SHA1 (patch-bc) = dd4817bfd05838cb863c8810e6b2c0194de3a3bf
SHA1 (patch-bd) = 67f415224fadeddb1e3bb597eaa38696a15fe400

View file

@ -1,8 +1,8 @@
$NetBSD: patch-ac,v 1.9 2011/04/14 21:27:39 hans Exp $
$NetBSD: patch-ac,v 1.10 2011/04/14 21:42:42 hans Exp $
--- vpnc-script.in.orig 2009-02-04 14:40:43.000000000 +0100
+++ vpnc-script.in
@@ -48,18 +48,19 @@ PATH=/sbin:/usr/sbin:$PATH
--- vpnc-script.in.orig 2008-11-19 21:55:51.000000000 +0100
+++ vpnc-script.in 2011-04-14 23:33:24.877879829 +0200
@@ -48,29 +48,36 @@ PATH=/sbin:/usr/sbin:$PATH
OS="`uname -s`"
@ -27,7 +27,24 @@ $NetBSD: patch-ac,v 1.9 2011/04/14 21:27:39 hans Exp $
if [ "$OS" = "Linux" ]; then
ifconfig_syntax_ptp="pointopoint"
@@ -94,7 +94,7 @@ do_ifconfig() {
route_syntax_gw="gw"
route_syntax_del="del"
route_syntax_netmask="netmask"
+ route_syntax_iface=""
else
ifconfig_syntax_ptp=""
route_syntax_gw=""
route_syntax_del="delete"
route_syntax_netmask="-netmask"
+ if [ "$OS" = "SunOS" ]; then
+ route_syntax_iface="-interface"
+ else
+ route_syntax_iface=""
+ fi
fi
if [ -x /sbin/resolvconf ]; then # Optional tool on Debian, Ubuntu, Gentoo
@@ -93,7 +100,7 @@ do_ifconfig() {
DEV=$($IPROUTE route | grep ^default | sed 's/^.* dev \([[:alnum:]-]\+\).*$/\1/')
MTU=$(($($IPROUTE link show "$DEV" | grep mtu | sed 's/^.* mtu \([[:digit:]]\+\).*$/\1/') - 88))
else
@ -36,7 +53,7 @@ $NetBSD: patch-ac,v 1.9 2011/04/14 21:27:39 hans Exp $
fi
# Point to point interface require a netmask of 255.255.255.255 on some systems
@@ -163,7 +164,7 @@ else # use route command
@@ -163,11 +170,11 @@ else # use route command
# isn't -n supposed to give --numeric output?
# apperently not...
# Get rid of lines containing IPv6 addresses (':')
@ -45,7 +62,30 @@ $NetBSD: patch-ac,v 1.9 2011/04/14 21:27:39 hans Exp $
}
set_vpngateway_route() {
@@ -440,6 +440,20 @@ do_pre_init() {
- route add -host "$VPNGATEWAY" $route_syntax_gw "`get_default_gw`"
+ route add -host "$VPNGATEWAY" $route_syntax_gw "`get_default_gw`" $route_syntax_iface
}
del_vpngateway_route() {
@@ -178,7 +185,7 @@ else # use route command
DEFAULTGW="`get_default_gw`"
echo "$DEFAULTGW" > "$DEFAULT_ROUTE_FILE"
route $route_syntax_del default
- route add default $route_syntax_gw "$INTERNAL_IP4_ADDRESS"
+ route add default $route_syntax_gw "$INTERNAL_IP4_ADDRESS" $route_syntax_iface
}
set_network_route() {
@@ -186,7 +193,7 @@ else # use route command
NETMASK="$2"
NETMASKLEN="$3"
del_network_route "$NETWORK" "$NETMASK" "$NETMASKLEN"
- route add -net "$NETWORK" $route_syntax_netmask "$NETMASK" $route_syntax_gw "$INTERNAL_IP4_ADDRESS"
+ route add -net "$NETWORK" $route_syntax_netmask "$NETMASK" $route_syntax_gw "$INTERNAL_IP4_ADDRESS" $route_syntax_iface
}
reset_default_route() {
@@ -439,6 +446,20 @@ do_pre_init() {
}
do_connect() {

32
net/vpnc/patches/patch-bd Normal file
View file

@ -0,0 +1,32 @@
--- sysdep.c.orig 2008-11-19 21:36:12.000000000 +0100
+++ sysdep.c 2010-01-07 23:30:57.937261239 +0100
@@ -666,7 +666,7 @@ int tun_get_hwaddr(int fd, char *dev, ui
}
return 0;
-#elif defined(SIOCGIFHWADDR)
+#elif defined(SIOCGIFHWADDR) || defined(SIOCGENADDR)
struct ifreq ifr;
/* Use a new socket fd! */
@@ -677,11 +677,20 @@ int tun_get_hwaddr(int fd, char *dev, ui
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+#if defined(SIOCGIFHWADDR) && !defined(__sun)
if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
return -1;
}
memcpy(hwaddr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN);
+#endif
+#if defined(SIOCGENADDR)
+ if (ioctl(fd, SIOCGENADDR, &ifr) < 0) {
+ return -1;
+ }
+
+ memcpy(hwaddr, &ifr.ifr_enaddr, ETH_ALEN);
+#endif
return 0;
#else