Deleted Added
full compact
rtsock.c (227309) rtsock.c (228571)
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 227309 2011-11-07 15:43:11Z ed $
30 * $FreeBSD: head/sys/net/rtsock.c 228571 2011-12-16 12:16:56Z glebius $
31 */
32#include "opt_compat.h"
33#include "opt_sctp.h"
34#include "opt_mpath.h"
35#include "opt_inet.h"
36#include "opt_inet6.h"
37
38#include <sys/param.h>

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

58#include <net/if_types.h>
59#include <net/netisr.h>
60#include <net/raw_cb.h>
61#include <net/route.h>
62#include <net/vnet.h>
63
64#include <netinet/in.h>
65#include <netinet/if_ether.h>
31 */
32#include "opt_compat.h"
33#include "opt_sctp.h"
34#include "opt_mpath.h"
35#include "opt_inet.h"
36#include "opt_inet6.h"
37
38#include <sys/param.h>

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

58#include <net/if_types.h>
59#include <net/netisr.h>
60#include <net/raw_cb.h>
61#include <net/route.h>
62#include <net/vnet.h>
63
64#include <netinet/in.h>
65#include <netinet/if_ether.h>
66#include <netinet/ip_carp.h>
66#ifdef INET6
67#include <netinet6/scope6_var.h>
68#endif
69
70#if defined(INET) || defined(INET6)
71#ifdef SCTP
72extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
73#endif /* SCTP */

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

