summaryrefslogtreecommitdiff
path: root/src/dumm/iface.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:42:46 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:42:46 +0000
commitde6b12502cdf42d5d92118f1c0e38dc31becf7c5 (patch)
tree0edac9c79f5a43e01913dd7f71c7abc487e5727b /src/dumm/iface.c
parent172642669d4a23e17f1ed411fbc8629dcaa5fb46 (diff)
downloadvyos-strongswan-de6b12502cdf42d5d92118f1c0e38dc31becf7c5.tar.gz
vyos-strongswan-de6b12502cdf42d5d92118f1c0e38dc31becf7c5.zip
Updated to new upstream release. interfaces Patch is not from upstream.
Diffstat (limited to 'src/dumm/iface.c')
-rw-r--r--src/dumm/iface.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dumm/iface.c b/src/dumm/iface.c
index bf73c82a5..9910c392e 100644
--- a/src/dumm/iface.c
+++ b/src/dumm/iface.c
@@ -55,10 +55,10 @@ bool iface_control(char *name, bool up)
int s;
bool good = FALSE;
struct ifreq ifr;
-
+
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
-
+
s = socket(AF_INET, SOCK_DGRAM, 0);
if (!s)
{
@@ -104,7 +104,7 @@ static char* get_hostif(private_iface_t *this)
*/
static bool add_address(private_iface_t *this, host_t *addr)
{
- return (this->guest->exec(this->guest, NULL, NULL,
+ return (this->guest->exec(this->guest, NULL, NULL,
"exec ip addr add %H dev %s", addr, this->guestif) == 0);
}
@@ -185,7 +185,7 @@ static guest_t* get_guest(private_iface_t *this)
{
return this->guest;
}
-
+
/**
* destroy the tap device
*/
@@ -193,7 +193,7 @@ static bool destroy_tap(private_iface_t *this)
{
struct ifreq ifr;
int tap;
-
+
if (!iface_control(this->hostif, FALSE))
{
DBG1("bringing iface down failed: %m");
@@ -201,7 +201,7 @@ static bool destroy_tap(private_iface_t *this)
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
strncpy(ifr.ifr_name, this->hostif, sizeof(ifr.ifr_name) - 1);
-
+
tap = open(TAP_DEVICE, O_RDWR);
if (tap < 0)
{
@@ -241,11 +241,11 @@ static char* create_tap(private_iface_t *this)
if (ioctl(tap, TUNSETIFF, &ifr) < 0 ||
ioctl(tap, TUNSETPERSIST, 1) < 0 ||
ioctl(tap, TUNSETOWNER, 0))
- {
+ {
DBG1("creating new tap device failed: %m");
close(tap);
return NULL;
- }
+ }
close(tap);
return strdup(ifr.ifr_name);
}
@@ -274,7 +274,7 @@ static void destroy(private_iface_t *this)
iface_t *iface_create(char *name, guest_t *guest, mconsole_t *mconsole)
{
private_iface_t *this = malloc_thing(private_iface_t);
-
+
this->public.get_hostif = (char*(*)(iface_t*))get_hostif;
this->public.get_guestif = (char*(*)(iface_t*))get_guestif;
this->public.add_address = (bool(*)(iface_t*, host_t *addr))add_address;