summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifconfig.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2008-06-20 17:26:34 +0000
committerthompsa <thompsa@FreeBSD.org>2008-06-20 17:26:34 +0000
commit0c235e44e0fb17bd33556dadd61d7697ab1920d5 (patch)
treea90b65055cf5a78462a29c060cc9bd280ab22b9d /sbin/ifconfig/ifconfig.c
parentbf94b8a5bffc3904edd54af89110562e9fe1a2dc (diff)
downloadFreeBSD-src-0c235e44e0fb17bd33556dadd61d7697ab1920d5.zip
FreeBSD-src-0c235e44e0fb17bd33556dadd61d7697ab1920d5.tar.gz
Add support for the optional key in the GRE header.
PR: kern/114714 Submitted by: Cristian KLEIN
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r--sbin/ifconfig/ifconfig.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 4819679..6f0dd0e 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -51,6 +51,7 @@ static const char rcsid[] =
#include <net/ethernet.h>
#include <net/if.h>
+#include <net/if_gre.h>
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/if_types.h>
@@ -749,6 +750,18 @@ setifmtu(const char *val, int dummy __unused, int s,
}
static void
+setifgrekey(const char *val, int dummy __unused, int s,
+ const struct afswtch *afp)
+{
+ uint32_t grekey = atol(val);
+
+ strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
+ ifr.ifr_data = (caddr_t)&grekey;
+ if (ioctl(s, GRESKEY, (caddr_t)&ifr) < 0)
+ warn("ioctl (set grekey)");
+}
+
+static void
setifname(const char *val, int dummy __unused, int s,
const struct afswtch *afp)
{
@@ -863,6 +876,12 @@ status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0)
printf("%s", ifs.ascii);
+ int grekey = 0;
+ ifr.ifr_data = (caddr_t)&grekey;
+ if (ioctl(s, GREGKEY, &ifr) == 0)
+ if (grekey != 0)
+ printf("\tgrekey: %d\n", grekey);
+
close(s);
return;
}
@@ -1034,6 +1053,7 @@ static struct cmd basic_cmds[] = {
DEF_CMD("noicmp", IFF_LINK1, setifflags),
DEF_CMD_ARG("mtu", setifmtu),
DEF_CMD_ARG("name", setifname),
+ DEF_CMD_ARG("grekey", setifgrekey),
};
static __constructor void
OpenPOWER on IntegriCloud