78#include <compat/freebsd32/freebsd32.h>
79
80struct if_data32 {
81 uint8_t ifi_type;
82 uint8_t ifi_physical;
83 uint8_t ifi_addrlen;
84 uint8_t ifi_hdrlen;
85 uint8_t ifi_link_state;
67#ifdef INET6
68#include <netinet6/scope6_var.h>
69#endif
70
71#if defined(INET) || defined(INET6)
72#ifdef SCTP
73extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
74#endif /* SCTP */

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

79#include <compat/freebsd32/freebsd32.h>
80
81struct if_data32 {
82 uint8_t ifi_type;
83 uint8_t ifi_physical;
84 uint8_t ifi_addrlen;
85 uint8_t ifi_hdrlen;
86 uint8_t ifi_link_state;
86 uint8_t ifi_spare_char1;
87 uint8_t ifi_vhid;
87 uint8_t ifi_spare_char2;
88 uint8_t ifi_datalen;
89 uint32_t ifi_mtu;
90 uint32_t ifi_metric;
91 uint32_t ifi_baudrate;
92 uint32_t ifi_ipackets;
93 uint32_t ifi_ierrors;
94 uint32_t ifi_opackets;

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

117#endif
118
119MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables");
120
121/* NB: these are not modified */
122static struct sockaddr route_src = { 2, PF_ROUTE, };
123static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, };
124
88 uint8_t ifi_spare_char2;
89 uint8_t ifi_datalen;
90 uint32_t ifi_mtu;
91 uint32_t ifi_metric;
92 uint32_t ifi_baudrate;
93 uint32_t ifi_ipackets;
94 uint32_t ifi_ierrors;
95 uint32_t ifi_opackets;

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

118#endif
119
120MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables");
121
122/* NB: these are not modified */
123static struct sockaddr route_src = { 2, PF_ROUTE, };
124static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, };
125
126/* These are external hooks for CARP. */
127int (*carp_get_vhid_p)(struct ifaddr *);
128
125/*
126 * Used by rtsock/raw_input callback code to decide whether to filter the update
127 * notification to a socket bound to a particular FIB.
128 */
129#define RTS_FILTER_FIB M_PROTO8
130#define RTS_ALLFIBS -1
131
132static struct {

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

1503{
1504
1505 bzero(dst, sizeof(*dst));
1506 CP(*src, *dst, ifi_type);
1507 CP(*src, *dst, ifi_physical);
1508 CP(*src, *dst, ifi_addrlen);
1509 CP(*src, *dst, ifi_hdrlen);
1510 CP(*src, *dst, ifi_link_state);
129/*
130 * Used by rtsock/raw_input callback code to decide whether to filter the update
131 * notification to a socket bound to a particular FIB.
132 */
133#define RTS_FILTER_FIB M_PROTO8
134#define RTS_ALLFIBS -1
135
136static struct {

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

1507{
1508
1509 bzero(dst, sizeof(*dst));
1510 CP(*src, *dst, ifi_type);
1511 CP(*src, *dst, ifi_physical);
1512 CP(*src, *dst, ifi_addrlen);
1513 CP(*src, *dst, ifi_hdrlen);
1514 CP(*src, *dst, ifi_link_state);
1515 CP(*src, *dst, ifi_vhid);
1511 dst->ifi_datalen = sizeof(struct if_data32);
1512 CP(*src, *dst, ifi_mtu);
1513 CP(*src, *dst, ifi_metric);
1514 CP(*src, *dst, ifi_baudrate);
1515 CP(*src, *dst, ifi_ipackets);
1516 CP(*src, *dst, ifi_ierrors);
1517 CP(*src, *dst, ifi_opackets);
1518 CP(*src, *dst, ifi_oerrors);

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

1554 if (w->w_req->flags & SCTL_MASK32) {
1555 struct if_msghdr32 *ifm32;
1556
1557 ifm32 = (struct if_msghdr32 *)w->w_tmem;
1558 ifm32->ifm_index = ifp->if_index;
1559 ifm32->ifm_flags = ifp->if_flags |
1560 ifp->if_drv_flags;
1561 copy_ifdata32(&ifp->if_data, &ifm32->ifm_data);
1516 dst->ifi_datalen = sizeof(struct if_data32);
1517 CP(*src, *dst, ifi_mtu);
1518 CP(*src, *dst, ifi_metric);
1519 CP(*src, *dst, ifi_baudrate);
1520 CP(*src, *dst, ifi_ipackets);
1521 CP(*src, *dst, ifi_ierrors);
1522 CP(*src, *dst, ifi_opackets);
1523 CP(*src, *dst, ifi_oerrors);

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

1559 if (w->w_req->flags & SCTL_MASK32) {
1560 struct if_msghdr32 *ifm32;
1561
1562 ifm32 = (struct if_msghdr32 *)w->w_tmem;
1563 ifm32->ifm_index = ifp->if_index;
1564 ifm32->ifm_flags = ifp->if_flags |
1565 ifp->if_drv_flags;
1566 copy_ifdata32(&ifp->if_data, &ifm32->ifm_data);
1567 if (carp_get_vhid_p != NULL)
1568 ifm32->ifm_data.ifi_vhid =
1569 (*carp_get_vhid_p)(ifa);
1562 ifm32->ifm_addrs = info.rti_addrs;
1563 error = SYSCTL_OUT(w->w_req, (caddr_t)ifm32,
1564 len);
1565 goto sysctl_out;
1566 }
1567#endif
1568 ifm = (struct if_msghdr *)w->w_tmem;
1569 ifm->ifm_index = ifp->if_index;
1570 ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags;
1571 ifm->ifm_data = ifp->if_data;
1570 ifm32->ifm_addrs = info.rti_addrs;
1571 error = SYSCTL_OUT(w->w_req, (caddr_t)ifm32,
1572 len);
1573 goto sysctl_out;
1574 }
1575#endif
1576 ifm = (struct if_msghdr *)w->w_tmem;
1577 ifm->ifm_index = ifp->if_index;
1578 ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags;
1579 ifm->ifm_data = ifp->if_data;
1580 if (carp_get_vhid_p != NULL)
1581 ifm->ifm_data.ifi_vhid =
1582 (*carp_get_vhid_p)(ifa);
1572 ifm->ifm_addrs = info.rti_addrs;
1573 error = SYSCTL_OUT(w->w_req, (caddr_t)ifm, len);
1574#ifdef COMPAT_FREEBSD32
1575 sysctl_out:
1576#endif
1577 if (error)
1578 goto done;
1579 }

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

1590 if (w->w_req && w->w_tmem) {
1591 struct ifa_msghdr *ifam;
1592
1593 ifam = (struct ifa_msghdr *)w->w_tmem;
1594 ifam->ifam_index = ifa->ifa_ifp->if_index;
1595 ifam->ifam_flags = ifa->ifa_flags;
1596 ifam->ifam_metric = ifa->ifa_metric;
1597 ifam->ifam_addrs = info.rti_addrs;
1583 ifm->ifm_addrs = info.rti_addrs;
1584 error = SYSCTL_OUT(w->w_req, (caddr_t)ifm, len);
1585#ifdef COMPAT_FREEBSD32
1586 sysctl_out:
1587#endif
1588 if (error)
1589 goto done;
1590 }

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

1601 if (w->w_req && w->w_tmem) {
1602 struct ifa_msghdr *ifam;
1603
1604 ifam = (struct ifa_msghdr *)w->w_tmem;
1605 ifam->ifam_index = ifa->ifa_ifp->if_index;
1606 ifam->ifam_flags = ifa->ifa_flags;
1607 ifam->ifam_metric = ifa->ifa_metric;
1608 ifam->ifam_addrs = info.rti_addrs;
1609 if (carp_get_vhid_p != NULL)
1610 ifam->ifam_data.ifi_vhid =
1611 (*carp_get_vhid_p)(ifa);
1598 error = SYSCTL_OUT(w->w_req, w->w_tmem, len);
1599 if (error)
1600 goto done;
1601 }
1602 }
1603 IF_ADDR_UNLOCK(ifp);
1604 info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] =
1605 info.rti_info[RTAX_BRD] = NULL;

--- 162 unchanged lines hidden ---
1612 error = SYSCTL_OUT(w->w_req, w->w_tmem, len);
1613 if (error)
1614 goto done;
1615 }
1616 }
1617 IF_ADDR_UNLOCK(ifp);
1618 info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] =
1619 info.rti_info[RTAX_BRD] = NULL;

--- 162 unchanged lines hidden ---