Update to FreeBSD head 2016-08-23

Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
This commit is contained in:
Sebastian Huber
2016-10-07 15:10:20 +02:00
parent 8c0eebac7d
commit c40e45b75e
1040 changed files with 156866 additions and 67039 deletions

View File

@@ -1,5 +1,9 @@
#include <machine/rtems-bsd-user-space.h>
#ifdef __rtems__
#include "rtems-bsd-ifconfig-namespace.h"
#endif /* __rtems__ */
/*-
* Copyright (c) 2008 Andrew Thompson. All rights reserved.
*
@@ -25,61 +29,92 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef lint
static const char rcsid[] =
"$FreeBSD$";
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#ifdef __rtems__
#include <machine/rtems-bsd-program.h>
#endif /* __rtems__ */
#include <rtems/bsd/sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <stdlib.h>
#include <unistd.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_gre.h>
#include <net/route.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <err.h>
#include <errno.h>
#include "ifconfig.h"
#ifdef __rtems__
#include "rtems-bsd-ifconfig-ifgre-data.h"
#endif /* __rtems__ */
#define GREBITS "\020\01ENABLE_CSUM\02ENABLE_SEQ"
static void gre_status(int s);
static void
gre_status(int s)
{
int grekey = 0;
uint32_t opts = 0;
ifr.ifr_data = (caddr_t)&grekey;
ifr.ifr_data = (caddr_t)&opts;
if (ioctl(s, GREGKEY, &ifr) == 0)
if (grekey != 0)
printf("\tgrekey: %d\n", grekey);
if (opts != 0)
printf("\tgrekey: 0x%x (%u)\n", opts, opts);
opts = 0;
if (ioctl(s, GREGOPTS, &ifr) != 0 || opts == 0)
return;
printb("\toptions", opts, GREBITS);
putchar('\n');
}
static void
setifgrekey(const char *val, int dummy __unused, int s,
const struct afswtch *afp)
{
uint32_t grekey = atol(val);
uint32_t grekey = strtol(val, NULL, 0);
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
strlcpy(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
setifgreopts(const char *val, int d, int s, const struct afswtch *afp)
{
uint32_t opts;
ifr.ifr_data = (caddr_t)&opts;
if (ioctl(s, GREGOPTS, &ifr) == -1) {
warn("ioctl(GREGOPTS)");
return;
}
if (d < 0)
opts &= ~(-d);
else
opts |= d;
if (ioctl(s, GRESOPTS, &ifr) == -1) {
warn("ioctl(GIFSOPTS)");
return;
}
}
static struct cmd gre_cmds[] = {
DEF_CMD_ARG("grekey", setifgrekey),
DEF_CMD("enable_csum", GRE_ENABLE_CSUM, setifgreopts),
DEF_CMD("-enable_csum",-GRE_ENABLE_CSUM,setifgreopts),
DEF_CMD("enable_seq", GRE_ENABLE_SEQ, setifgreopts),
DEF_CMD("-enable_seq",-GRE_ENABLE_SEQ, setifgreopts),
};
static struct afswtch af_gre = {
.af_name = "af_gre",
@@ -94,11 +129,9 @@ void
#endif /* __rtems__ */
gre_ctor(void)
{
#define N(a) (sizeof(a) / sizeof(a[0]))
size_t i;
for (i = 0; i < N(gre_cmds); i++)
for (i = 0; i < nitems(gre_cmds); i++)
cmd_register(&gre_cmds[i]);
af_register(&af_gre);
#undef N
}