svn commit: r273363 - in projects/bhyve_svm: . bin/sh bin/sh/tests/parser cddl/lib/libdtrace contrib/openpam/lib/libpam etc etc/rc.d lib/libkvm sbin/ifconfig sbin/ipfw sbin/ping sbin/ping6 share/ma...
Neel Natu
neel at FreeBSD.org
Tue Oct 21 01:57:43 UTC 2014
Author: neel
Date: Tue Oct 21 01:57:36 2014
New Revision: 273363
URL: https://svnweb.freebsd.org/changeset/base/273363
Log:
IFC @r273338
Added:
projects/bhyve_svm/bin/sh/tests/parser/line-cont1.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont1.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont10.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont10.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont11.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont11.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont2.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont2.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont3.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont3.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont4.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont4.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont5.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont5.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont6.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont6.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont7.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont7.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont8.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont8.0
projects/bhyve_svm/bin/sh/tests/parser/line-cont9.0
- copied unchanged from r273338, head/bin/sh/tests/parser/line-cont9.0
projects/bhyve_svm/sbin/ifconfig/ifvxlan.c
- copied unchanged from r273338, head/sbin/ifconfig/ifvxlan.c
projects/bhyve_svm/share/man/man4/vxlan.4
- copied unchanged from r273338, head/share/man/man4/vxlan.4
projects/bhyve_svm/share/man/man8/uefi.8
- copied unchanged from r273338, head/share/man/man8/uefi.8
projects/bhyve_svm/sys/arm/arm/elf_note.S
- copied unchanged from r273338, head/sys/arm/arm/elf_note.S
projects/bhyve_svm/sys/arm/conf/SOCKIT-BERI
- copied unchanged from r273338, head/sys/arm/conf/SOCKIT-BERI
projects/bhyve_svm/sys/arm/ti/am335x/am335x_gpio.c
- copied unchanged from r273338, head/sys/arm/ti/am335x/am335x_gpio.c
projects/bhyve_svm/sys/arm/ti/am335x/am335x_scm_padconf.h
- copied unchanged from r273338, head/sys/arm/ti/am335x/am335x_scm_padconf.h
projects/bhyve_svm/sys/arm/ti/omap4/omap4_gpio.c
- copied unchanged from r273338, head/sys/arm/ti/omap4/omap4_gpio.c
projects/bhyve_svm/sys/arm/ti/omap4/omap4_scm_padconf.h
- copied unchanged from r273338, head/sys/arm/ti/omap4/omap4_scm_padconf.h
projects/bhyve_svm/sys/arm/ti/ti_gpio.h
- copied unchanged from r273338, head/sys/arm/ti/ti_gpio.h
projects/bhyve_svm/sys/arm/ti/ti_gpio_if.m
- copied unchanged from r273338, head/sys/arm/ti/ti_gpio_if.m
projects/bhyve_svm/sys/arm/ti/ti_wdt.c
- copied unchanged from r273338, head/sys/arm/ti/ti_wdt.c
projects/bhyve_svm/sys/arm/ti/ti_wdt.h
- copied unchanged from r273338, head/sys/arm/ti/ti_wdt.h
projects/bhyve_svm/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts
- copied unchanged from r273338, head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts
projects/bhyve_svm/sys/dev/beri/
- copied from r273338, head/sys/dev/beri/
projects/bhyve_svm/sys/modules/if_vxlan/
- copied from r273338, head/sys/modules/if_vxlan/
projects/bhyve_svm/sys/net/if_vxlan.c
- copied unchanged from r273338, head/sys/net/if_vxlan.c
projects/bhyve_svm/sys/net/if_vxlan.h
- copied unchanged from r273338, head/sys/net/if_vxlan.h
Modified:
projects/bhyve_svm/ObsoleteFiles.inc
projects/bhyve_svm/bin/sh/parser.c
projects/bhyve_svm/bin/sh/tests/parser/Makefile
projects/bhyve_svm/cddl/lib/libdtrace/tcp.d
projects/bhyve_svm/contrib/openpam/lib/libpam/openpam_readword.c
projects/bhyve_svm/etc/rc.d/Makefile
projects/bhyve_svm/etc/rc.firewall
projects/bhyve_svm/lib/libkvm/kvm_arm.c
projects/bhyve_svm/lib/libkvm/kvm_proc.c
projects/bhyve_svm/sbin/ifconfig/Makefile
projects/bhyve_svm/sbin/ifconfig/ifconfig.8
projects/bhyve_svm/sbin/ipfw/ipfw2.c
projects/bhyve_svm/sbin/ipfw/tables.c
projects/bhyve_svm/sbin/ping/Makefile
projects/bhyve_svm/sbin/ping/ping.c
projects/bhyve_svm/sbin/ping6/Makefile
projects/bhyve_svm/sbin/ping6/ping6.c
projects/bhyve_svm/share/man/man4/Makefile
projects/bhyve_svm/share/man/man4/vt.4
projects/bhyve_svm/share/man/man8/Makefile
projects/bhyve_svm/share/man/man9/hash.9
projects/bhyve_svm/share/misc/bsd-family-tree
projects/bhyve_svm/sys/arm/altera/socfpga/files.socfpga
projects/bhyve_svm/sys/arm/arm/dump_machdep.c
projects/bhyve_svm/sys/arm/arm/locore.S
projects/bhyve_svm/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
projects/bhyve_svm/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
projects/bhyve_svm/sys/arm/conf/BEAGLEBONE
projects/bhyve_svm/sys/arm/freescale/imx/imx6_anatop.c
projects/bhyve_svm/sys/arm/include/asmacros.h
projects/bhyve_svm/sys/arm/ti/am335x/am335x_scm_padconf.c
projects/bhyve_svm/sys/arm/ti/am335x/files.am335x
projects/bhyve_svm/sys/arm/ti/files.ti
projects/bhyve_svm/sys/arm/ti/omap4/files.omap4
projects/bhyve_svm/sys/arm/ti/omap4/omap4_scm_padconf.c
projects/bhyve_svm/sys/arm/ti/ti_gpio.c
projects/bhyve_svm/sys/arm/ti/ti_i2c.c
projects/bhyve_svm/sys/arm/ti/ti_scm.h
projects/bhyve_svm/sys/boot/common/load_elf.c
projects/bhyve_svm/sys/boot/fdt/dts/arm/am335x.dtsi
projects/bhyve_svm/sys/boot/fdt/fdt_loader_cmd.c
projects/bhyve_svm/sys/cam/ata/ata_da.c
projects/bhyve_svm/sys/cam/ctl/ctl.c
projects/bhyve_svm/sys/cam/scsi/scsi_da.c
projects/bhyve_svm/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
projects/bhyve_svm/sys/compat/freebsd32/freebsd32.h
projects/bhyve_svm/sys/conf/Makefile.arm
projects/bhyve_svm/sys/conf/NOTES
projects/bhyve_svm/sys/conf/files
projects/bhyve_svm/sys/conf/files.arm
projects/bhyve_svm/sys/dev/ata/ata-pci.h
projects/bhyve_svm/sys/dev/ata/chipsets/ata-jmicron.c
projects/bhyve_svm/sys/dev/cfe/cfe_env.c
projects/bhyve_svm/sys/dev/cxgb/common/cxgb_ael1002.c
projects/bhyve_svm/sys/dev/fdt/simplebus.c
projects/bhyve_svm/sys/dev/hwpmc/hwpmc_mod.c
projects/bhyve_svm/sys/dev/nvram2env/nvram2env.c
projects/bhyve_svm/sys/dev/usb/serial/u3g.c
projects/bhyve_svm/sys/dev/usb/usbdevs
projects/bhyve_svm/sys/dev/vt/vt_core.c
projects/bhyve_svm/sys/fs/nullfs/null_vfsops.c
projects/bhyve_svm/sys/fs/tmpfs/tmpfs_vfsops.c
projects/bhyve_svm/sys/fs/unionfs/union_vfsops.c
projects/bhyve_svm/sys/kern/kern_intr.c
projects/bhyve_svm/sys/kern/kern_linker.c
projects/bhyve_svm/sys/kern/kern_proc.c
projects/bhyve_svm/sys/kern/link_elf.c
projects/bhyve_svm/sys/kern/link_elf_obj.c
projects/bhyve_svm/sys/kern/sched_ule.c
projects/bhyve_svm/sys/kern/subr_prof.c
projects/bhyve_svm/sys/kern/vfs_vnops.c
projects/bhyve_svm/sys/libkern/murmur3_32.c
projects/bhyve_svm/sys/mips/beri/beri_machdep.c
projects/bhyve_svm/sys/mips/rmi/xlr_machdep.c
projects/bhyve_svm/sys/mips/rt305x/rt305x_machdep.c
projects/bhyve_svm/sys/modules/Makefile
projects/bhyve_svm/sys/net/if_stf.c
projects/bhyve_svm/sys/netpfil/ipfw/ip_fw_private.h
projects/bhyve_svm/sys/netpfil/ipfw/ip_fw_sockopt.c
projects/bhyve_svm/sys/netpfil/ipfw/ip_fw_table.c
projects/bhyve_svm/sys/netpfil/pf/pf.c
projects/bhyve_svm/sys/sys/elf_common.h
projects/bhyve_svm/sys/sys/hash.h
projects/bhyve_svm/sys/sys/linker.h
projects/bhyve_svm/sys/sys/mman.h
projects/bhyve_svm/sys/sys/mount.h
projects/bhyve_svm/sys/sys/param.h
projects/bhyve_svm/sys/sys/priv.h
projects/bhyve_svm/sys/sys/proc.h
projects/bhyve_svm/sys/sys/user.h
projects/bhyve_svm/sys/ufs/ffs/ffs_vfsops.c
projects/bhyve_svm/sys/vm/vm_mmap.c
projects/bhyve_svm/usr.bin/col/col.c
projects/bhyve_svm/usr.bin/truss/syscalls.c
projects/bhyve_svm/usr.sbin/Makefile.i386
projects/bhyve_svm/usr.sbin/watchdogd/watchdog.8
projects/bhyve_svm/usr.sbin/watchdogd/watchdogd.8
Directory Properties:
projects/bhyve_svm/ (props changed)
projects/bhyve_svm/cddl/ (props changed)
projects/bhyve_svm/contrib/openpam/ (props changed)
projects/bhyve_svm/etc/ (props changed)
projects/bhyve_svm/sbin/ (props changed)
projects/bhyve_svm/sbin/ipfw/ (props changed)
projects/bhyve_svm/share/ (props changed)
projects/bhyve_svm/share/man/man4/ (props changed)
projects/bhyve_svm/sys/ (props changed)
projects/bhyve_svm/sys/boot/ (props changed)
projects/bhyve_svm/sys/cddl/contrib/opensolaris/ (props changed)
projects/bhyve_svm/sys/conf/ (props changed)
Modified: projects/bhyve_svm/ObsoleteFiles.inc
==============================================================================
--- projects/bhyve_svm/ObsoleteFiles.inc Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/ObsoleteFiles.inc Tue Oct 21 01:57:36 2014 (r273363)
@@ -48,6 +48,8 @@ OLD_FILES+=etc/rc.d/hv_kvpd
# 20140917: libnv was accidentally being installed to /usr/lib instead of /lib
OLD_LIBS+=usr/lib/libnv.a
OLD_LIBS+=usr/lib/libnv.so.0
+# 20140829: rc.d/kerberos removed
+OLD_FILES+=etc/rc.d/kerberos
# 20140814: libopie version bump
OLD_LIBS+=usr/lib/libopie.so.7
OLD_LIBS+=usr/lib32/libopie.so.7
Modified: projects/bhyve_svm/bin/sh/parser.c
==============================================================================
--- projects/bhyve_svm/bin/sh/parser.c Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/bin/sh/parser.c Tue Oct 21 01:57:36 2014 (r273363)
@@ -125,6 +125,7 @@ static void consumetoken(int);
static void synexpect(int) __dead2;
static void synerror(const char *) __dead2;
static void setprompt(int);
+static int pgetc_linecont(void);
static void *
@@ -899,17 +900,17 @@ xxreadtoken(void)
case PEOF:
RETURN(TEOF);
case '&':
- if (pgetc() == '&')
+ if (pgetc_linecont() == '&')
RETURN(TAND);
pungetc();
RETURN(TBACKGND);
case '|':
- if (pgetc() == '|')
+ if (pgetc_linecont() == '|')
RETURN(TOR);
pungetc();
RETURN(TPIPE);
case ';':
- c = pgetc();
+ c = pgetc_linecont();
if (c == ';')
RETURN(TENDCASE);
else if (c == '&')
@@ -991,7 +992,7 @@ parseredir(char *out, int c)
np = (union node *)stalloc(sizeof (struct nfile));
if (c == '>') {
np->nfile.fd = 1;
- c = pgetc();
+ c = pgetc_linecont();
if (c == '>')
np->type = NAPPEND;
else if (c == '&')
@@ -1004,7 +1005,7 @@ parseredir(char *out, int c)
}
} else { /* c == '<' */
np->nfile.fd = 0;
- c = pgetc();
+ c = pgetc_linecont();
if (c == '<') {
if (sizeof (struct nfile) != sizeof (struct nhere)) {
np = (union node *)stalloc(sizeof (struct nhere));
@@ -1013,7 +1014,7 @@ parseredir(char *out, int c)
np->type = NHERE;
heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc));
heredoc->here = np;
- if ((c = pgetc()) == '-') {
+ if ((c = pgetc_linecont()) == '-') {
heredoc->striptabs = 1;
} else {
heredoc->striptabs = 0;
@@ -1094,25 +1095,12 @@ parsebackq(char *out, struct nodelist **
needprompt = 0;
}
CHECKSTRSPACE(2, oout);
- c = pgetc();
+ c = pgetc_linecont();
if (c == '`')
break;
switch (c) {
case '\\':
- if ((c = pgetc()) == '\n') {
- plinno++;
- if (doprompt)
- setprompt(2);
- else
- setprompt(0);
- /*
- * If eating a newline, avoid putting
- * the newline into the new character
- * stream (via the USTPUTC after the
- * switch).
- */
- continue;
- }
+ c = pgetc();
if (c != '\\' && c != '`' && c != '$'
&& (!dblquote || c != '"'))
USTPUTC('\\', oout);
@@ -1507,7 +1495,7 @@ readtoken1(int firstc, char const *initi
USTPUTC(c, out);
--state[level].parenlevel;
} else {
- if (pgetc() == ')') {
+ if (pgetc_linecont() == ')') {
if (level > 0 &&
state[level].category == TSTATE_ARITH) {
level--;
@@ -1593,9 +1581,9 @@ parsesub: {
int length;
int c1;
- c = pgetc();
+ c = pgetc_linecont();
if (c == '(') { /* $(command) or $((arith)) */
- if (pgetc() == '(') {
+ if (pgetc_linecont() == '(') {
PARSEARITH();
} else {
pungetc();
@@ -1613,7 +1601,7 @@ parsesub: {
flags = 0;
if (c == '{') {
bracketed_name = 1;
- c = pgetc();
+ c = pgetc_linecont();
subtype = 0;
}
varname:
@@ -1621,7 +1609,7 @@ varname:
length = 0;
do {
STPUTC(c, out);
- c = pgetc();
+ c = pgetc_linecont();
length++;
} while (!is_eof(c) && is_in_name(c));
if (length == 6 &&
@@ -1640,22 +1628,22 @@ varname:
if (bracketed_name) {
do {
STPUTC(c, out);
- c = pgetc();
+ c = pgetc_linecont();
} while (is_digit(c));
} else {
STPUTC(c, out);
- c = pgetc();
+ c = pgetc_linecont();
}
} else if (is_special(c)) {
c1 = c;
- c = pgetc();
+ c = pgetc_linecont();
if (subtype == 0 && c1 == '#') {
subtype = VSLENGTH;
if (strchr(types, c) == NULL && c != ':' &&
c != '#' && c != '%')
goto varname;
c1 = c;
- c = pgetc();
+ c = pgetc_linecont();
if (c1 != '}' && c == '}') {
pungetc();
c = c1;
@@ -1680,7 +1668,7 @@ varname:
switch (c) {
case ':':
flags |= VSNUL;
- c = pgetc();
+ c = pgetc_linecont();
/*FALLTHROUGH*/
default:
p = strchr(types, c);
@@ -1700,7 +1688,7 @@ varname:
int cc = c;
subtype = c == '#' ? VSTRIMLEFT :
VSTRIMRIGHT;
- c = pgetc();
+ c = pgetc_linecont();
if (c == cc)
subtype++;
else
@@ -1909,6 +1897,29 @@ setprompt(int which)
}
}
+static int
+pgetc_linecont(void)
+{
+ int c;
+
+ while ((c = pgetc_macro()) == '\\') {
+ c = pgetc();
+ if (c == '\n') {
+ plinno++;
+ if (doprompt)
+ setprompt(2);
+ else
+ setprompt(0);
+ } else {
+ pungetc();
+ /* Allow the backslash to be pushed back. */
+ pushstring("\\", 1, NULL);
+ return (pgetc());
+ }
+ }
+ return (c);
+}
+
/*
* called by editline -- any expansions to the prompt
* should be added here.
Modified: projects/bhyve_svm/bin/sh/tests/parser/Makefile
==============================================================================
--- projects/bhyve_svm/bin/sh/tests/parser/Makefile Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/bin/sh/tests/parser/Makefile Tue Oct 21 01:57:36 2014 (r273363)
@@ -55,6 +55,17 @@ FILES+= heredoc9.0
FILES+= heredoc10.0
FILES+= heredoc11.0
FILES+= heredoc12.0
+FILES+= line-cont1.0
+FILES+= line-cont2.0
+FILES+= line-cont3.0
+FILES+= line-cont4.0
+FILES+= line-cont5.0
+FILES+= line-cont6.0
+FILES+= line-cont7.0
+FILES+= line-cont8.0
+FILES+= line-cont9.0
+FILES+= line-cont10.0
+FILES+= line-cont11.0
FILES+= no-space1.0
FILES+= no-space2.0
FILES+= only-redir1.0
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont1.0 (from r273338, head/bin/sh/tests/parser/line-cont1.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont1.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont1.0)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+i\
+f
+t\
+r\
+u\
+e
+t\
+h\
+e\
+n
+:
+\
+f\
+i
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont10.0 (from r273338, head/bin/sh/tests/parser/line-cont10.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont10.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont10.0)
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+v=XaaaXbbbX
+[ "${v\
+#\
+*\
+a}.${v\
+#\
+#\
+*\
+a}.${v\
+%\
+b\
+*}.${v\
+%\
+%\
+b\
+*}" = aaXbbbX.XbbbX.XaaaXbb.XaaaX ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont11.0 (from r273338, head/bin/sh/tests/parser/line-cont11.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont11.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont11.0)
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+T=$(mktemp "${TMPDIR:-/tmp}/sh-test.XXXXXXXX") || exit
+trap 'rm -f -- "$T"' 0
+w='#A'
+# A naive pgetc_linecont() would push back two characters here, which
+# fails if a new buffer is read between the two characters.
+c='${w#\#}'
+c=$c$c$c$c
+c=$c$c$c$c
+c=$c$c$c$c
+c=$c$c$c$c
+c=$c$c$c$c
+c=$c$c$c$c
+printf 'v=%s\n' "$c" >"$T"
+. "$T"
+if [ "${#v}" != 4096 ]; then
+ echo "Length is bad (${#v})"
+ exit 3
+fi
+case $v in
+*[!A]*) echo "Content is bad"; exit 3 ;;
+esac
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont2.0 (from r273338, head/bin/sh/tests/parser/line-cont2.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont2.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont2.0)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+[ "a\
+b" = ab ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont3.0 (from r273338, head/bin/sh/tests/parser/line-cont3.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont3.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont3.0)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+v=`printf %s 'a\
+b'`
+w="`printf %s 'c\
+d'`"
+[ "$v$w" = abcd ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont4.0 (from r273338, head/bin/sh/tests/parser/line-cont4.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont4.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont4.0)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+v=abcd
+[ "$\
+v.$\
+{v}.${\
+v}.${v\
+}" = abcd.abcd.abcd.abcd ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont5.0 (from r273338, head/bin/sh/tests/parser/line-cont5.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont5.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont5.0)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+bad=1
+case x in
+x\
+) ;\
+; *) exit 7
+esac &\
+& bad= &\
+& : >\
+>/dev/null
+
+false |\
+| [ -z "$bad" ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont6.0 (from r273338, head/bin/sh/tests/parser/line-cont6.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont6.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont6.0)
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+v0\
+=abc
+
+v=$(cat <\
+<\
+E\
+O\
+F
+${v0}d
+EOF
+)
+
+w=$(cat <\
+<\
+-\
+EOF
+ efgh
+EOF
+)
+
+[ "$v.$w" = "abcd.efgh" ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont7.0 (from r273338, head/bin/sh/tests/parser/line-cont7.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont7.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont7.0)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+[ "$(\
+(
+1\
++ 1)\
+)" = 2 ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont8.0 (from r273338, head/bin/sh/tests/parser/line-cont8.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont8.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont8.0)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+set -- a b c d e f g h i j
+[ "${1\
+0\
+}" = j ]
Copied: projects/bhyve_svm/bin/sh/tests/parser/line-cont9.0 (from r273338, head/bin/sh/tests/parser/line-cont9.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/bin/sh/tests/parser/line-cont9.0 Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/bin/sh/tests/parser/line-cont9.0)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+[ "${$\
+:\
++\
+xyz}" = xyz ]
Modified: projects/bhyve_svm/cddl/lib/libdtrace/tcp.d
==============================================================================
--- projects/bhyve_svm/cddl/lib/libdtrace/tcp.d Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/cddl/lib/libdtrace/tcp.d Tue Oct 21 01:57:36 2014 (r273363)
@@ -116,6 +116,7 @@ typedef struct tcpsinfo {
uint32_t tcps_rto; /* round-trip timeout, msec */
uint32_t tcps_mss; /* max segment size */
int tcps_retransmit; /* retransmit send event, boolean */
+ int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
} tcpsinfo_t;
/*
@@ -200,6 +201,7 @@ translator tcpsinfo_t < struct tcpcb *p
tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */
tcps_mss = p == NULL ? -1 : p->t_maxseg;
tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
+ tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
};
#pragma D binding "1.6.3" translator
Modified: projects/bhyve_svm/contrib/openpam/lib/libpam/openpam_readword.c
==============================================================================
--- projects/bhyve_svm/contrib/openpam/lib/libpam/openpam_readword.c Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/contrib/openpam/lib/libpam/openpam_readword.c Tue Oct 21 01:57:36 2014 (r273363)
@@ -55,18 +55,35 @@ openpam_readword(FILE *f, int *lineno, s
{
char *word;
size_t size, len;
- int ch, comment, escape, quote;
+ int ch, escape, quote;
int serrno;
errno = 0;
/* skip initial whitespace */
- comment = 0;
- while ((ch = getc(f)) != EOF && ch != '\n') {
- if (ch == '#')
- comment = 1;
- if (!is_lws(ch) && !comment)
+ escape = quote = 0;
+ while ((ch = getc(f)) != EOF) {
+ if (ch == '\n') {
+ /* either EOL or line continuation */
+ if (!escape)
+ break;
+ if (lineno != NULL)
+ ++*lineno;
+ escape = 0;
+ } else if (escape) {
+ /* escaped something else */
+ break;
+ } else if (ch == '#') {
+ /* comment: until EOL, no continuation */
+ while ((ch = getc(f)) != EOF)
+ if (ch == '\n')
+ break;
break;
+ } else if (ch == '\\') {
+ escape = 1;
+ } else if (!is_ws(ch)) {
+ break;
+ }
}
if (ch == EOF)
return (NULL);
@@ -76,7 +93,6 @@ openpam_readword(FILE *f, int *lineno, s
word = NULL;
size = len = 0;
- escape = quote = 0;
while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) {
if (ch == '\\' && !escape && quote != '\'') {
/* escape next character */
@@ -90,7 +106,7 @@ openpam_readword(FILE *f, int *lineno, s
} else if (ch == quote && !escape) {
/* end quote */
quote = 0;
- } else if (ch == '\n' && escape && quote != '\'') {
+ } else if (ch == '\n' && escape) {
/* line continuation */
escape = 0;
} else {
Modified: projects/bhyve_svm/etc/rc.d/Makefile
==============================================================================
--- projects/bhyve_svm/etc/rc.d/Makefile Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/etc/rc.d/Makefile Tue Oct 21 01:57:36 2014 (r273363)
@@ -70,12 +70,12 @@ FILES= DAEMON \
iscsictl \
iscsid \
jail \
- kadmind \
- kdc \
- kfd \
+ ${_kadmind} \
+ ${_kdc} \
+ ${_kfd} \
kld \
kldxref \
- kpasswdd \
+ ${_kpasswdd} \
ldconfig \
local \
localpkg \
@@ -181,6 +181,13 @@ _casperd= casperd
_nscd= nscd
.endif
+.if ${MK_KERBEROS} != "no"
+_kadmind= kadmind
+_kdc= kdc
+_kfd= kfd
+_kpasswdd= kpasswdd
+.endif
+
.if ${MK_OFED} != "no"
_opensm= opensm
.endif
Modified: projects/bhyve_svm/etc/rc.firewall
==============================================================================
--- projects/bhyve_svm/etc/rc.firewall Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/etc/rc.firewall Tue Oct 21 01:57:36 2014 (r273363)
@@ -498,7 +498,8 @@ case ${firewall_type} in
${fwcmd} add pass udp from $i to me ${j%/[Uu][Dd][Pp]}
;;
*[0-9A-Za-z])
- echo "Consider using tcp/$j in firewall_myservices." > /dev/stderr
+ echo "Consider using ${j}/tcp in firewall_myservices." \
+ > /dev/stderr
${fwcmd} add pass tcp from $i to me $j
;;
*)
Modified: projects/bhyve_svm/lib/libkvm/kvm_arm.c
==============================================================================
--- projects/bhyve_svm/lib/libkvm/kvm_arm.c Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/lib/libkvm/kvm_arm.c Tue Oct 21 01:57:36 2014 (r273363)
@@ -132,8 +132,10 @@ _kvm_initvtop(kvm_t *kd)
u_long kernbase, physaddr, pa;
pd_entry_t *l1pt;
Elf32_Ehdr *ehdr;
+ Elf32_Phdr *phdr;
size_t hdrsz;
char minihdr[8];
+ int found, i;
if (!kd->rawdump) {
if (pread(kd->pmfd, &minihdr, 8, 0) == 8) {
@@ -158,19 +160,33 @@ _kvm_initvtop(kvm_t *kd)
hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum;
if (_kvm_maphdrs(kd, hdrsz) == -1)
return (-1);
- nl[0].n_name = "kernbase";
- nl[1].n_name = NULL;
- if (kvm_nlist(kd, nl) != 0)
- kernbase = KERNBASE;
- else
- kernbase = nl[0].n_value;
- nl[0].n_name = "physaddr";
- if (kvm_nlist(kd, nl) != 0) {
- _kvm_err(kd, kd->program, "couldn't get phys addr");
- return (-1);
+ phdr = (Elf32_Phdr *)((uint8_t *)ehdr + ehdr->e_phoff);
+ found = 0;
+ for (i = 0; i < ehdr->e_phnum; i++) {
+ if (phdr[i].p_type == PT_DUMP_DELTA) {
+ kernbase = phdr[i].p_vaddr;
+ physaddr = phdr[i].p_paddr;
+ found = 1;
+ break;
+ }
+ }
+
+ nl[1].n_name = NULL;
+ if (!found) {
+ nl[0].n_name = "kernbase";
+ if (kvm_nlist(kd, nl) != 0)
+ kernbase = KERNBASE;
+ else
+ kernbase = nl[0].n_value;
+
+ nl[0].n_name = "physaddr";
+ if (kvm_nlist(kd, nl) != 0) {
+ _kvm_err(kd, kd->program, "couldn't get phys addr");
+ return (-1);
+ }
+ physaddr = nl[0].n_value;
}
- physaddr = nl[0].n_value;
nl[0].n_name = "kernel_l1pa";
if (kvm_nlist(kd, nl) != 0) {
_kvm_err(kd, kd->program, "bad namelist");
Modified: projects/bhyve_svm/lib/libkvm/kvm_proc.c
==============================================================================
--- projects/bhyve_svm/lib/libkvm/kvm_proc.c Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/lib/libkvm/kvm_proc.c Tue Oct 21 01:57:36 2014 (r273363)
@@ -431,6 +431,24 @@ nopgrp:
strlcpy(kp->ki_tdname, mtd.td_name, sizeof(kp->ki_tdname));
kp->ki_pctcpu = 0;
kp->ki_rqindex = 0;
+
+ /*
+ * Note: legacy fields; wraps at NO_CPU_OLD or the
+ * old max CPU value as appropriate
+ */
+ if (mtd.td_lastcpu == NOCPU)
+ kp->ki_lastcpu_old = NOCPU_OLD;
+ else if (mtd.td_lastcpu > MAXCPU_OLD)
+ kp->ki_lastcpu_old = MAXCPU_OLD;
+ else
+ kp->ki_lastcpu_old = mtd.td_lastcpu;
+
+ if (mtd.td_oncpu == NOCPU)
+ kp->ki_oncpu_old = NOCPU_OLD;
+ else if (mtd.td_oncpu > MAXCPU_OLD)
+ kp->ki_oncpu_old = MAXCPU_OLD;
+ else
+ kp->ki_oncpu_old = mtd.td_oncpu;
} else {
kp->ki_stat = SZOMB;
}
Modified: projects/bhyve_svm/sbin/ifconfig/Makefile
==============================================================================
--- projects/bhyve_svm/sbin/ifconfig/Makefile Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/sbin/ifconfig/Makefile Tue Oct 21 01:57:36 2014 (r273363)
@@ -30,6 +30,7 @@ SRCS+= ifmac.c # MAC support
SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support
SRCS+= iffib.c # non-default FIB support
SRCS+= ifvlan.c # SIOC[GS]ETVLAN support
+SRCS+= ifvxlan.c # VXLAN support
SRCS+= ifgre.c # GRE keys etc
SRCS+= ifgif.c # GIF reversed header workaround
Modified: projects/bhyve_svm/sbin/ifconfig/ifconfig.8
==============================================================================
--- projects/bhyve_svm/sbin/ifconfig/ifconfig.8 Tue Oct 21 01:49:07 2014 (r273362)
+++ projects/bhyve_svm/sbin/ifconfig/ifconfig.8 Tue Oct 21 01:57:36 2014 (r273363)
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd October 1, 2014
+.Dd October 20, 2014
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -2541,6 +2541,76 @@ argument is useless and hence deprecated
.El
.Pp
The following parameters are used to configure
+.Xr vxlan 4
+interfaces.
+.Bl -tag -width indent
+.It Cm vni Ar identifier
+This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the
+virtual network segment membership of the interface.
+.It Cm local Ar address
+The source address used in the encapsulating IPv4/IPv6 header.
+The address should already be assigned to an existing interface.
+When the interface is configured in unicast mode, the listening socket
+is bound to this address.
+.It Cm remote Ar address
+The interface can be configured in a unicast, or point-to-point, mode
+to create a tunnel between two hosts.
+This is the IP address of the remote end of the tunnel.
+.It Cm group Ar address
+The interface can be configured in a multicast mode
+to create a virtual network of hosts.
+This is the IP multicast group address the interface will join.
+.It Cm localport Ar port
+The port number the interface will listen on.
+The default port number is 4789.
+.It Cm remoteport Ar port
+The destination port number used in the encapsulating IPv4/IPv6 header.
+The remote host should be listening on this port.
+The default port number is 4789.
+Note some other implementations, such as Linux,
+do not default to the IANA assigned port,
+but instead listen on port 8472.
+.It Cm portrange Ar low high
+The range of source ports used in the encapsulating IPv4/IPv6 header.
+The port selected within the range is based on a hash of the inner frame.
+A range is useful to provide entropy within the outer IP header
+for more effective load balancing.
+The default range is between the
+.Xr sysctl 8
+variables
+.Va net.inet.ip.portrange.first
+and
+.Va net.inet.ip.portrange.last
+.It Cm timeout Ar timeout
+The maximum time, in seconds, before an entry in the forwarding table
+is pruned.
+The default is 1200 seconds (20 minutes).
+.It Cm maxaddr Ar max
+The maximum number of entries in the forwarding table.
+The default is 2000.
+.It Cm vxlandev Ar dev
+When the interface is configured in multicast mode, the
+.Cm dev
+interface is used to transmit IP multicast packets.
+.It Cm ttl Ar ttl
+The TTL used in the encapsulating IPv4/IPv6 header.
+The default is 64.
+.It Cm learn
+The source IP address and inner source Ethernet MAC address of
+received packets are used to dynamically populate the forwarding table.
+When in multicast mode, an entry in the forwarding table allows the
+interface to send the frame directly to the remote host instead of
+broadcasting the frame to the multicast group.
+This is the default.
+.It Fl learn
+The forwarding table is not populated by recevied packets.
+.It Cm flush
+Delete all dynamically-learned addresses from the forwarding table.
+.It Cm flushall
+Delete all addresses, including static addresses, from the forwarding table.
+.El
+.Pp
+The following parameters are used to configure
.Xr carp 4
protocol on an interface:
.Bl -tag -width indent
@@ -2745,6 +2815,7 @@ tried to alter an interface's configurat
.Xr pfsync 4 ,
.Xr polling 4 ,
.Xr vlan 4 ,
+.Xr vxlan 4 ,
.Xr devd.conf 5 ,
.\" .Xr eon 5 ,
.Xr devd 8 ,
Copied: projects/bhyve_svm/sbin/ifconfig/ifvxlan.c (from r273338, head/sbin/ifconfig/ifvxlan.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve_svm/sbin/ifconfig/ifvxlan.c Tue Oct 21 01:57:36 2014 (r273363, copy of r273338, head/sbin/ifconfig/ifvxlan.c)
@@ -0,0 +1,648 @@
+/*-
+ * Copyright (c) 2014, Bryan Venteicher <bryanv at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <netdb.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_vxlan.h>
+#include <net/route.h>
+#include <netinet/in.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <err.h>
+#include <errno.h>
+
+#include "ifconfig.h"
+
+static struct ifvxlanparam params = {
+ .vxlp_vni = VXLAN_VNI_MAX,
+};
+
+static int
+get_val(const char *cp, u_long *valp)
+{
+ char *endptr;
+ u_long val;
+
+ errno = 0;
+ val = strtoul(cp, &endptr, 0);
+ if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE)
+ return (-1);
+
+ *valp = val;
+ return (0);
+}
+
+static int
+do_cmd(int sock, u_long op, void *arg, size_t argsize, int set)
+{
+ struct ifdrv ifd;
+
+ bzero(&ifd, sizeof(ifd));
+
+ strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name));
+ ifd.ifd_cmd = op;
+ ifd.ifd_len = argsize;
+ ifd.ifd_data = arg;
+
+ return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd));
+}
+
+static int
+vxlan_exists(int sock)
+{
+ struct ifvxlancfg cfg;
+
+ bzero(&cfg, sizeof(cfg));
+
+ return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) != -1);
+}
+
+static void
+vxlan_status(int s)
+{
+ struct ifvxlancfg cfg;
+ char src[NI_MAXHOST], dst[NI_MAXHOST];
+ char srcport[NI_MAXSERV], dstport[NI_MAXSERV];
+ struct sockaddr *lsa, *rsa;
+ int vni, mc, ipv6;
+
+ bzero(&cfg, sizeof(cfg));
+
+ if (do_cmd(s, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) < 0)
+ return;
+
+ vni = cfg.vxlc_vni;
+ lsa = &cfg.vxlc_local_sa.sa;
+ rsa = &cfg.vxlc_remote_sa.sa;
+ ipv6 = rsa->sa_family == AF_INET6;
+
+ /* Just report nothing if the network identity isn't set yet. */
+ if (vni >= VXLAN_VNI_MAX)
+ return;
+
+ if (getnameinfo(lsa, lsa->sa_len, src, sizeof(src),
+ srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0)
+ src[0] = srcport[0] = '\0';
+ if (getnameinfo(rsa, rsa->sa_len, dst, sizeof(dst),
+ dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0)
+ dst[0] = dstport[0] = '\0';
+
+ if (!ipv6) {
+ struct sockaddr_in *sin = (struct sockaddr_in *)rsa;
+ mc = IN_MULTICAST(ntohl(sin->sin_addr.s_addr));
+ } else {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rsa;
+ mc = IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr);
+ }
+
+ printf("\tvxlan vni %d", vni);
+ printf(" local %s%s%s:%s", ipv6 ? "[" : "", src, ipv6 ? "]" : "",
+ srcport);
+ printf(" %s %s%s%s:%s", mc ? "group" : "remote", ipv6 ? "[" : "",
+ dst, ipv6 ? "]" : "", dstport);
+
+ if (verbose) {
+ printf("\n\t\tconfig: ");
+ printf("%slearning portrange %d-%d ttl %d",
+ cfg.vxlc_learn ? "" : "no", cfg.vxlc_port_min,
+ cfg.vxlc_port_max, cfg.vxlc_ttl);
+ printf("\n\t\tftable: ");
+ printf("cnt %d max %d timeout %d",
+ cfg.vxlc_ftable_cnt, cfg.vxlc_ftable_max,
+ cfg.vxlc_ftable_timeout);
+ }
+
+ putchar('\n');
+}
+
+#define _LOCAL_ADDR46 \
+ (VXLAN_PARAM_WITH_LOCAL_ADDR4 | VXLAN_PARAM_WITH_LOCAL_ADDR6)
+#define _REMOTE_ADDR46 \
+ (VXLAN_PARAM_WITH_REMOTE_ADDR4 | VXLAN_PARAM_WITH_REMOTE_ADDR6)
+
+static void
+vxlan_check_params(void)
+{
+
+ if ((params.vxlp_with & _LOCAL_ADDR46) == _LOCAL_ADDR46)
+ errx(1, "cannot specify both local IPv4 and IPv6 addresses");
+ if ((params.vxlp_with & _REMOTE_ADDR46) == _REMOTE_ADDR46)
+ errx(1, "cannot specify both remote IPv4 and IPv6 addresses");
+ if ((params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR4 &&
+ params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR6) ||
+ (params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR6 &&
+ params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR4))
+ errx(1, "cannot mix IPv4 and IPv6 addresses");
+}
+
+#undef _LOCAL_ADDR46
+#undef _REMOTE_ADDR46
+
+static void
+vxlan_cb(int s, void *arg)
+{
+
+}
+
+static void
+vxlan_create(int s, struct ifreq *ifr)
+{
+
+ vxlan_check_params();
+
+ ifr->ifr_data = (caddr_t) ¶ms;
+ if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
+ err(1, "SIOCIFCREATE2");
+}
+
+static
+DECL_CMD_FUNC(setvxlan_vni, arg, d)
+{
+ struct ifvxlancmd cmd;
+ u_long val;
+
+ if (get_val(arg, &val) < 0 || val >= VXLAN_VNI_MAX)
+ errx(1, "invalid network identifier: %s", arg);
+
+ if (!vxlan_exists(s)) {
+ params.vxlp_with |= VXLAN_PARAM_WITH_VNI;
+ params.vxlp_vni = val;
+ return;
+ }
+
+ bzero(&cmd, sizeof(cmd));
+ cmd.vxlcmd_vni = val;
+
+ if (do_cmd(s, VXLAN_CMD_SET_VNI, &cmd, sizeof(cmd), 1) < 0)
+ err(1, "VXLAN_CMD_SET_VNI");
+}
+
+static
+DECL_CMD_FUNC(setvxlan_local, addr, d)
+{
+ struct ifvxlancmd cmd;
+ struct addrinfo *ai;
+ struct sockaddr *sa;
+ int error;
+
+ bzero(&cmd, sizeof(cmd));
+
+ if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0)
+ errx(1, "error in parsing local address string: %s",
+ gai_strerror(error));
+
+ sa = ai->ai_addr;
+
+ switch (ai->ai_family) {
+#ifdef INET
+ case AF_INET: {
+ struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr;
+
+ if (IN_MULTICAST(ntohl(addr.s_addr)))
+ errx(1, "local address cannot be multicast");
+
+ cmd.vxlcmd_sa.in4.sin_family = AF_INET;
+ cmd.vxlcmd_sa.in4.sin_addr = addr;
+ break;
+ }
+#endif
+#ifdef INET6
+ case AF_INET6: {
+ struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
+
+ if (IN6_IS_ADDR_MULTICAST(addr))
+ errx(1, "local address cannot be multicast");
+
+ cmd.vxlcmd_sa.in6.sin6_family = AF_INET6;
+ cmd.vxlcmd_sa.in6.sin6_addr = *addr;
+ break;
+ }
+#endif
+ default:
+ errx(1, "local address %s not supported", addr);
+ }
+
+ freeaddrinfo(ai);
+
+ if (!vxlan_exists(s)) {
+ if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) {
+ params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4;
+ params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr;
+ } else {
+ params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6;
+ params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr;
+ }
+ return;
+ }
+
+ if (do_cmd(s, VXLAN_CMD_SET_LOCAL_ADDR, &cmd, sizeof(cmd), 1) < 0)
+ err(1, "VXLAN_CMD_SET_LOCAL_ADDR");
+}
+
+static
+DECL_CMD_FUNC(setvxlan_remote, addr, d)
+{
+ struct ifvxlancmd cmd;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list