| /freebsd/tests/sys/net/routing/ |
| H A D | test_rtsock_lladdr.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 snprintf(vnet_name, sizeof(vnet_name), "vt-%s", atf_tc_get_ident(tc)); in jump_vnet() 39 vnet_switch_one(vnet_name, c->ifname); in jump_vnet() 42 c->ifindex = if_nametoindex(c->ifname); in jump_vnet() 55 ret = iface_turn_up(c->ifname); in presetup_ipv6() 56 ATF_REQUIRE_MSG(ret == 0, "Unable to turn up %s", c->ifname); in presetup_ipv6() [all …]
|
| H A D | test_rtsock_l3.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 snprintf(vnet_name, sizeof(vnet_name), "vt-%s", atf_tc_get_ident(tc)); in jump_vnet() 44 vnet_switch(vnet_name, c->ifnames, c->num_interfaces); in jump_vnet() 47 c->ifindex = if_nametoindex(c->ifname); in jump_vnet() 60 ret = iface_turn_up(c->ifname); in presetup_ipv6_iface() 61 ATF_REQUIRE_MSG(ret == 0, "Unable to turn up %s", c->ifname); in presetup_ipv6_iface() [all …]
|
| H A D | rtsock_print.h | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40 printf("-- CONDITION FAILED, rtm dump --\n\n");\ 51 printf("-- CONDITION FAILED, rtm hexdump--\n\n");\ 109 if (b & (1 << (i-1))) { in _printb() 126 return (int)(pbuf - buf); in _printb() 148 rem_len -= one_len; \ [all …]
|
| H A D | rtsock_common.h | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 64 #include <atf-c.h> 70 void rtsock_update_rtm_len(struct rt_msghdr *rtm); 72 void rtsock_add_rtm_sa(struct rt_msghdr *rtm, int addr_type, struct sockaddr *sa); 92 if (s == -1) in _check_cloner() 158 ifname[strlen(ifname) - 1] = 'b'; in iface_create() [all …]
|
| /freebsd/libexec/bootpd/ |
| H A D | rtmsg.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 9 * This code is derived from software which forms part of the 4.4-Lite 13 * Redistribution and use in source and binary forms, with or without 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 75 static int s = -1; /* routing socket */ 120 struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); in bsd_arp_set() local 128 sin->sin_addr = *ia; in bsd_arp_set() 144 sin = (struct sockaddr_in *)(rtm + 1); in bsd_arp_set() [all …]
|
| /freebsd/usr.sbin/rtsold/ |
| H A D | rtsock.c | 3 /*- 4 * SPDX-License-Identifier: BSD-3-Clause 9 * Redistribution and use in source and binary forms, with or without 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 87 return (-1); in rtsock_open() 98 struct rt_msghdr *rtm; in rtsock_input() local 103 offsetof(struct rt_msghdr, rtm_msglen) + sizeof(rtm->rtm_msglen); in rtsock_input() 109 rtm = (struct rt_msghdr *)(void *)next; in rtsock_input() 110 if (lim - next < lenlim) in rtsock_input() [all …]
|
| /freebsd/sbin/route/ |
| H A D | route.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 7 * Redistribution and use in source and binary forms, with or without 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 169 errx(EX_USAGE, "usage: route [-j jail] [-46dnqtv] command [[modifiers] args]"); in usage() 185 while ((ch = getopt(argc, argv, "46nqdtvj:")) != -1) in main() 231 argc -= optind; in main() 240 if (jid == -1) in main() 257 if (sysctlbyname("net.fibs", (void *)&numfibs, &len, NULL, 0) == -1) in main() [all …]
|
| /freebsd/lib/libc/net/ |
| H A D | getifmaddrs.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 7 * Redistribution and use in source and binary forms, with or without 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 42 #include "un-namespace.h" 44 #define SALIGN (sizeof(long) - 1) 45 #define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : \ 66 struct rt_msghdr *rtm; in getifmaddrs() local 77 return (-1); in getifmaddrs() [all …]
|
| H A D | getifaddrs.c | 3 /*- 4 * SPDX-License-Identifier: BSD-1-Clause 9 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * try-and-error for region size. 50 #include "un-namespace.h" 57 #define SA_LEN(sa) (sa)->sa_len 60 #define SALIGN (sizeof(long) - 1) 61 #define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : (SALIGN + 1)) [all …]
|
| /freebsd/usr.bin/netstat/ |
| H A D | nhgrp.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 77 if (idx >= map->size) in nhop_get() 79 if (*map->ptr[idx].ifname == '\0') in nhop_get() 81 return &map->ptr[idx]; in nhop_get() 88 xo_emit("{T:/%-*.*s}{T:/%-*.*s}{T:/%*.*s}{T:/%*.*s}{T:/%*.*s}" in print_nhgroup_header() 116 print_nhgroup_entry_sysctl(const char *name, struct rt_msghdr *rtm, in print_nhgroup_entry_sysctl() argument [all …]
|
| H A D | route.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 7 * Redistribution and use in source and binary forms, with or without 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 75 { RTF_DONE, 'd', "done" }, /* Completed -- for routing msgs only */ 120 if (fibnum == -1 && in routepr() 121 sysctlbyname("net.my_fibnum", &fibnum, &intsize, NULL, 0) == -1) in routepr() 123 if (sysctlbyname("net.fibs", &numfibs, &intsize, NULL, 0) == -1) in routepr() 125 if (fibnum < 0 || fibnum > numfibs - 1) in routepr() [all …]
|
| H A D | nhops.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 7 * Redistribution and use in source and binary forms, with or without 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 126 switch (sa->sa_family) { in print_sockaddr_buf() 128 inet_ntop(AF_INET, &((struct sockaddr_in *)sa)->sin_addr, in print_sockaddr_buf() 132 inet_ntop(AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr, in print_sockaddr_buf() 136 snprintf(buf, bufsize, "unknown:%d", sa->sa_family); in print_sockaddr_buf() 154 -width, name); in print_addr() [all …]
|
| /freebsd/sys/net/ |
| H A D | rtsock.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 7 * Redistribution and use in source and binary forms, with or without 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 126 ( (((struct sockaddr *)(sa))->sa_len == 0) ? \ 128 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(int) - 1) ) ) 140 RT_LOG_##_l(_l, "PID %d: " _fmt, curproc ? curproc->p_pid : 0, \ 213 struct rt_msghdr *rtm, struct rib_cmd_info *rc); 217 static void send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, [all …]
|
| /freebsd/usr.sbin/arp/ |
| H A D | arp.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 10 * Redistribution and use in source and binary forms, with or without 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * arp - display, set, and delete arp table entries 73 struct rt_msghdr *rtm); 112 while ((ch = getopt(argc, argv, "andfsSi:")) != -1) in main() 139 argc -= optind; in main() 147 xo_errx(1, "-i not applicable to this operation"); in main() [all …]
|
| /freebsd/usr.sbin/rtadvd/ |
| H A D | if.c | 3 /*- 4 * SPDX-License-Identifier: BSD-3-Clause 10 * Redistribution and use in source and binary forms, with or without 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 61 (((a) & ((size)-1)) ? (1 + ((a) | ((size)- 166 struct rt_msghdr *rtm; get_next_msg() local 260 struct rt_msghdr *rtm = (struct rt_msghdr *)buf; get_addr() local 272 struct rt_msghdr *rtm = (struct rt_msghdr *)buf; get_rtm_ifindex() local 284 struct rt_msghdr *rtm = (struct rt_msghdr *)buf; get_prefixlen() local [all...] |
| /freebsd/contrib/netbsd-tests/net/if_loop/ |
| H A D | t_pr.c | 3 /*- 7 * Redistribution and use in source and binary forms, with or without 23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 45 #include <atf-c.h> 66 #define rtm m_rtmsg.m_rtm in setup() macro 78 if ((s = rump_sys_socket(PF_ROUTE, SOCK_RAW, 0)) == -1) in setup() 88 if (rump_sys_ioctl(s, SIOCSIFMTU, &ifr) == -1) in setup() 93 rtm.rtm_type = RTM_CHANGE; in setup() 94 rtm.rtm_flags = RTF_STATIC; in setup() [all …]
|
| /freebsd/contrib/bsnmp/snmp_mibII/ |
| H A D | mibII_route.c | 2 * Copyright (c) 2001-2003 8 * Redistribution and use in source and binary forms, with or without 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 65 return (memcmp(s1->index, s2->index, 13)); in sroute_compare() 73 oid->len = sub + 13; in sroute_index_append() 75 oid->subs[sub + i] = s->index[i]; in sroute_index_append() 84 for (i = 0; i < 13 - 1; i++) 85 printf("%u.", r->index[i]); 86 printf("%u proto=%u type=%u", r->index[i], r->proto, r->type); [all …]
|
| H A D | mibII.c | 2 * Copyright (c) 2001-2003 8 * Redistribution and use in source and binary forms, with or without 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * $Begemot: mibII.c 516 2006-10-27 15:54:02Z brandt_h $ 48 /* if-index allocator */ 108 /* user-forced update interval */ 148 if (ifp->index == idx) in mib_find_if() 159 if (ifp->sysindex == sysindex) in mib_find_if_sys() 170 if (strcmp(ifp->name, name) == 0) in mib_find_if_name() [all …]
|
| /freebsd/tests/sys/netlink/ |
| H A D | netlink_socket.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 45 #include <atf-c.h> 79 ATF_REQUIRE((fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) != -1); in fullsocket() 89 ATF_REQUIRE(ioctl(fd, FIONREAD, &rsize) != -1); in fullsocket() 111 ATF_REQUIRE(ioctl(fd, FIONREAD, &recvavail) != -1); in fullsocket() 112 ATF_REQUIRE(ioctl(fd, FIONWRITE, &sendavail) != -1); in fullsocket() [all …]
|
| /freebsd/sbin/routed/ |
| H A D | table.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 7 * Redistribution and use in source and binary forms, with or without 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52 EPOCH+MIN_WAITTIME-1, 0 92 for (cag = ag_avail; cag != NULL; cag = cag->ag_fine) \ 94 for (cag = ag_corsest; cag != NULL; cag = cag->ag_fine) \ 118 /* Forget it if this route should not be output for split-horizon. */ in ag_out() 119 if (ag->ag_state & AGS_SPLIT_HZ) in ag_out() [all …]
|
| /freebsd/usr.sbin/ndp/ |
| H A D | ndp.c | 3 /*- 4 * SPDX-License-Identifier: BSD-3-Clause 9 * Redistribution and use in source and binary forms, with or without 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40 * Redistribution and use in source and binary forms, with or without 58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71 * ndp - display, set, delete and flush neighbor cache 116 if (rtm->rtm_addrs & (w)) { \ [all …]
|
| /freebsd/contrib/netbsd-tests/net/config/ |
| H A D | netconfig.c | 3 /*- 7 * Redistribution and use in source and binary forms, with or without 23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 48 #include <atf-c.h> 82 s = -1; in netcfg_rump_if() 97 sin->sin_family = AF_INET; in netcfg_rump_if() 98 sin->sin_len = sizeof(struct sockaddr_in); in netcfg_rump_if() 99 sin->sin_addr.s_addr = inaddr; in netcfg_rump_if() 103 sin->sin_family = AF_INET; in netcfg_rump_if() [all …]
|
| /freebsd/usr.sbin/route6d/ |
| H A D | route6d.c | 3 /*- 4 * SPDX-License-Identifier: BSD-3-Clause 9 * Redistribution and use in source and binary forms, with or without 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 80 ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) 81 #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) 92 struct in6_addr ifc_mylladdr; /* my link-local address */ 149 struct riprt *rrt_same; /* same destination - future use */ 292 while ((ch = getopt(argc, argv, "A:N:O:R:T:L:t:adDhlnp:P:Q:qsS")) != -1) { in main() [all …]
|
| /freebsd/usr.sbin/ppp/ |
| H A D | route.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 4 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org> 5 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp> 9 * Redistribution and use in source and binary forms, with or without 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 97 (int)phost->sa_family, (int)phost->sa_len); in p_sockaddr() 98 inet_ntop(phost->sa_family, phost->sa_data, tmp, sizeof tmp); in p_sockaddr() 101 inet_ntop(pmask->sa_family, pmask->sa_data, tmp, sizeof tmp); in p_sockaddr() [all …]
|
| /freebsd/sys/compat/linux/ |
| H A D | linux_netlink.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 6 * Redistribution and use in source and binary forms, with or without 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 81 if (hdr->nlmsg_len < sizeof(struct nlmsghdr) + sizeof(struct ndmsg)) in rtnl_neigh_from_linux() 83 if ((f = linux_to_bsd_domain(ndm->ndm_family)) == AF_UNKNOWN) in rtnl_neigh_from_linux() 86 ndm->ndm_family = f; in rtnl_neigh_from_linux() 97 if (hdr->nlmsg_len < sizeof(struct nlmsghdr) + in rtnl_ifaddr_from_linux() 98 offsetof(struct ifaddrmsg, ifa_family) + sizeof(ifam->ifa_family)) in rtnl_ifaddr_from_linux() [all …]
|