1/*- 2 * Copyright (c) 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 |
30 * $FreeBSD: head/sys/net/rtsock.c 193232 2009-06-01 15:49:42Z bz $ |
31 */ 32#include "opt_sctp.h" 33#include "opt_mpath.h" 34#include "opt_route.h" 35#include "opt_inet.h" 36#include "opt_inet6.h" 37 38#include <sys/param.h> --- 416 unchanged lines hidden (view full) --- 455 return (0); 456} 457 458/*ARGSUSED*/ 459static int 460route_output(struct mbuf *m, struct socket *so) 461{ 462#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0) |
463 struct rt_msghdr *rtm = NULL; 464 struct rtentry *rt = NULL; 465 struct radix_node_head *rnh; 466 struct rt_addrinfo info; 467 int len, error = 0; 468 struct ifnet *ifp = NULL; 469 union sockaddr_union saun; 470 --- 84 unchanged lines hidden (view full) --- 555 rt = saved_nrt; 556 goto report; 557 } 558 break; 559 560 case RTM_GET: 561 case RTM_CHANGE: 562 case RTM_LOCK: |
563 rnh = rt_tables_get_rnh(so->so_fibnum, 564 info.rti_info[RTAX_DST]->sa_family); |
565 if (rnh == NULL) 566 senderr(EAFNOSUPPORT); 567 RADIX_NODE_HEAD_RLOCK(rnh); 568 rt = (struct rtentry *) rnh->rnh_lookup(info.rti_info[RTAX_DST], 569 info.rti_info[RTAX_NETMASK], rnh); 570 if (rt == NULL) { /* XXX looks bogus */ 571 RADIX_NODE_HEAD_RUNLOCK(rnh); 572 senderr(ESRCH); --- 840 unchanged lines hidden (view full) --- 1413done: 1414 IFNET_RUNLOCK(); 1415 return (error); 1416} 1417 1418static int 1419sysctl_rtsock(SYSCTL_HANDLER_ARGS) 1420{ |
1421 int *name = (int *)arg1; 1422 u_int namelen = arg2; |
1423 struct radix_node_head *rnh = NULL; /* silence compiler. */ |
1424 int i, lim, error = EINVAL; 1425 u_char af; 1426 struct walkarg w; 1427 1428 name ++; 1429 namelen--; 1430 if (req->newptr) 1431 return (EPERM); --- 31 unchanged lines hidden (view full) --- 1463 else 1464 error = EINVAL; 1465 break; 1466 } 1467 /* 1468 * take care of routing entries 1469 */ 1470 for (error = 0; error == 0 && i <= lim; i++) |
1471 rnh = rt_tables_get_rnh(req->td->td_proc->p_fibnum, i); 1472 if (rnh != NULL) { |
1473 RADIX_NODE_HEAD_LOCK(rnh); 1474 error = rnh->rnh_walktree(rnh, 1475 sysctl_dumpentry, &w); 1476 RADIX_NODE_HEAD_UNLOCK(rnh); 1477 } else if (af != 0) 1478 error = EAFNOSUPPORT; 1479 break; 1480 --- 41 unchanged lines hidden --- |