Date: Sat, 5 Mar 2016 15:34:54 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r296410 - in projects/clang380-import: . contrib/elftoolchain/elfcopy contrib/ofed/libsdp contrib/ofed/libsdp/scripts contrib/ofed/libsdp/src contrib/ofed/usr.bin/ibaddr contrib/ofed/us... Message-ID: <201603051534.u25FYsda063647@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Mar 5 15:34:54 2016 New Revision: 296410 URL: https://svnweb.freebsd.org/changeset/base/296410 Log: Merge ^/head r296369 through r296409. Added: projects/clang380-import/contrib/ofed/libsdp/scripts/ - copied from r296409, head/contrib/ofed/libsdp/scripts/ projects/clang380-import/contrib/ofed/libsdp/src/config_parser.y - copied unchanged from r296409, head/contrib/ofed/libsdp/src/config_parser.y projects/clang380-import/contrib/ofed/libsdp/src/config_scanner.l - copied unchanged from r296409, head/contrib/ofed/libsdp/src/config_scanner.l projects/clang380-import/contrib/ofed/usr.bin/ibaddr/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibaddr/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibping/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibping/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibportstate/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibportstate/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibroute/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibroute/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibsendtrap/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibsendtrap/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibstat/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibstat/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibsysstat/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibsysstat/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/ibtracert/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/ibtracert/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/opensm/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/opensm/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/osmtest/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/osmtest/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/perfquery/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/perfquery/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/saquery/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/saquery/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/sminfo/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/sminfo/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/smpdump/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/smpdump/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/smpquery/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/smpquery/Makefile.depend projects/clang380-import/contrib/ofed/usr.bin/vendstat/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.bin/vendstat/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libcxgb4/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libcxgb4/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libibcm/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libibcm/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libibcommon/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libibcommon/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libibmad/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libibmad/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libibumad/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libibumad/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libibverbs/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libibverbs/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libmlx4/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libmlx4/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libmthca/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libmthca/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libopensm/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libopensm/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libosmcomp/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libosmcomp/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libosmvendor/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libosmvendor/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/librdmacm/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/librdmacm/Makefile.depend projects/clang380-import/contrib/ofed/usr.lib/libsdp/Makefile.depend - copied unchanged from r296409, head/contrib/ofed/usr.lib/libsdp/Makefile.depend Modified: projects/clang380-import/Makefile.inc1 projects/clang380-import/ObsoleteFiles.inc projects/clang380-import/UPDATING projects/clang380-import/contrib/elftoolchain/elfcopy/sections.c projects/clang380-import/contrib/ofed/libsdp/ChangeLog projects/clang380-import/contrib/ofed/libsdp/Makefile.am projects/clang380-import/contrib/ofed/libsdp/libsdp.conf projects/clang380-import/contrib/ofed/libsdp/libsdp.spec.in projects/clang380-import/contrib/ofed/libsdp/src/config_parser.c projects/clang380-import/contrib/ofed/libsdp/src/config_parser.h projects/clang380-import/contrib/ofed/libsdp/src/config_scanner.c projects/clang380-import/contrib/ofed/libsdp/src/libsdp.h projects/clang380-import/contrib/ofed/libsdp/src/match.c projects/clang380-import/contrib/ofed/libsdp/src/port.c projects/clang380-import/contrib/ofed/usr.bin/ibaddr/Makefile projects/clang380-import/contrib/ofed/usr.bin/ibnetdiscover/Makefile projects/clang380-import/contrib/ofed/usr.bin/ibroute/Makefile projects/clang380-import/contrib/ofed/usr.bin/ibsendtrap/Makefile projects/clang380-import/contrib/ofed/usr.bin/ibtracert/Makefile projects/clang380-import/contrib/ofed/usr.bin/opensm/Makefile projects/clang380-import/contrib/ofed/usr.bin/saquery/Makefile projects/clang380-import/contrib/ofed/usr.bin/sminfo/Makefile projects/clang380-import/contrib/ofed/usr.bin/smpquery/Makefile projects/clang380-import/contrib/ofed/usr.bin/vendstat/Makefile projects/clang380-import/contrib/ofed/usr.lib/Makefile projects/clang380-import/contrib/ofed/usr.lib/libcxgb4/Makefile projects/clang380-import/contrib/ofed/usr.lib/libibcm/Makefile projects/clang380-import/contrib/ofed/usr.lib/libibmad/Makefile projects/clang380-import/contrib/ofed/usr.lib/libibumad/Makefile projects/clang380-import/contrib/ofed/usr.lib/libmlx4/Makefile projects/clang380-import/contrib/ofed/usr.lib/libmthca/Makefile projects/clang380-import/contrib/ofed/usr.lib/libopensm/Makefile projects/clang380-import/contrib/ofed/usr.lib/libosmcomp/Makefile projects/clang380-import/contrib/ofed/usr.lib/libosmvendor/Makefile projects/clang380-import/contrib/ofed/usr.lib/librdmacm/Makefile projects/clang380-import/contrib/ofed/usr.lib/libsdp/Makefile projects/clang380-import/include/rpc/xdr.h projects/clang380-import/lib/libc/rpc/clnt_vc.c projects/clang380-import/lib/libc/rpc/rtime.c projects/clang380-import/share/misc/committers-ports.dot projects/clang380-import/share/mk/bsd.lib.mk projects/clang380-import/share/mk/local.dirdeps.mk projects/clang380-import/share/mk/src.libnames.mk projects/clang380-import/sys/arm/allwinner/a10_clk.c projects/clang380-import/sys/arm/allwinner/a10_clk.h projects/clang380-import/sys/arm/allwinner/a10_ehci.c projects/clang380-import/sys/boot/common/Makefile.inc projects/clang380-import/sys/cam/ctl/ctl_frontend_iscsi.c projects/clang380-import/sys/dev/acpica/acpi.c projects/clang380-import/sys/dev/cxgbe/adapter.h projects/clang380-import/sys/dev/cxgbe/common/common.h projects/clang380-import/sys/dev/cxgbe/common/t4_hw.c projects/clang380-import/sys/dev/cxgbe/common/t4_hw.h projects/clang380-import/sys/dev/cxgbe/t4_main.c projects/clang380-import/sys/dev/cxgbe/t4_netmap.c projects/clang380-import/sys/dev/cxgbe/t4_sge.c projects/clang380-import/sys/dev/e1000/e1000_phy.c projects/clang380-import/sys/dev/hyperv/include/hyperv.h projects/clang380-import/sys/dev/hyperv/netvsc/hv_net_vsc.c projects/clang380-import/sys/dev/hyperv/netvsc/hv_net_vsc.h projects/clang380-import/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c projects/clang380-import/sys/dev/hyperv/netvsc/hv_rndis.h projects/clang380-import/sys/dev/hyperv/netvsc/hv_rndis_filter.c projects/clang380-import/sys/dev/hyperv/netvsc/hv_rndis_filter.h projects/clang380-import/sys/dev/hyperv/vmbus/hv_channel_mgmt.c projects/clang380-import/sys/fs/nullfs/null_vfsops.c projects/clang380-import/sys/net80211/ieee80211_var.h projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/cm.c projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/cq.c projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/mad.c projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/main.c projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/mr.c projects/clang380-import/sys/ofed/drivers/infiniband/hw/mlx4/qp.c projects/clang380-import/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c projects/clang380-import/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c projects/clang380-import/targets/pseudo/userland/Makefile.depend projects/clang380-import/targets/pseudo/userland/lib/Makefile.depend projects/clang380-import/usr.sbin/ypldap/yp.c Directory Properties: projects/clang380-import/ (props changed) projects/clang380-import/contrib/elftoolchain/ (props changed) projects/clang380-import/include/ (props changed) projects/clang380-import/lib/libc/ (props changed) projects/clang380-import/share/ (props changed) projects/clang380-import/sys/ (props changed) projects/clang380-import/sys/boot/ (props changed) projects/clang380-import/sys/dev/hyperv/ (props changed) projects/clang380-import/targets/ (props changed) Modified: projects/clang380-import/Makefile.inc1 ============================================================================== --- projects/clang380-import/Makefile.inc1 Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/Makefile.inc1 Sat Mar 5 15:34:54 2016 (r296410) @@ -959,6 +959,7 @@ distributeworld installworld: _installch cp $$libs $$progs ${INSTALLTMP} cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale .if defined(NO_ROOT) + -mkdir -p ${METALOG:H} echo "#${MTREE_MAGIC}" > ${METALOG} .endif .if make(distributeworld) @@ -1471,6 +1472,11 @@ ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libne _cat= bin/cat .endif +# r264059 support for status= +.if ${BOOTSTRAPPING} < 1100017 +_dd= bin/dd +.endif + # r277259 crunchide: Correct 64-bit section header offset # r281674 crunchide: always include both 32- and 64-bit ELF support # r285986 crunchen: use STRIPBIN rather than STRIP @@ -1523,13 +1529,12 @@ _kerberos5_bootstrap_tools= \ .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} .endif -.if ${MK_MANDOCDB} != "no" +# r283777 makewhatis(1) replaced with mandoc version which builds a database. +.if ${MK_MANDOCDB} != "no" && ${BOOTSTRAPPING} < 1100075 _libopenbsd?= lib/libopenbsd _makewhatis= lib/libsqlite3 \ usr.bin/mandoc ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3 -.else -_makewhatis=usr.bin/makewhatis .endif bootstrap-tools: .PHONY @@ -1546,6 +1551,7 @@ bootstrap-tools: .PHONY ${_dtc} \ ${_awk} \ ${_cat} \ + ${_dd} \ usr.bin/lorder \ ${_libopenbsd} \ ${_makewhatis} \ @@ -1906,7 +1912,16 @@ _lib_libradius= lib/libradius .endif .if ${MK_OFED} != "no" -_ofed_lib= contrib/ofed/usr.lib/ +_ofed_lib= contrib/ofed/usr.lib +_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp +_prebuild_libs+= contrib/ofed/usr.lib/libopensm +_prebuild_libs+= contrib/ofed/usr.lib/libibcommon +_prebuild_libs+= contrib/ofed/usr.lib/libibverbs +_prebuild_libs+= contrib/ofed/usr.lib/libibumad + +contrib/ofed/usr.lib/libopensm__L: lib/libthr__L +contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L +contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L .endif .if ${MK_CASPER} != "no" @@ -1919,7 +1934,7 @@ lib/liblzma__L: lib/libthr__L _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} .for _DIR in ${LOCAL_LIB_DIRS} -.if exists(${.CURDIR}/${_DIR}/Makefile) +.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR}) _generic_libs+= ${_DIR} .endif .endfor Modified: projects/clang380-import/ObsoleteFiles.inc ============================================================================== --- projects/clang380-import/ObsoleteFiles.inc Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/ObsoleteFiles.inc Sat Mar 5 15:34:54 2016 (r296410) @@ -142,6 +142,15 @@ OLD_FILES+=libexec/casper/grp OLD_FILES+=libexec/casper/pwd OLD_FILES+=libexec/casper/random OLD_FILES+=libexec/casper/sysctl +OLD_DIRS+=libexec/casper +OLD_FILES+=usr/lib/libcapsicum.a +OLD_FILES+=usr/lib/libcapsicum.so +OLD_LIBS+=lib/libcapsicum.so.0 +OLD_FILES+=usr/lib/libcapsicum_p.a +OLD_FILES+=usr/lib32/libcapsicum.a +OLD_FILES+=usr/lib32/libcapsicum.so +OLD_LIBS+=usr/lib32/libcapsicum.so.0 +OLD_FILES+=usr/lib32/libcapsicum_p.a # 20160223: functionality from mkulzma(1) merged into mkuzip(1) OLD_FILES+=usr/bin/mkulzma # 20160211: Remove obsolete unbound-control-setup Modified: projects/clang380-import/UPDATING ============================================================================== --- projects/clang380-import/UPDATING Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/UPDATING Sat Mar 5 15:34:54 2016 (r296410) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160301: + The AIO subsystem is now a standard part of the kernel. The + VFS_AIO kernel option and aio.ko kernel module have been removed. + Due to stability concerns, asynchronous I/O requests are only + permitted on sockets and raw disks by default. To enable + asynchronous I/O requests on all file types, set the + vfs.aio.enable_unsafe sysctl to a non-zero value. + 20160226: The ELF object manipulation tool objcopy is now provided by the ELF Tool Chain project rather than by GNU binutils. It should be a Modified: projects/clang380-import/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- projects/clang380-import/contrib/elftoolchain/elfcopy/sections.c Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/elftoolchain/elfcopy/sections.c Sat Mar 5 15:34:54 2016 (r296410) @@ -1522,6 +1522,9 @@ add_gnu_debuglink(struct elfcopy *ecp) err(EXIT_FAILURE, "strdup failed"); if (stat(ecp->debuglink, &sb) == -1) err(EXIT_FAILURE, "stat failed"); + if (sb.st_size == 0) + errx(EXIT_FAILURE, "empty debug link target %s", + ecp->debuglink); if ((buf = malloc(sb.st_size)) == NULL) err(EXIT_FAILURE, "malloc failed"); if ((fp = fopen(ecp->debuglink, "r")) == NULL) Modified: projects/clang380-import/contrib/ofed/libsdp/ChangeLog ============================================================================== --- projects/clang380-import/contrib/ofed/libsdp/ChangeLog Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/ofed/libsdp/ChangeLog Sat Mar 5 15:34:54 2016 (r296410) @@ -1,3 +1,24 @@ +2011-04-28 10:25:22 +0300 Amir Vadai <amirv@mellanox.co.il> + * 8cc6058 libsdp: Use logroate on /var/log/libsdp.log + +2011-01-17 15:44:30 +0200 Amir Vadai <amirv@mellanox.co.il> + * d7fdb72 libsdp: removed a debug print + +2011-01-12 11:24:57 +0200 Amir Vadai <amirv@mellanox.co.il> + * 63e0cf1 libsdp: recompiled yacc files + +2011-01-10 17:29:14 +0200 Amir Vadai <amirv@mellanox.co.il> + * 54de044 libsdp: Add IPv6 support to configuration file + +2011-01-05 09:52:05 +0200 Amir Vadai <amirv@mellanox.co.il> + * e57ee9c libsdp: Do not set-user-ID on default. + +2011-01-03 11:33:44 +0200 Amir Vadai <amirv@mellanox.co.il> + * 18447bb libsdp: Do not block other socket types + +2011-01-02 12:29:13 +0200 Amir Vadai <amirv@mellanox.co.il> + * e9d2c10 libsdp: Fix bad errno value + 2010-12-26 18:14:02 +0200 Amir Vadai <amirv@mellanox.co.il> * 9c2ad15 libsdp: full ipv6 support Modified: projects/clang380-import/contrib/ofed/libsdp/Makefile.am ============================================================================== --- projects/clang380-import/contrib/ofed/libsdp/Makefile.am Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/ofed/libsdp/Makefile.am Sat Mar 5 15:34:54 2016 (r296410) @@ -1,6 +1,6 @@ SUBDIRS = src -EXTRA_DIST = libsdp.spec.in libsdp.conf +EXTRA_DIST = libsdp.spec.in libsdp.conf scripts/libsdp.logrotate dist-hook: libsdp.spec cp libsdp.spec $(distdir) Modified: projects/clang380-import/contrib/ofed/libsdp/libsdp.conf ============================================================================== --- projects/clang380-import/contrib/ofed/libsdp/libsdp.conf Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/ofed/libsdp/libsdp.conf Sat Mar 5 15:34:54 2016 (r296410) @@ -99,11 +99,13 @@ use both client * *:* # <address|*> means: # Either the local address the server is bind to or the remote server # address the client connects to. Syntax for address matching is: -# <IPv4 address>[/<prefix_length>]|* -# IPv4 address = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ each sub number < 255 -# prefix_length = [0-9]+ and with value <= 32. A prefix_length of 24 -# matches the subnet mask 255.255.255.0 . A prefix_length of 32 -# requires matching of the exact IP. +# <IPv4/IPv6 address>[/<prefix_length>]|* +# IP address = IPv4 in dotted-quad format, "ddd.ddd.ddd.ddd" or IPv6 network +# address in any allowed IPv6 address format. +# prefix_length = Number of bits to match. A prefix_length of 16 matches the +# subnet mask 255.255.0.0 in IPv4, or ffff::0 in IPv6. +# A prefix_length of 32 for IPv4 or 128 for IPv6 requires +# matching of the exact IP. # # <port range> is: # start-port[-end-port] where port numbers are >0 and < 65536 @@ -117,6 +119,10 @@ use both client * *:* # family role program address:port[-range] # use sdp connect * 192.168.1.0/24:* # +# Use SDP by clients connecting to machines that belongs to subnet 1234:5678::* +# family role program address:port[-range] +# use sdp connect * 1234:5678::0/64:* +# # Use SDP by ttcp when it connects to port 5001 of any machine # family role program address:port[-range] # use sdp listen ttcp *:5001 Modified: projects/clang380-import/contrib/ofed/libsdp/libsdp.spec.in ============================================================================== --- projects/clang380-import/contrib/ofed/libsdp/libsdp.spec.in Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/ofed/libsdp/libsdp.spec.in Sat Mar 5 15:34:54 2016 (r296410) @@ -17,7 +17,7 @@ and without recompiling the application. %package devel Summary: Development files for the libsdp Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} +Requires: %{name} = %{version}-%{release}, logrotate %description devel Development files of libsdp that may be linked directly to an @@ -31,23 +31,29 @@ application, which may be useful for deb make %install +etc=$RPM_BUILD_ROOT%{_sysconfdir} make DESTDIR=${RPM_BUILD_ROOT} install # remove unpackaged files from the buildroot rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +mkdir -p $etc/logrotate.d +install -m 644 scripts/libsdp.logrotate $etc/logrotate.d/libsdp %clean rm -rf $RPM_BUILD_ROOT %files -%defattr(6644,root,root) +# For set-user-ID/set-group-ID ELF binaries, only libraries in the standard search directories that are also set-user-ID +# To do so, change line below to: %defattr(6644,root,root) +%defattr(0644,root,root) %{_libdir}/libsdp*.so* %defattr(0644,root,root) %config(noreplace) %{_sysconfdir}/libsdp.conf %config(noreplace) %{_includedir}/linux/sdp_inet.h %doc README NEWS ChangeLog COPYING +%config(noreplace) %{_sysconfdir}/logrotate.d/libsdp %files devel -%defattr(6644,root,root,-) +%defattr(0644,root,root,-) %{_libdir}/libsdp*.so %changelog Modified: projects/clang380-import/contrib/ofed/libsdp/src/config_parser.c ============================================================================== --- projects/clang380-import/contrib/ofed/libsdp/src/config_parser.c Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/ofed/libsdp/src/config_parser.c Sat Mar 5 15:34:54 2016 (r296410) @@ -88,7 +88,8 @@ FILENAME = 269, NAME = 270, LEVEL = 271, - LINE = 272 + LINE = 272, + SUBNET = 273 }; #endif /* Tokens. */ @@ -107,6 +108,7 @@ #define NAME 270 #define LEVEL 271 #define LINE 272 +#define SUBNET 273 @@ -147,16 +149,49 @@ int __sdp_config_empty( (__sdp_servers_family_rules_head == NULL) ); } -/* define the address by 4 integers */ -static void __sdp_set_ipv4_addr(short a0, short a1, short a2, short a3) +static void __sdp_set_ip_addr(char *addr) { - char buf[16]; - sprintf(buf,"%d.%d.%d.%d", a0, a1, a2, a3); - if (!inet_aton(buf, &( __sdp_rule.ipv4 ))) - { - parse_err = 1; - yyerror("provided address is not legal"); - } + int rc; + char *addrlen; + struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip); + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip); + int prefixlen = 0; + + addrlen = strrchr(addr, '/'); + if (addrlen) { + prefixlen = atoi(addrlen + 1); + *addrlen = '\0'; + } + + rc = inet_pton(AF_INET, addr, &addr4->sin_addr); + if (rc > 0) { + addr4->sin_family = AF_INET; + __sdp_rule.prefixlen = prefixlen ?: 32; + return; + } + + rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr); + if (rc > 0) { + addr6->sin6_family = AF_INET6; + __sdp_rule.prefixlen = prefixlen ?: 128; + return; + } + + parse_err = 1; + yyerror("provided address is not legal"); +} + +static const char *addr2str(struct sockaddr_storage *src) +{ + static char dst[INET6_ADDRSTRLEN]; + int af = src->ss_family; + const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src; + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src; + + if (af == AF_INET6) + return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN); + + return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN); } static void __sdp_set_prog_name_expr(char *prog_name_expr) @@ -184,11 +219,8 @@ static void __sdp_dump_config_state() { __sdp_get_role_str( current_role ), __sdp_rule.prog_name_expr); if (__sdp_rule.match_by_addr) { - if ( __sdp_rule.prefixlen != 32 ) sprintf(buf+strlen(buf), " %s/%d", - inet_ntoa( __sdp_rule.ipv4 ), __sdp_rule.prefixlen); - else - sprintf(buf+strlen(buf), " %s", inet_ntoa( __sdp_rule.ipv4 )); + addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen); } else { sprintf(buf+strlen(buf), " *"); } @@ -260,13 +292,13 @@ static void __sdp_add_rule() { #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 167 "./config_parser.y" +#line 197 "./config_parser.y" { int ival; char *sval; } /* Line 193 of yacc.c. */ -#line 270 "y.tab.c" +#line 302 "y.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -276,13 +308,13 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -#line 192 "./config_parser.y" +#line 223 "./config_parser.y" long __sdp_config_line_num; /* Line 216 of yacc.c. */ -#line 286 "y.tab.c" +#line 318 "y.tab.c" #ifdef short # undef short @@ -497,20 +529,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 36 +#define YYLAST 31 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 23 +#define YYNTOKENS 22 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 17 +#define YYNNTS 16 /* YYNRULES -- Number of rules. */ -#define YYNRULES 33 +#define YYNRULES 31 /* YYNRULES -- Number of states. */ -#define YYNSTATES 53 +#define YYNSTATES 44 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 272 +#define YYMAXUTOK 273 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -522,8 +554,8 @@ static const yytype_uint8 yytranslate[] 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 19, 2, 2, 22, 21, 20, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, + 2, 2, 20, 2, 2, 21, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -545,7 +577,7 @@ static const yytype_uint8 yytranslate[] 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17 + 15, 16, 17, 18 }; #if YYDEBUG @@ -555,32 +587,31 @@ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 8, 9, 11, 14, 15, 18, 20, 22, 26, 27, 30, 33, 36, 39, 43, 46, - 55, 57, 59, 61, 63, 65, 67, 69, 71, 75, - 77, 85, 87, 91 + 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, + 75, 79 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 26, 0, -1, 17, -1, 24, 17, -1, -1, 24, - -1, 25, 27, -1, -1, 27, 28, -1, 29, -1, - 33, -1, 10, 30, 24, -1, -1, 30, 31, -1, - 30, 32, -1, 11, 12, -1, 11, 13, -1, 11, - 14, 15, -1, 16, 9, -1, 3, 34, 35, 36, - 37, 18, 39, 24, -1, 6, -1, 7, -1, 8, - -1, 5, -1, 4, -1, 15, -1, 19, -1, 38, - -1, 38, 20, 9, -1, 19, -1, 9, 21, 9, - 21, 9, 21, 9, -1, 9, -1, 9, 22, 9, - -1, 19, -1 + 25, 0, -1, 17, -1, 23, 17, -1, -1, 23, + -1, 24, 26, -1, -1, 26, 27, -1, 28, -1, + 32, -1, 10, 29, 23, -1, -1, 29, 30, -1, + 29, 31, -1, 11, 12, -1, 11, 13, -1, 11, + 14, 15, -1, 16, 9, -1, 3, 33, 34, 35, + 36, 19, 37, 23, -1, 6, -1, 7, -1, 8, + -1, 5, -1, 4, -1, 15, -1, 20, -1, 18, + -1, 20, -1, 9, -1, 9, 21, 9, -1, 20, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 198, 198, 199, 201, 202, 205, 208, 209, 213, - 214, 218, 221, 222, 223, 227, 228, 229, 233, 237, - 241, 242, 243, 247, 248, 252, 253, 257, 258, 259, - 263, 267, 268, 269 + 0, 229, 229, 230, 232, 233, 236, 239, 240, 244, + 245, 249, 252, 253, 254, 258, 259, 260, 264, 268, + 272, 273, 274, 278, 279, 283, 284, 288, 289, 293, + 294, 295 }; #endif @@ -593,10 +624,10 @@ static const char *const yytname[] = "\"server or listen\"", "\"tcp\"", "\"sdp\"", "\"both\"", "\"integer value\"", "\"log statement\"", "\"destination\"", "\"stderr\"", "\"syslog\"", "\"file\"", "\"a name\"", "\"min-level\"", - "\"new line\"", "':'", "'*'", "'/'", "'.'", "'-'", "$accept", "NL", + "\"new line\"", "\"ip address\"", "':'", "'*'", "'-'", "$accept", "NL", "ONL", "config", "statements", "statement", "log_statement", "log_opts", "log_dest", "verbosity", "socket_statement", "family", "role", "program", - "address", "ipv4", "ports", 0 + "address", "ports", 0 }; #endif @@ -606,18 +637,18 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 58, 42, - 47, 46, 45 + 265, 266, 267, 268, 269, 270, 271, 272, 273, 58, + 42, 45 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 23, 24, 24, 25, 25, 26, 27, 27, 28, - 28, 29, 30, 30, 30, 31, 31, 31, 32, 33, - 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, - 38, 39, 39, 39 + 0, 22, 23, 23, 24, 24, 25, 26, 26, 27, + 27, 28, 29, 29, 29, 30, 30, 30, 31, 32, + 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, + 37, 37 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -625,8 +656,8 @@ static const yytype_uint8 yyr2[] = { 0, 2, 1, 2, 0, 1, 2, 0, 2, 1, 1, 3, 0, 2, 2, 2, 2, 3, 2, 8, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 7, 1, 3, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -637,16 +668,15 @@ static const yytype_uint8 yydefact[] = 4, 2, 5, 7, 0, 3, 6, 1, 0, 12, 8, 9, 10, 20, 21, 22, 0, 0, 24, 23, 0, 0, 0, 11, 13, 14, 25, 26, 0, 15, - 16, 0, 18, 0, 29, 0, 27, 17, 0, 0, - 0, 0, 31, 33, 0, 28, 0, 0, 19, 0, - 32, 0, 30 + 16, 0, 18, 27, 28, 0, 17, 0, 29, 31, + 0, 0, 19, 30 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 2, 3, 4, 6, 10, 11, 17, 24, 25, - 12, 16, 20, 28, 35, 36, 44 + 12, 16, 20, 28, 35, 40 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -654,19 +684,18 @@ static const yytype_int8 yydefgoto[] = #define YYPACT_NINF -18 static const yytype_int8 yypact[] = { - -13, -18, 4, -18, 22, -18, 0, -18, 9, -18, - -18, -18, -18, -18, -18, -18, 2, -3, -18, -18, - -10, 6, 14, 4, -18, -18, -18, -18, -8, -18, - -18, 10, -18, 3, -18, 8, 11, -18, 19, -7, - 20, 12, 13, -18, -13, -18, 21, 23, 4, 15, - -18, 25, -18 + -10, -18, 5, -18, 21, -18, -1, -18, 7, -18, + -18, -18, -18, -18, -18, -18, 15, -6, -18, -18, + -12, 4, 16, 5, -18, -18, -18, -18, -14, -18, + -18, 9, -18, -18, -18, 8, -18, -8, 10, -18, + -10, 17, 5, -18 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -18, -17, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18 + -18, -18, -18, -18, -18, -18 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -676,30 +705,29 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 23, 33, 42, 8, 1, 26, 18, 19, 21, 27, - 9, 34, 43, 22, 1, 13, 14, 15, 29, 30, - 31, 5, 7, 32, 38, 37, 39, 48, 41, 45, - 49, 40, 50, 46, 52, 47, 51 + 23, 38, 8, 26, 33, 21, 34, 1, 27, 9, + 22, 1, 39, 13, 14, 15, 29, 30, 31, 18, + 19, 7, 5, 42, 36, 32, 43, 37, 0, 0, + 0, 41 }; -static const yytype_uint8 yycheck[] = +static const yytype_int8 yycheck[] = { - 17, 9, 9, 3, 17, 15, 4, 5, 11, 19, - 10, 19, 19, 16, 17, 6, 7, 8, 12, 13, - 14, 17, 0, 9, 21, 15, 18, 44, 9, 9, - 9, 20, 9, 21, 9, 22, 21 + 17, 9, 3, 15, 18, 11, 20, 17, 20, 10, + 16, 17, 20, 6, 7, 8, 12, 13, 14, 4, + 5, 0, 17, 40, 15, 9, 9, 19, -1, -1, + -1, 21 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 17, 24, 25, 26, 17, 27, 0, 3, 10, - 28, 29, 33, 6, 7, 8, 34, 30, 4, 5, - 35, 11, 16, 24, 31, 32, 15, 19, 36, 12, - 13, 14, 9, 9, 19, 37, 38, 15, 21, 18, - 20, 9, 9, 19, 39, 9, 21, 22, 24, 9, - 9, 21, 9 + 0, 17, 23, 24, 25, 17, 26, 0, 3, 10, + 27, 28, 32, 6, 7, 8, 33, 29, 4, 5, + 34, 11, 16, 23, 30, 31, 15, 20, 35, 12, + 13, 14, 9, 18, 20, 36, 15, 19, 9, 20, + 37, 21, 23, 9 }; #define yyerrok (yyerrstatus = 0) @@ -1514,103 +1542,93 @@ yyreduce: switch (yyn) { case 15: -#line 227 "./config_parser.y" +#line 258 "./config_parser.y" { __sdp_log_set_log_stderr(); } break; case 16: -#line 228 "./config_parser.y" +#line 259 "./config_parser.y" { __sdp_log_set_log_syslog(); } break; case 17: -#line 229 "./config_parser.y" +#line 260 "./config_parser.y" { __sdp_log_set_log_file((yyvsp[(3) - (3)].sval)); } break; case 18: -#line 233 "./config_parser.y" +#line 264 "./config_parser.y" { __sdp_log_set_min_level((yyvsp[(2) - (2)].ival)); } break; case 19: -#line 237 "./config_parser.y" +#line 268 "./config_parser.y" { __sdp_add_rule(); } break; case 20: -#line 241 "./config_parser.y" +#line 272 "./config_parser.y" { __sdp_rule.target_family = USE_TCP; } break; case 21: -#line 242 "./config_parser.y" +#line 273 "./config_parser.y" { __sdp_rule.target_family = USE_SDP; } break; case 22: -#line 243 "./config_parser.y" +#line 274 "./config_parser.y" { __sdp_rule.target_family = USE_BOTH; } break; case 23: -#line 247 "./config_parser.y" +#line 278 "./config_parser.y" { current_role = 1; } break; case 24: -#line 248 "./config_parser.y" +#line 279 "./config_parser.y" { current_role = 2; } break; case 25: -#line 252 "./config_parser.y" +#line 283 "./config_parser.y" { __sdp_set_prog_name_expr((yyvsp[(1) - (1)].sval)); } break; case 26: -#line 253 "./config_parser.y" +#line 284 "./config_parser.y" { __sdp_set_prog_name_expr("*"); } break; case 27: -#line 257 "./config_parser.y" - { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = 32; } +#line 288 "./config_parser.y" + { __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr((yyvsp[(1) - (1)].sval)); } break; case 28: -#line 258 "./config_parser.y" - { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = (yyvsp[(3) - (3)].ival); } - break; - - case 29: -#line 259 "./config_parser.y" +#line 289 "./config_parser.y" { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; } break; - case 30: -#line 263 "./config_parser.y" - { __sdp_set_ipv4_addr((yyvsp[(1) - (7)].ival),(yyvsp[(3) - (7)].ival),(yyvsp[(5) - (7)].ival),(yyvsp[(7) - (7)].ival)); } - break; - - case 31: -#line 267 "./config_parser.y" + case 29: +#line 293 "./config_parser.y" { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (1)].ival); __sdp_rule.eport= (yyvsp[(1) - (1)].ival); } break; - case 32: -#line 268 "./config_parser.y" + case 30: +#line 294 "./config_parser.y" { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (3)].ival); __sdp_rule.eport= (yyvsp[(3) - (3)].ival); } break; - case 33: -#line 269 "./config_parser.y" + case 31: +#line 295 "./config_parser.y" { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; } break; /* Line 1267 of yacc.c. */ -#line 1614 "y.tab.c" +#line 1632 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1824,7 +1842,7 @@ yyreturn: } -#line 272 "./config_parser.y" +#line 298 "./config_parser.y" int yyerror(char *msg) Modified: projects/clang380-import/contrib/ofed/libsdp/src/config_parser.h ============================================================================== --- projects/clang380-import/contrib/ofed/libsdp/src/config_parser.h Sat Mar 5 15:07:25 2016 (r296409) +++ projects/clang380-import/contrib/ofed/libsdp/src/config_parser.h Sat Mar 5 15:34:54 2016 (r296410) @@ -53,7 +53,8 @@ FILENAME = 269, NAME = 270, LEVEL = 271, - LINE = 272 + LINE = 272, + SUBNET = 273 }; #endif /* Tokens. */ @@ -72,19 +73,20 @@ #define NAME 270 #define LEVEL 271 #define LINE 272 +#define SUBNET 273 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 167 "./config_parser.y" +#line 197 "./config_parser.y" { int ival; char *sval; } /* Line 1529 of yacc.c. */ -#line 88 "y.tab.h" +#line 90 "y.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 Copied: projects/clang380-import/contrib/ofed/libsdp/src/config_parser.y (from r296409, head/contrib/ofed/libsdp/src/config_parser.y) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang380-import/contrib/ofed/libsdp/src/config_parser.y Sat Mar 5 15:34:54 2016 (r296410, copy of r296409, head/contrib/ofed/libsdp/src/config_parser.y) @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2006 Mellanox Technologies Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: config_parser.y 1.5 2005/06/29 11:39:27 eitan Exp $ + */ + + +/* + +*/ +%{ + +/* header section */ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "libsdp.h" +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +#define YYERROR_VERBOSE 1 + +extern int yyerror(char *msg); +extern int yylex(void); +static int parse_err = 0; + +struct use_family_rule *__sdp_clients_family_rules_head = NULL; +struct use_family_rule *__sdp_clients_family_rules_tail = NULL; +struct use_family_rule *__sdp_servers_family_rules_head = NULL; +struct use_family_rule *__sdp_servers_family_rules_tail = NULL; + +/* some globals to store intermidiate parser state */ +static struct use_family_rule __sdp_rule; +static int current_role = 0; + +int __sdp_config_empty( + void + ) +{ + return ( (__sdp_clients_family_rules_head == NULL) && + (__sdp_servers_family_rules_head == NULL) ); +} + +static void __sdp_set_ip_addr(char *addr) +{ + int rc; + char *addrlen; + struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip); + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip); + int prefixlen = 0; + + addrlen = strrchr(addr, '/'); + if (addrlen) { + prefixlen = atoi(addrlen + 1); + *addrlen = '\0'; + } + + rc = inet_pton(AF_INET, addr, &addr4->sin_addr); + if (rc > 0) { + addr4->sin_family = AF_INET; + __sdp_rule.prefixlen = prefixlen ?: 32; + return; + } + + rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr); + if (rc > 0) { + addr6->sin6_family = AF_INET6; + __sdp_rule.prefixlen = prefixlen ?: 128; + return; + } + + parse_err = 1; + yyerror("provided address is not legal"); +} + +static const char *addr2str(struct sockaddr_storage *src) +{ + static char dst[INET6_ADDRSTRLEN]; + int af = src->ss_family; + const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src; + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src; + + if (af == AF_INET6) + return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN); + + return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN); +} + +static void __sdp_set_prog_name_expr(char *prog_name_expr) +{ + __sdp_rule.prog_name_expr = strdup(prog_name_expr); + if (!__sdp_rule.prog_name_expr) { + yyerror("fail to allocate program name expression"); + } +} + +static char *__sdp_get_role_str(int role) +{ + if (role == 1) return("server"); + if (role == 2) return("client"); + return("unknown role"); +} + +extern int __sdp_min_level; + +/* dump the current state in readable format */ +static void __sdp_dump_config_state() { + char buf[1024]; + sprintf(buf, "CONFIG: use %s %s %s", + __sdp_get_family_str(__sdp_rule.target_family), + __sdp_get_role_str( current_role ), + __sdp_rule.prog_name_expr); + if (__sdp_rule.match_by_addr) { + sprintf(buf+strlen(buf), " %s/%d", + addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen); + } else { + sprintf(buf+strlen(buf), " *"); + } + if (__sdp_rule.match_by_port) { + sprintf(buf+strlen(buf), ":%d",__sdp_rule.sport); + if (__sdp_rule.eport > __sdp_rule.sport) + sprintf(buf+strlen(buf), "-%d",__sdp_rule.eport); + } + else + sprintf(buf+strlen(buf), ":*"); + sprintf(buf+strlen(buf), "\n"); + __sdp_log(1, buf); +} + +/* use the above state for making a new rule */ +static void __sdp_add_rule() { + struct use_family_rule **p_tail, **p_head, *rule; + + if (__sdp_min_level <= 1) __sdp_dump_config_state(); + if ( current_role == 1 ) { + p_tail = &__sdp_servers_family_rules_tail; + p_head = &__sdp_servers_family_rules_head; + } else if ( current_role == 2 ) { + p_tail = &__sdp_clients_family_rules_tail; + p_head = &__sdp_clients_family_rules_head; + } else { + yyerror("ignoring unknown role"); + parse_err = 1; + return; + } + + rule = (struct use_family_rule *)malloc(sizeof(*rule)); + if (!rule) { + yyerror("fail to allocate new rule"); + parse_err = 1; + return; + } + + memset(rule, 0, sizeof(*rule)); + *rule = __sdp_rule; + rule->prev = *p_tail; + if (!(*p_head)) { + *p_head = rule; + } else { + (*p_tail)->next = rule; + } /* if */ + *p_tail = rule; +} + +%} + + +%union { + int ival; + char *sval; +} +%token USE "use" +%token CLIENT "client or connect" +%token SERVER "server or listen" +%token TCP "tcp" +%token SDP "sdp" +%token BOTH "both" +%token INT "integer value" +%token LOG "log statement" +%token DEST "destination" +%token STDERR "stderr" +%token SYSLOG "syslog" +%token FILENAME "file" +%token NAME "a name" +%token LEVEL "min-level" +%token LINE "new line" +%token SUBNET "ip address" +%type <sval> NAME SUBNET +%type <ival> INT LOG DEST STDERR SYSLOG FILENAME USE TCP SDP BOTH CLIENT SERVER LEVEL LINE +%debug +%error-verbose +%start config + +%{ + long __sdp_config_line_num; +%} +%% + +NL: + LINE + | NL LINE; + +ONL: + | NL; + +config: + ONL statements *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603051534.u25FYsda063647>