Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Mar 2016 22:37:31 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r296402 - in head/contrib/ofed: libsdp libsdp/scripts libsdp/src usr.lib/libsdp
Message-ID:  <201603042237.u24MbVHk053024@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Fri Mar  4 22:37:31 2016
New Revision: 296402
URL: https://svnweb.freebsd.org/changeset/base/296402

Log:
  Update libsdp to the latest 1.1.108-0.17.ga6958ef.
  
  The only relevant change here is the support for IPv6 in the config
  file.  The previous version of this supported IPv6 but not in the
  config.  The change for that ended up removing __sdp_sockaddr_to_sdp
  which the IPV4 config code required; the IPv6 fix resolved the lack of
  that symbol.
  
  Note that the ChangeLog was lacking entries for which we already had the
  changes for, which itself was an upstream bug.
  
  Obtained from:	https://www.openfabrics.org/downloads/libsdp/libsdp-1.1.108-0.17.ga6958ef.tar.gz
  Sponsored by:	EMC / Isilon Storage Division

Added:
  head/contrib/ofed/libsdp/scripts/
  head/contrib/ofed/libsdp/scripts/libsdp.logrotate
  head/contrib/ofed/libsdp/src/config_parser.y
  head/contrib/ofed/libsdp/src/config_scanner.l
Modified:
  head/contrib/ofed/libsdp/ChangeLog
  head/contrib/ofed/libsdp/Makefile.am
  head/contrib/ofed/libsdp/libsdp.conf
  head/contrib/ofed/libsdp/libsdp.spec.in
  head/contrib/ofed/libsdp/src/config_parser.c
  head/contrib/ofed/libsdp/src/config_parser.h
  head/contrib/ofed/libsdp/src/config_scanner.c
  head/contrib/ofed/libsdp/src/libsdp.h
  head/contrib/ofed/libsdp/src/match.c
  head/contrib/ofed/libsdp/src/port.c
  head/contrib/ofed/usr.lib/libsdp/Makefile

Modified: head/contrib/ofed/libsdp/ChangeLog
==============================================================================
--- head/contrib/ofed/libsdp/ChangeLog	Fri Mar  4 22:37:25 2016	(r296401)
+++ head/contrib/ofed/libsdp/ChangeLog	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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: head/contrib/ofed/libsdp/Makefile.am
==============================================================================
--- head/contrib/ofed/libsdp/Makefile.am	Fri Mar  4 22:37:25 2016	(r296401)
+++ head/contrib/ofed/libsdp/Makefile.am	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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: head/contrib/ofed/libsdp/libsdp.conf
==============================================================================
--- head/contrib/ofed/libsdp/libsdp.conf	Fri Mar  4 22:37:25 2016	(r296401)
+++ head/contrib/ofed/libsdp/libsdp.conf	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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: head/contrib/ofed/libsdp/libsdp.spec.in
==============================================================================
--- head/contrib/ofed/libsdp/libsdp.spec.in	Fri Mar  4 22:37:25 2016	(r296401)
+++ head/contrib/ofed/libsdp/libsdp.spec.in	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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

Added: head/contrib/ofed/libsdp/scripts/libsdp.logrotate
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/ofed/libsdp/scripts/libsdp.logrotate	Fri Mar  4 22:37:31 2016	(r296402)
@@ -0,0 +1,6 @@
+/var/log/libsdp.log {
+	missingok
+	notifempty
+	copytruncate
+	compress
+}

Modified: head/contrib/ofed/libsdp/src/config_parser.c
==============================================================================
--- head/contrib/ofed/libsdp/src/config_parser.c	Fri Mar  4 22:37:25 2016	(r296401)
+++ head/contrib/ofed/libsdp/src/config_parser.c	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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: head/contrib/ofed/libsdp/src/config_parser.h
==============================================================================
--- head/contrib/ofed/libsdp/src/config_parser.h	Fri Mar  4 22:37:25 2016	(r296401)
+++ head/contrib/ofed/libsdp/src/config_parser.h	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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

Added: head/contrib/ofed/libsdp/src/config_parser.y
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/ofed/libsdp/src/config_parser.y	Fri Mar  4 22:37:31 2016	(r296402)
@@ -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
+  ;
+
+statements:
+  | statements statement
+  ;
+
+statement: 
+    log_statement
+  | socket_statement
+  ;
+
+log_statement: 
+    LOG log_opts NL
+  ;
+
+log_opts:
+  | log_opts log_dest
+  | log_opts verbosity
+  ;
+
+log_dest: 
+    DEST STDERR        { __sdp_log_set_log_stderr(); }
+  | DEST SYSLOG        { __sdp_log_set_log_syslog(); }
+  | DEST FILENAME NAME { __sdp_log_set_log_file($3); }
+  ;
+    
+verbosity: 
+    LEVEL INT { __sdp_log_set_min_level($2); }
+  ;
+
+socket_statement: 
+    USE family role program address ':' ports NL { __sdp_add_rule(); }
+  ;
+
+family:
+    TCP  { __sdp_rule.target_family = USE_TCP; }
+  | SDP  { __sdp_rule.target_family = USE_SDP; }
+  | BOTH { __sdp_rule.target_family = USE_BOTH; }
+  ;
+
+role:
+    SERVER { current_role = 1; }
+  | CLIENT { current_role = 2; }
+  ;
+
+program:
+    NAME { __sdp_set_prog_name_expr($1); }
+  | '*'  { __sdp_set_prog_name_expr("*"); }
+  ;
+
+address:
+    SUBNET       { __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr($1); }
+  | '*'          { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; }
+  ;
+
+ports:
+    INT         { __sdp_rule.match_by_port = 1; __sdp_rule.sport= $1; __sdp_rule.eport= $1; }
+  | INT '-' INT { __sdp_rule.match_by_port = 1; __sdp_rule.sport= $1; __sdp_rule.eport= $3; }
+  | '*'         { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; }
+  ;
+
+%%
+
+int yyerror(char *msg)
+{
+	/* replace the $undefined and $end if exists */
+	char *orig_msg = (char*)malloc(strlen(msg)+25);
+	char *final_msg = (char*)malloc(strlen(msg)+25);
+
+	strcpy(orig_msg, msg);
+	
+	char *word = strtok(orig_msg, " ");
+	final_msg[0] = '\0';
+	while (word != NULL) {
+		if (!strncmp(word, "$undefined", 10)) {
+			strcat(final_msg, "unrecognized-token ");
+		} else if (!strncmp(word, "$end",4)) {
+			strcat(final_msg, "end-of-file ");
+		} else {
+			strcat(final_msg, word);
+			strcat(final_msg, " ");
+		}
+		word = strtok(NULL, " ");
+	}
+	
+	__sdp_log(9, "Error (line:%ld) : %s\n", __sdp_config_line_num, final_msg);
+	parse_err = 1;
+	
+	free(orig_msg);
+	free(final_msg);
+	return 1;
+}
+
+#include <unistd.h>
+#include <errno.h>
+
+/* parse apollo route dump file */
+int __sdp_parse_config (const char *fileName) {
+  extern FILE * libsdp_yyin;
+   
+  /* open the file */
+  if (access(fileName, R_OK)) {
+	 printf("libsdp Error: No access to open File:%s %s\n", 
+           fileName, strerror(errno));
+	 return(1);
+  }
+
+  libsdp_yyin = fopen(fileName,"r");
+  if (!libsdp_yyin) {
+	 printf("libsdp Error: Fail to open File:%s\n", fileName);
+	 return(1);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603042237.u24MbVHk053024>