CVS commit: src/usr.sbin/ldpd
Module Name:src Committed By: kefren Date: Fri Aug 2 07:29:56 UTC 2013 Modified Files: src/usr.sbin/ldpd: ldp_command.c ldp_peer.c ldp_peer.h mpls_interface.c Log Message: Use rbtree for storing peers FEC label bindings To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/ldpd/ldp_command.c cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/ldpd/ldp_peer.c cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/ldpd/ldp_peer.h cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/ldpd/mpls_interface.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ldpd/ldp_command.c diff -u src/usr.sbin/ldpd/ldp_command.c:1.13 src/usr.sbin/ldpd/ldp_command.c:1.14 --- src/usr.sbin/ldpd/ldp_command.c:1.13 Wed Jul 31 06:58:23 2013 +++ src/usr.sbin/ldpd/ldp_command.c Fri Aug 2 07:29:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ldp_command.c,v 1.13 2013/07/31 06:58:23 kefren Exp $ */ +/* $NetBSD: ldp_command.c,v 1.14 2013/08/02 07:29:56 kefren Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -481,12 +481,12 @@ int show_labels(int s, char *recvspace) { struct ldp_peer *p; - struct label_mapping *lm; + struct label_mapping *lm = NULL; SLIST_FOREACH(p, ldp_peer_head, peers) { if (p-state != LDP_PEER_ESTABLISHED) continue; - SLIST_FOREACH(lm, p-label_mapping_head, mappings) { + while ((lm = ldp_peer_lm_right(p, lm)) != NULL) { char lma[256]; /* XXX: TODO */ if (lm-address.sa.sa_family != AF_INET) Index: src/usr.sbin/ldpd/ldp_peer.c diff -u src/usr.sbin/ldpd/ldp_peer.c:1.15 src/usr.sbin/ldpd/ldp_peer.c:1.16 --- src/usr.sbin/ldpd/ldp_peer.c:1.15 Sat Jul 20 05:16:08 2013 +++ src/usr.sbin/ldpd/ldp_peer.c Fri Aug 2 07:29:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ldp_peer.c,v 1.15 2013/07/20 05:16:08 kefren Exp $ */ +/* $NetBSD: ldp_peer.c,v 1.16 2013/08/02 07:29:56 kefren Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ #include fcntl.h #include stdlib.h #include strings.h +#include stddef.h #include stdio.h #include unistd.h @@ -55,6 +56,17 @@ extern int ldp_holddown_time; +static struct label_mapping *ldp_peer_get_lm(struct ldp_peer *, +const struct sockaddr *, uint); + +static int mappings_compare(void *, const void *, const void *); +static rb_tree_ops_t mappings_tree_ops = { + .rbto_compare_nodes = mappings_compare, + .rbto_compare_key = mappings_compare, + .rbto_node_offset = offsetof(struct label_mapping, mappings_node), + .rbto_context = NULL +}; + void ldp_peer_init(void) { @@ -69,6 +81,28 @@ sockaddr_cmp(const struct sockaddr *a, c return -1; return memcmp(a, b, a-sa_len); } + +static int +mappings_compare(void *context, const void *node1, const void *node2) +{ + const struct label_mapping *l1 = node1, *l2 = node2; + int ret; + + if (__predict_false(l1-address.sa.sa_family != + l2-address.sa.sa_family)) + return l1-address.sa.sa_family l2-address.sa.sa_family ? + 1 : -1; + + assert(l1-address.sa.sa_len == l2-address.sa.sa_len); + if ((ret = memcmp(l1-address.sa, l2-address.sa, l1-address.sa.sa_len)) != 0) + return ret; + + if (__predict_false(l1-prefix != l2-prefix)) + return l1-prefix l2-prefix ? 1 : -1; + + return 0; +} + /* * soc should be 1 if there is already a TCP socket for this else we'll * initiate a new one @@ -150,7 +184,7 @@ ldp_peer_new(const struct in_addr * ldp_ set_ttl(p-socket); } SLIST_INIT(p-ldp_peer_address_head); - SLIST_INIT(p-label_mapping_head); + rb_tree_init(p-label_mapping_tree, mappings_tree_ops); p-timeout = p-holdtime; sopts = fcntl(p-socket, F_GETFL); @@ -449,7 +483,7 @@ ldp_peer_add_mapping(struct ldp_peer * p lma-prefix = prefix; lma-label = label; - SLIST_INSERT_HEAD(p-label_mapping_head, lma, mappings); + rb_tree_insert_node(p-label_mapping_tree, lma); return LDP_E_OK; } @@ -460,34 +494,28 @@ ldp_peer_delete_mapping(struct ldp_peer { struct label_mapping *lma; - if (!a) + if (a == NULL || (lma = ldp_peer_get_lm(p, a, prefix)) == NULL) return LDP_E_NOENT; - lma = ldp_peer_get_lm(p, a, prefix); - if (!lma) - return LDP_E_NOENT; - - SLIST_REMOVE(p-label_mapping_head, lma, label_mapping, mappings); + rb_tree_remove_node(p-label_mapping_tree, lma); free(lma); return LDP_E_OK; } -struct label_mapping * -ldp_peer_get_lm(const struct ldp_peer * p, const struct sockaddr * a, +static struct label_mapping * +ldp_peer_get_lm(struct ldp_peer * p, const struct sockaddr * a, uint prefix) { - struct label_mapping *rv; + struct label_mapping rv; - if (!p) - return NULL; - - SLIST_FOREACH(rv, p-label_mapping_head, mappings) - if (rv-prefix == prefix sockaddr_cmp(a, rv-address.sa)==0) - break; + assert(a-sa_len = sizeof(union sockunion)); - return rv; + memset(rv, 0, sizeof(rv)); + memcpy(rv.address.sa, a, a-sa_len); + rv.prefix = prefix; + return rb_tree_find_node(p-label_mapping_tree, rv); } void @@ -495,9 +523,8 @@
CVS commit: src/lib/libc/sys
Module Name:src Committed By: elric Date: Fri Aug 2 14:10:46 UTC 2013 Modified Files: src/lib/libc/sys: accept.2 Log Message: Update accept(2) to indicate that paccept honours SOCK_NOSIGPIPE in its flags argument. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/lib/libc/sys/accept.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/accept.2 diff -u src/lib/libc/sys/accept.2:1.29 src/lib/libc/sys/accept.2:1.30 --- src/lib/libc/sys/accept.2:1.29 Mon Mar 19 09:34:36 2012 +++ src/lib/libc/sys/accept.2 Fri Aug 2 14:10:46 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: accept.2,v 1.29 2012/03/19 09:34:36 plunky Exp $ +.\ $NetBSD: accept.2,v 1.30 2013/08/02 14:10:46 elric Exp $ .\ .\ Copyright (c) 1983, 1990, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -147,6 +147,8 @@ on the returned file descriptor: Set the close on exec property. .It Dv SOCK_NONBLOCK Sets non-blocking I/O. +.It Dv SOCK_NOSIGPIPE +Return EPIPE instead of raising SIGPIPE. .El .Pp It can also temporarily replace the signal mask of the calling thread if
CVS commit: src/usr.sbin/ldpd
Module Name:src Committed By: martin Date: Fri Aug 2 16:51:25 UTC 2013 Modified Files: src/usr.sbin/ldpd: mpls_routes.h Log Message: Do not pack struct rt_msg - this voids the alignement restrictions and causes crashes on alignemen critical archs. From Matt Thomas. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/ldpd/mpls_routes.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ldpd/mpls_routes.h diff -u src/usr.sbin/ldpd/mpls_routes.h:1.6 src/usr.sbin/ldpd/mpls_routes.h:1.7 --- src/usr.sbin/ldpd/mpls_routes.h:1.6 Thu Jul 18 11:45:36 2013 +++ src/usr.sbin/ldpd/mpls_routes.h Fri Aug 2 16:51:25 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mpls_routes.h,v 1.6 2013/07/18 11:45:36 kefren Exp $ */ +/* $NetBSD: mpls_routes.h,v 1.7 2013/08/02 16:51:25 martin Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ union sockunion { struct rt_msg { struct rt_msghdr m_rtm; charm_space[512]; -} __packed; +}; union sockunion * make_inet_union(const char *); union sockunion * make_mpls_union(uint32_t);
CVS commit: src/sys/kern
Module Name:src Committed By: spz Date: Fri Aug 2 20:00:33 UTC 2013 Modified Files: src/sys/kern: uipc_socket.c Log Message: Fix an inversion in checking for authorization to drop TCP connections found (and the obvious fix suggested) by Sander Bos. To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/sys/kern/uipc_socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.215 src/sys/kern/uipc_socket.c:1.216 --- src/sys/kern/uipc_socket.c:1.215 Mon Apr 8 21:12:33 2013 +++ src/sys/kern/uipc_socket.c Fri Aug 2 20:00:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.215 2013/04/08 21:12:33 skrll Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.216 2013/08/02 20:00:33 spz Exp $ */ /*- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.215 2013/04/08 21:12:33 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.216 2013/08/02 20:00:33 spz Exp $); #include opt_compat_netbsd.h #include opt_sock_counters.h @@ -416,7 +416,7 @@ socket_listener_cb(kauth_cred_t cred, ka /* Normal users can only drop their own connections. */ struct socket *so = (struct socket *)arg1; - if (proc_uidmatch(cred, so-so_cred)) + if (proc_uidmatch(cred, so-so_cred) == 0) result = KAUTH_RESULT_ALLOW; break;
CVS commit: src/lib/libc/sys
Module Name:src Committed By: wiz Date: Fri Aug 2 20:13:09 UTC 2013 Modified Files: src/lib/libc/sys: accept.2 Log Message: Use more markup and improve table formatting. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/lib/libc/sys/accept.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/accept.2 diff -u src/lib/libc/sys/accept.2:1.30 src/lib/libc/sys/accept.2:1.31 --- src/lib/libc/sys/accept.2:1.30 Fri Aug 2 14:10:46 2013 +++ src/lib/libc/sys/accept.2 Fri Aug 2 20:13:09 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: accept.2,v 1.30 2013/08/02 14:10:46 elric Exp $ +.\ $NetBSD: accept.2,v 1.31 2013/08/02 20:13:09 wiz Exp $ .\ .\ Copyright (c) 1983, 1990, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -142,13 +142,16 @@ function behaves exactly like but it also allows to set the following .Fa flags on the returned file descriptor: -.Bl -column SOCK_NONBLOCK -offset indent +.Bl -tag -width SOCK_NOSIGPIPEXX -offset indent .It Dv SOCK_CLOEXEC Set the close on exec property. .It Dv SOCK_NONBLOCK Sets non-blocking I/O. .It Dv SOCK_NOSIGPIPE -Return EPIPE instead of raising SIGPIPE. +Return +.Er EPIPE +instead of raising +.Dv SIGPIPE . .El .Pp It can also temporarily replace the signal mask of the calling thread if
CVS commit: [netbsd-6] src
Module Name:src Committed By: martin Date: Fri Aug 2 20:12:30 UTC 2013 Modified Files: src/doc [netbsd-6]: CHANGES-6.2 src/sys/kern [netbsd-6]: uipc_socket.c Log Message: Pullup ticket #927: sys/kern/uipc_socket.c 1.216 Fix an inversion in checking for authorization to drop TCP connections found (and the obvious fix suggested) by Sander Bos. Requested by spz. To generate a diff of this commit: cvs rdiff -u -r1.1.2.27 -r1.1.2.28 src/doc/CHANGES-6.2 cvs rdiff -u -r1.209.2.2 -r1.209.2.3 src/sys/kern/uipc_socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-6.2 diff -u src/doc/CHANGES-6.2:1.1.2.27 src/doc/CHANGES-6.2:1.1.2.28 --- src/doc/CHANGES-6.2:1.1.2.27 Tue Jul 30 08:22:28 2013 +++ src/doc/CHANGES-6.2 Fri Aug 2 20:12:30 2013 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-6.2,v 1.1.2.27 2013/07/30 08:22:28 msaitoh Exp $ +# $NetBSD: CHANGES-6.2,v 1.1.2.28 2013/08/02 20:12:30 martin Exp $ A complete list of changes from the 6.1 release until the 6.2 release: @@ -451,3 +451,8 @@ include/res_update.h1.8 Restore libresolv missing bits, including NS updates. [manu, ticket #887] + +sys/kern/uipc_socket.c1.216 + Fix an inversion in checking for authorization to drop TCP connections + found (and the obvious fix suggested) by Sander Bos. + [spz, ticket #927] Index: src/sys/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.209.2.2 src/sys/kern/uipc_socket.c:1.209.2.3 --- src/sys/kern/uipc_socket.c:1.209.2.2 Thu Feb 14 22:13:59 2013 +++ src/sys/kern/uipc_socket.c Fri Aug 2 20:12:30 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.209.2.2 2013/02/14 22:13:59 jdc Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.209.2.3 2013/08/02 20:12:30 martin Exp $ */ /*- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209.2.2 2013/02/14 22:13:59 jdc Exp $); +__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209.2.3 2013/08/02 20:12:30 martin Exp $); #include opt_compat_netbsd.h #include opt_sock_counters.h @@ -416,7 +416,7 @@ socket_listener_cb(kauth_cred_t cred, ka /* Normal users can only drop their own connections. */ struct socket *so = (struct socket *)arg1; - if (proc_uidmatch(cred, so-so_cred)) + if (proc_uidmatch(cred, so-so_cred) == 0) result = KAUTH_RESULT_ALLOW; break;
CVS commit: [netbsd-6-1] src
Module Name:src Committed By: martin Date: Fri Aug 2 20:18:48 UTC 2013 Modified Files: src/doc [netbsd-6-1]: CHANGES-6.1.1 src/sys/kern [netbsd-6-1]: uipc_socket.c Log Message: Pullup ticket #927: sys/kern/uipc_socket.c 1.216 Fix an inversion in checking for authorization to drop TCP connections found (and the obvious fix suggested) by Sander Bos. Requested by spz. To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/doc/CHANGES-6.1.1 cvs rdiff -u -r1.209.2.2 -r1.209.2.2.2.1 src/sys/kern/uipc_socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-6.1.1 diff -u src/doc/CHANGES-6.1.1:1.1.2.15 src/doc/CHANGES-6.1.1:1.1.2.16 --- src/doc/CHANGES-6.1.1:1.1.2.15 Tue Jul 30 04:08:45 2013 +++ src/doc/CHANGES-6.1.1 Fri Aug 2 20:18:48 2013 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-6.1.1,v 1.1.2.15 2013/07/30 04:08:45 msaitoh Exp $ +# $NetBSD: CHANGES-6.1.1,v 1.1.2.16 2013/08/02 20:18:48 martin Exp $ A complete list of changes from the NetBSD 6.1 release to the NetBSD 6.1.1 release: @@ -168,3 +168,9 @@ sys/net/if_mpls.c1.9 Stop abusing kmem during softint context to prevent panic. [kefren, ticket #921] + +sys/kern: uipc_socket.c1.216 + + Fix an inversion in checking for authorization to drop TCP connections + found (and the obvious fix suggested) by Sander Bos. + [spz, ticket #927] Index: src/sys/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.209.2.2 src/sys/kern/uipc_socket.c:1.209.2.2.2.1 --- src/sys/kern/uipc_socket.c:1.209.2.2 Thu Feb 14 22:13:59 2013 +++ src/sys/kern/uipc_socket.c Fri Aug 2 20:18:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.209.2.2 2013/02/14 22:13:59 jdc Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.209.2.2.2.1 2013/08/02 20:18:48 martin Exp $ */ /*- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209.2.2 2013/02/14 22:13:59 jdc Exp $); +__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209.2.2.2.1 2013/08/02 20:18:48 martin Exp $); #include opt_compat_netbsd.h #include opt_sock_counters.h @@ -416,7 +416,7 @@ socket_listener_cb(kauth_cred_t cred, ka /* Normal users can only drop their own connections. */ struct socket *so = (struct socket *)arg1; - if (proc_uidmatch(cred, so-so_cred)) + if (proc_uidmatch(cred, so-so_cred) == 0) result = KAUTH_RESULT_ALLOW; break;
CVS commit: [netbsd-6-0] src
Module Name:src Committed By: martin Date: Fri Aug 2 20:23:11 UTC 2013 Modified Files: src/doc [netbsd-6-0]: CHANGES-6.0.3 src/sys/kern [netbsd-6-0]: uipc_socket.c Log Message: Pullup ticket #927: sys/kern/uipc_socket.c 1.216 Fix an inversion in checking for authorization to drop TCP connections found (and the obvious fix suggested) by Sander Bos. Requested by spz. To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/doc/CHANGES-6.0.3 cvs rdiff -u -r1.209.2.1 -r1.209.2.1.4.1 src/sys/kern/uipc_socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-6.0.3 diff -u src/doc/CHANGES-6.0.3:1.1.2.15 src/doc/CHANGES-6.0.3:1.1.2.16 --- src/doc/CHANGES-6.0.3:1.1.2.15 Tue Jul 30 04:09:45 2013 +++ src/doc/CHANGES-6.0.3 Fri Aug 2 20:23:11 2013 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-6.0.3,v 1.1.2.15 2013/07/30 04:09:45 msaitoh Exp $ +# $NetBSD: CHANGES-6.0.3,v 1.1.2.16 2013/08/02 20:23:11 martin Exp $ A complete list of changes from the NetBSD 6.0.2 release to the NetBSD 6.0.3 release: @@ -162,3 +162,9 @@ sys/net/if_mpls.c1.9 Stop abusing kmem during softint context to prevent panic. [kefren, ticket #921] + +sys/kern/uipc_socket.c1.216 + + Fix an inversion in checking for authorization to drop TCP connections + found (and the obvious fix suggested) by Sander Bos. + [spz, ticket #927] Index: src/sys/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.209.2.1 src/sys/kern/uipc_socket.c:1.209.2.1.4.1 --- src/sys/kern/uipc_socket.c:1.209.2.1 Thu Jul 12 17:11:17 2012 +++ src/sys/kern/uipc_socket.c Fri Aug 2 20:23:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.209.2.1 2012/07/12 17:11:17 riz Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.209.2.1.4.1 2013/08/02 20:23:11 martin Exp $ */ /*- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209.2.1 2012/07/12 17:11:17 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.209.2.1.4.1 2013/08/02 20:23:11 martin Exp $); #include opt_compat_netbsd.h #include opt_sock_counters.h @@ -416,7 +416,7 @@ socket_listener_cb(kauth_cred_t cred, ka /* Normal users can only drop their own connections. */ struct socket *so = (struct socket *)arg1; - if (proc_uidmatch(cred, so-so_cred)) + if (proc_uidmatch(cred, so-so_cred) == 0) result = KAUTH_RESULT_ALLOW; break;