Deleted Added
full compact
rtsock.c (193219) rtsock.c (193232)
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
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 193219 2009-06-01 10:41:38Z rwatson $
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)
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 INIT_VNET_NET(so->so_vnet);
464 struct rt_msghdr *rtm = NULL;
465 struct rtentry *rt = NULL;
466 struct radix_node_head *rnh;
467 struct rt_addrinfo info;
468 int len, error = 0;
469 struct ifnet *ifp = NULL;
470 union sockaddr_union saun;
471

--- 84 unchanged lines hidden (view full) ---

556 rt = saved_nrt;
557 goto report;
558 }
559 break;
560
561 case RTM_GET:
562 case RTM_CHANGE:
563 case RTM_LOCK:
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:
564 rnh = V_rt_tables[so->so_fibnum][info.rti_info[RTAX_DST]->sa_family];
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{
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 INIT_VNET_NET(curvnet);
1422 int *name = (int *)arg1;
1423 u_int namelen = arg2;
1421 int *name = (int *)arg1;
1422 u_int namelen = arg2;
1424 struct radix_node_head *rnh;
1423 struct radix_node_head *rnh = NULL; /* silence compiler. */
1425 int i, lim, error = EINVAL;
1426 u_char af;
1427 struct walkarg w;
1428
1429 name ++;
1430 namelen--;
1431 if (req->newptr)
1432 return (EPERM);

--- 31 unchanged lines hidden (view full) ---

1464 else
1465 error = EINVAL;
1466 break;
1467 }
1468 /*
1469 * take care of routing entries
1470 */
1471 for (error = 0; error == 0 && i <= lim; i++)
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++)
1472 if ((rnh = V_rt_tables[req->td->td_proc->p_fibnum][i]) != NULL) {
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 ---
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 ---