1 /* 2 * Copyright (c) 2004-2021 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 29 /* 30 * Copyright 2001 Wasabi Systems, Inc. 31 * All rights reserved. 32 * 33 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 34 * 35 * Redistribution and use in source and binary forms, with or without 36 * modification, are permitted provided that the following conditions 37 * are met: 38 * 1. Redistributions of source code must retain the above copyright 39 * notice, this list of conditions and the following disclaimer. 40 * 2. Redistributions in binary form must reproduce the above copyright 41 * notice, this list of conditions and the following disclaimer in the 42 * documentation and/or other materials provided with the distribution. 43 * 3. All advertising materials mentioning features or use of this software 44 * must display the following acknowledgement: 45 * This product includes software developed for the NetBSD Project by 46 * Wasabi Systems, Inc. 47 * 4. The name of Wasabi Systems, Inc. may not be used to endorse 48 * or promote products derived from this software without specific prior 49 * written permission. 50 * 51 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 52 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 53 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 55 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 61 * POSSIBILITY OF SUCH DAMAGE. 62 */ 63 64 /* 65 * Copyright (c) 1999, 2000 Jason L. Wright ([email protected]) 66 * All rights reserved. 67 * 68 * Redistribution and use in source and binary forms, with or without 69 * modification, are permitted provided that the following conditions 70 * are met: 71 * 1. Redistributions of source code must retain the above copyright 72 * notice, this list of conditions and the following disclaimer. 73 * 2. Redistributions in binary form must reproduce the above copyright 74 * notice, this list of conditions and the following disclaimer in the 75 * documentation and/or other materials provided with the distribution. 76 * 3. All advertising materials mentioning features or use of this software 77 * must display the following acknowledgement: 78 * This product includes software developed by Jason L. Wright 79 * 4. The name of the author may not be used to endorse or promote products 80 * derived from this software without specific prior written permission. 81 * 82 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 83 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 84 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 85 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 86 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 87 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 88 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 89 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 90 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 91 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 92 * POSSIBILITY OF SUCH DAMAGE. 93 * 94 * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp 95 * 96 * $FreeBSD$ 97 */ 98 99 /* 100 * Data structure and control definitions for bridge interfaces. 101 */ 102 103 #ifndef _NET_IF_BRIDGEVAR_H_ 104 #define _NET_IF_BRIDGEVAR_H_ 105 106 #ifdef PRIVATE 107 108 #include <sys/queue.h> 109 110 #include <net/if.h> 111 #include <net/ethernet.h> 112 #include <netinet/in.h> 113 114 /* 115 * Commands used in the SIOCSDRVSPEC ioctl. Note the lookup of the 116 * bridge interface itself is keyed off the ifdrv structure. 117 */ 118 #define BRDGADD 0 /* add bridge member (ifbreq) */ 119 #define BRDGDEL 1 /* delete bridge member (ifbreq) */ 120 #define BRDGGIFFLGS 2 /* get member if flags (ifbreq) */ 121 #define BRDGSIFFLGS 3 /* set member if flags (ifbreq) */ 122 #define BRDGSCACHE 4 /* set cache size (ifbrparam) */ 123 #define BRDGGCACHE 5 /* get cache size (ifbrparam) */ 124 #define BRDGGIFS 6 /* get member list (ifbifconf) */ 125 #define BRDGRTS 7 /* get address list (ifbaconf) */ 126 #define BRDGSADDR 8 /* set static address (ifbareq) */ 127 #define BRDGSTO 9 /* set cache timeout (ifbrparam) */ 128 #define BRDGGTO 10 /* get cache timeout (ifbrparam) */ 129 #define BRDGDADDR 11 /* delete address (ifbareq) */ 130 #define BRDGFLUSH 12 /* flush address cache (ifbreq) */ 131 132 #define BRDGGPRI 13 /* get priority (ifbrparam) */ 133 #define BRDGSPRI 14 /* set priority (ifbrparam) */ 134 #define BRDGGHT 15 /* get hello time (ifbrparam) */ 135 #define BRDGSHT 16 /* set hello time (ifbrparam) */ 136 #define BRDGGFD 17 /* get forward delay (ifbrparam) */ 137 #define BRDGSFD 18 /* set forward delay (ifbrparam) */ 138 #define BRDGGMA 19 /* get max age (ifbrparam) */ 139 #define BRDGSMA 20 /* set max age (ifbrparam) */ 140 #define BRDGSIFPRIO 21 /* set if priority (ifbreq) */ 141 #define BRDGSIFCOST 22 /* set if path cost (ifbreq) */ 142 #define BRDGGFILT 23 /* get filter flags (ifbrparam) */ 143 #define BRDGSFILT 24 /* set filter flags (ifbrparam) */ 144 #define BRDGPURGE 25 /* purge address cache for a particular interface (ifbreq) */ 145 #define BRDGADDS 26 /* add bridge span member (ifbreq) */ 146 #define BRDGDELS 27 /* delete bridge span member (ifbreq) */ 147 #define BRDGPARAM 28 /* get bridge STP params (ifbropreq) */ 148 #define BRDGGRTE 29 /* get cache drops (ifbrparam) */ 149 #define BRDGGIFSSTP 30 /* get member STP params list (ifbpstpconf) */ 150 #define BRDGSPROTO 31 /* set protocol (ifbrparam) */ 151 #define BRDGSTXHC 32 /* set tx hold count (ifbrparam) */ 152 #define BRDGSIFAMAX 33 /* set max interface addrs (ifbreq) */ 153 #define BRDGGHOSTFILTER 34 /* get host filter (ifbrhostfilter) */ 154 #define BRDGSHOSTFILTER 35 /* set host filter (ifbrhostfilter) */ 155 #define BRDGGMACNATLIST 36 /* get MAC NAT list (ifbrmnelist) */ 156 #define BRDGGIFSTATS 37 /* member stats (ifbrmreq+ifbrmstats) */ 157 158 /* 159 * Generic bridge control request. 160 */ 161 #pragma pack(4) 162 163 struct ifbreq { 164 char ifbr_ifsname[IFNAMSIZ]; /* member if name */ 165 uint32_t ifbr_ifsflags; /* member if flags */ 166 uint32_t ifbr_stpflags; /* member if STP flags */ 167 uint32_t ifbr_path_cost; /* member if STP cost */ 168 uint8_t ifbr_portno; /* member if port number */ 169 uint8_t ifbr_priority; /* member if STP priority */ 170 uint8_t ifbr_proto; /* member if STP protocol */ 171 uint8_t ifbr_role; /* member if STP role */ 172 uint8_t ifbr_state; /* member if STP state */ 173 uint32_t ifbr_addrcnt; /* member if addr number */ 174 uint32_t ifbr_addrmax; /* member if addr max */ 175 uint32_t ifbr_addrexceeded; /* member if addr violations */ 176 uint8_t pad[32]; 177 }; 178 179 #pragma pack() 180 181 /* BRDGGIFFLGS, BRDGSIFFLGS */ 182 #define IFBIF_LEARNING 0x0001 /* if can learn */ 183 #define IFBIF_DISCOVER 0x0002 /* if sends packets w/ unknown dest. */ 184 #define IFBIF_STP 0x0004 /* if participates in spanning tree */ 185 #define IFBIF_SPAN 0x0008 /* if is a span port */ 186 #define IFBIF_STICKY 0x0010 /* if learned addresses stick */ 187 #define IFBIF_BSTP_EDGE 0x0020 /* member stp edge port */ 188 #define IFBIF_BSTP_AUTOEDGE 0x0040 /* member stp autoedge enabled */ 189 #define IFBIF_BSTP_PTP 0x0080 /* member stp point to point */ 190 #define IFBIF_BSTP_AUTOPTP 0x0100 /* member stp autoptp enabled */ 191 #define IFBIF_BSTP_ADMEDGE 0x0200 /* member stp admin edge enabled */ 192 #define IFBIF_BSTP_ADMCOST 0x0400 /* member stp admin path cost */ 193 #define IFBIF_PRIVATE 0x0800 /* if is a private segment */ 194 #define IFBIF_MAC_NAT 0x8000 /* member requires MAC NAT */ 195 #define IFBIF_CHECKSUM_OFFLOAD 0x10000 /* checksum inbound packets, 196 * drop outbound packets with 197 * bad checksum 198 */ 199 #define IFBIF_USES_VIRTIO 0x20000 /* uses virtio */ 200 201 202 #define IFBIFBITS "\020\001LEARNING\002DISCOVER\003STP\004SPAN" \ 203 "\005STICKY\006EDGE\007AUTOEDGE\010PTP" \ 204 "\011AUTOPTP\014PRIVATE" \ 205 "\020MACNAT\021CSUM\022VIRTIO" 206 207 #define IFBIFMASK ~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_PTP| \ 208 IFBIF_BSTP_AUTOPTP|IFBIF_BSTP_ADMEDGE| \ 209 IFBIF_BSTP_ADMCOST) /* not saved */ 210 211 /* BRDGFLUSH */ 212 #define IFBF_FLUSHDYN 0x00 /* flush learned addresses only */ 213 #define IFBF_FLUSHALL 0x01 /* flush all addresses */ 214 215 /* BRDGSFILT */ 216 #define IFBF_FILT_USEIPF 0x00000001 /* run pf hooks on the bridge 217 * interface */ 218 #define IFBF_FILT_MEMBER 0x00000002 /* run pf hooks on the member 219 * interfaces */ 220 #define IFBF_FILT_ONLYIP 0x00000004 /* only pass IP[46] packets when 221 * pf is enabled */ 222 #define IFBF_FILT_MASK 0x00000007 /* mask of valid values */ 223 224 /* 225 * Interface list structure. 226 */ 227 228 #pragma pack(4) 229 230 #ifndef XNU_KERNEL_PRIVATE 231 232 struct ifbifconf { 233 uint32_t ifbic_len; /* buffer size */ 234 union { 235 caddr_t ifbicu_buf; 236 struct ifbreq *ifbicu_req; 237 #define ifbic_buf ifbic_ifbicu.ifbicu_buf 238 #define ifbic_req ifbic_ifbicu.ifbicu_req 239 } ifbic_ifbicu; 240 }; 241 242 #else /* XNU_KERNEL_PRIVATE */ 243 244 struct ifbifconf32 { 245 uint32_t ifbic_len; /* buffer size */ 246 union { 247 user32_addr_t ifbicu_buf; 248 user32_addr_t ifbicu_req; 249 #define ifbic_buf ifbic_ifbicu.ifbicu_buf 250 #define ifbic_req ifbic_ifbicu.ifbicu_req 251 } ifbic_ifbicu; 252 }; 253 254 struct ifbifconf64 { 255 uint32_t ifbic_len; /* buffer size */ 256 union { 257 user64_addr_t ifbicu_buf; 258 user64_addr_t ifbicu_req; 259 } ifbic_ifbicu; 260 }; 261 #endif /* XNU_KERNEL_PRIVATE */ 262 263 #pragma pack() 264 265 /* 266 * Bridge address request. 267 */ 268 269 #pragma pack(4) 270 271 #ifndef XNU_KERNEL_PRIVATE 272 273 struct ifbareq { 274 char ifba_ifsname[IFNAMSIZ]; /* member if name */ 275 unsigned long ifba_expire; /* address expire time */ 276 uint8_t ifba_flags; /* address flags */ 277 uint8_t ifba_dst[ETHER_ADDR_LEN];/* destination address */ 278 uint16_t ifba_vlan; /* vlan id */ 279 }; 280 281 #else /* XNU_KERNEL_PRIVATE */ 282 283 struct ifbareq32 { 284 char ifba_ifsname[IFNAMSIZ]; /* member if name */ 285 uint32_t ifba_expire; /* address expire time */ 286 uint8_t ifba_flags; /* address flags */ 287 uint8_t ifba_dst[ETHER_ADDR_LEN];/* destination address */ 288 uint16_t ifba_vlan; /* vlan id */ 289 }; 290 291 struct ifbareq64 { 292 char ifba_ifsname[IFNAMSIZ]; /* member if name */ 293 uint64_t ifba_expire; /* address expire time */ 294 uint8_t ifba_flags; /* address flags */ 295 uint8_t ifba_dst[ETHER_ADDR_LEN];/* destination address */ 296 uint16_t ifba_vlan; /* vlan id */ 297 }; 298 #endif /* XNU_KERNEL_PRIVATE */ 299 300 #pragma pack() 301 302 #define IFBAF_TYPEMASK 0x03 /* address type mask */ 303 #define IFBAF_DYNAMIC 0x00 /* dynamically learned address */ 304 #define IFBAF_STATIC 0x01 /* static address */ 305 #define IFBAF_STICKY 0x02 /* sticky address */ 306 307 #define IFBAFBITS "\020\1STATIC\2STICKY" 308 309 /* 310 * Address list structure. 311 */ 312 313 #pragma pack(4) 314 315 #ifndef XNU_KERNEL_PRIVATE 316 317 struct ifbaconf { 318 uint32_t ifbac_len; /* buffer size */ 319 union { 320 caddr_t ifbacu_buf; 321 struct ifbareq *ifbacu_req; 322 #define ifbac_buf ifbac_ifbacu.ifbacu_buf 323 #define ifbac_req ifbac_ifbacu.ifbacu_req 324 } ifbac_ifbacu; 325 }; 326 327 #else /* XNU_KERNEL_PRIVATE */ 328 329 struct ifbaconf32 { 330 uint32_t ifbac_len; /* buffer size */ 331 union { 332 user32_addr_t ifbacu_buf; 333 user32_addr_t ifbacu_req; 334 #define ifbac_buf ifbac_ifbacu.ifbacu_buf 335 #define ifbac_req ifbac_ifbacu.ifbacu_req 336 } ifbac_ifbacu; 337 }; 338 339 struct ifbaconf64 { 340 uint32_t ifbac_len; /* buffer size */ 341 union { 342 user64_addr_t ifbacu_buf; 343 user64_addr_t ifbacu_req; 344 } ifbac_ifbacu; 345 }; 346 #endif /* XNU_KERNEL_PRIVATE */ 347 348 #pragma pack() 349 350 /* 351 * Bridge parameter structure. 352 */ 353 354 #pragma pack(4) 355 356 struct ifbrparam { 357 union { 358 uint32_t ifbrpu_int32; 359 uint16_t ifbrpu_int16; 360 uint8_t ifbrpu_int8; 361 } ifbrp_ifbrpu; 362 }; 363 364 #pragma pack() 365 366 #define ifbrp_csize ifbrp_ifbrpu.ifbrpu_int32 /* cache size */ 367 #define ifbrp_ctime ifbrp_ifbrpu.ifbrpu_int32 /* cache time (sec) */ 368 #define ifbrp_prio ifbrp_ifbrpu.ifbrpu_int16 /* bridge priority */ 369 #define ifbrp_proto ifbrp_ifbrpu.ifbrpu_int8 /* bridge protocol */ 370 #define ifbrp_txhc ifbrp_ifbrpu.ifbrpu_int8 /* bpdu tx holdcount */ 371 #define ifbrp_hellotime ifbrp_ifbrpu.ifbrpu_int8 /* hello time (sec) */ 372 #define ifbrp_fwddelay ifbrp_ifbrpu.ifbrpu_int8 /* fwd time (sec) */ 373 #define ifbrp_maxage ifbrp_ifbrpu.ifbrpu_int8 /* max age (sec) */ 374 #define ifbrp_cexceeded ifbrp_ifbrpu.ifbrpu_int32 /* # of cache dropped 375 * adresses */ 376 #define ifbrp_filter ifbrp_ifbrpu.ifbrpu_int32 /* filtering flags */ 377 378 /* 379 * Bridge current operational parameters structure. 380 */ 381 382 #ifndef XNU_KERNEL_PRIVATE 383 384 #pragma pack(4) 385 386 struct ifbropreq { 387 uint8_t ifbop_holdcount; 388 uint8_t ifbop_maxage; 389 uint8_t ifbop_hellotime; 390 uint8_t ifbop_fwddelay; 391 uint8_t ifbop_protocol; 392 uint16_t ifbop_priority; 393 uint16_t ifbop_root_port; 394 uint32_t ifbop_root_path_cost; 395 uint64_t ifbop_bridgeid; 396 uint64_t ifbop_designated_root; 397 uint64_t ifbop_designated_bridge; 398 struct timeval ifbop_last_tc_time; 399 }; 400 401 #pragma pack() 402 403 #else /* XNU_KERNEL_PRIVATE */ 404 405 #include <sys/_types/_timeval32.h> 406 #include <sys/_types/_timeval64.h> 407 408 #pragma pack(4) 409 410 struct ifbropreq32 { 411 uint8_t ifbop_holdcount; 412 uint8_t ifbop_maxage; 413 uint8_t ifbop_hellotime; 414 uint8_t ifbop_fwddelay; 415 uint8_t ifbop_protocol; 416 uint16_t ifbop_priority; 417 uint16_t ifbop_root_port; 418 uint32_t ifbop_root_path_cost; 419 uint64_t ifbop_bridgeid; 420 uint64_t ifbop_designated_root; 421 uint64_t ifbop_designated_bridge; 422 struct timeval32 ifbop_last_tc_time; 423 }; 424 425 struct ifbropreq64 { 426 uint8_t ifbop_holdcount; 427 uint8_t ifbop_maxage; 428 uint8_t ifbop_hellotime; 429 uint8_t ifbop_fwddelay; 430 uint8_t ifbop_protocol; 431 uint16_t ifbop_priority; 432 uint16_t ifbop_root_port; 433 uint32_t ifbop_root_path_cost; 434 uint64_t ifbop_bridgeid; 435 uint64_t ifbop_designated_root; 436 uint64_t ifbop_designated_bridge; 437 struct timeval64 ifbop_last_tc_time; 438 }; 439 440 #pragma pack() 441 442 #endif 443 444 /* 445 * Bridge member operational STP params structure. 446 */ 447 448 #pragma pack(4) 449 450 struct ifbpstpreq { 451 uint8_t ifbp_portno; /* bp STP port number */ 452 uint32_t ifbp_fwd_trans; /* bp STP fwd transitions */ 453 uint32_t ifbp_design_cost; /* bp STP designated cost */ 454 uint32_t ifbp_design_port; /* bp STP designated port */ 455 uint64_t ifbp_design_bridge; /* bp STP designated bridge */ 456 uint64_t ifbp_design_root; /* bp STP designated root */ 457 }; 458 459 #pragma pack() 460 461 /* 462 * Bridge STP ports list structure. 463 */ 464 465 #pragma pack(4) 466 467 #ifndef XNU_KERNEL_PRIVATE 468 469 struct ifbpstpconf { 470 uint32_t ifbpstp_len; /* buffer size */ 471 union { 472 caddr_t ifbpstpu_buf; 473 struct ifbpstpreq *ifbpstpu_req; 474 } ifbpstp_ifbpstpu; 475 #define ifbpstp_buf ifbpstp_ifbpstpu.ifbpstpu_buf 476 #define ifbpstp_req ifbpstp_ifbpstpu.ifbpstpu_req 477 }; 478 479 #else /* XNU_KERNEL_PRIVATE */ 480 481 struct ifbpstpconf32 { 482 uint32_t ifbpstp_len; /* buffer size */ 483 union { 484 user32_addr_t ifbpstpu_buf; 485 user32_addr_t ifbpstpu_req; 486 #define ifbpstp_buf ifbpstp_ifbpstpu.ifbpstpu_buf 487 #define ifbpstp_req ifbpstp_ifbpstpu.ifbpstpu_req 488 } ifbpstp_ifbpstpu; 489 }; 490 491 struct ifbpstpconf64 { 492 uint32_t ifbpstp_len; /* buffer size */ 493 union { 494 user64_addr_t ifbpstpu_buf; 495 user64_addr_t ifbpstpu_req; 496 } ifbpstp_ifbpstpu; 497 }; 498 499 #endif /* XNU_KERNEL_PRIVATE */ 500 501 #pragma pack() 502 503 /* 504 * Bridge member host filter. 505 */ 506 507 #define IFBRHF_ENABLED 0x01 508 #define IFBRHF_HWSRC 0x02 /* Valid with enabled flags */ 509 #define IFBRHF_IPSRC 0x04 /* Valid with enabled flags */ 510 511 #pragma pack(4) 512 513 struct ifbrhostfilter { 514 uint32_t ifbrhf_flags; /* flags */ 515 char ifbrhf_ifsname[IFNAMSIZ]; /* member if name */ 516 uint8_t ifbrhf_hwsrca[ETHER_ADDR_LEN]; 517 uint32_t ifbrhf_ipsrc; 518 }; 519 520 #pragma pack() 521 522 /* 523 * sysctl net.link.bridge.hostfilterstats 524 */ 525 struct bridge_hostfilter_stats { 526 uint64_t brhf_bad_ether_type; 527 uint64_t brhf_bad_ether_srchw_addr; 528 529 uint64_t brhf_ether_too_small; 530 uint64_t brhf_ether_pullup_failed; 531 532 uint64_t brhf_arp_ok; 533 uint64_t brhf_arp_too_small; 534 uint64_t brhf_arp_pullup_failed; 535 uint64_t brhf_arp_bad_hw_type; 536 uint64_t brhf_arp_bad_pro_type; 537 uint64_t brhf_arp_bad_hw_len; 538 uint64_t brhf_arp_bad_pro_len; 539 uint64_t brhf_arp_bad_op; 540 uint64_t brhf_arp_bad_sha; 541 uint64_t brhf_arp_bad_spa; 542 543 uint64_t brhf_ip_ok; 544 uint64_t brhf_ip_too_small; 545 uint64_t brhf_ip_pullup_failed; 546 uint64_t brhf_ip_bad_srcaddr; 547 uint64_t brhf_ip_bad_proto; 548 549 uint64_t brhf_dhcp_too_small; 550 uint64_t brhf_dhcp_bad_op; 551 uint64_t brhf_dhcp_bad_htype; 552 uint64_t brhf_dhcp_bad_hlen; 553 uint64_t brhf_dhcp_bad_chaddr; 554 uint64_t brhf_dhcp_bad_ciaddr; 555 }; 556 557 #ifdef XNU_KERNEL_PRIVATE 558 559 extern u_int8_t bstp_etheraddr[ETHER_ADDR_LEN]; 560 561 int bridgeattach(int); 562 563 #endif /* XNU_KERNEL_PRIVATE */ 564 565 566 #pragma pack(4) 567 568 /* 569 * MAC NAT entry list 570 */ 571 572 union ifbrip { 573 struct in_addr ifbrip_addr; 574 struct in6_addr ifbrip_addr6; 575 }; 576 577 struct ifbrmne { 578 char ifbmne_ifname[IFNAMSIZ]; /* member if name */ 579 uint64_t ifbmne_expire; /* expiration time */ 580 uint8_t ifbmne_mac[ETHER_ADDR_LEN];/* MAC address */ 581 uint8_t ifbmne_reserved; 582 uint8_t ifbmne_af; /* AF_INET or AF_INET6 */ 583 union ifbrip ifbmne_ip; 584 }; 585 #define ifbmne_ip_addr ifbmne_ip.ifbrip_addr 586 #define ifbmne_ip6_addr ifbmne_ip.ifbrip_addr6 587 588 #ifndef XNU_KERNEL_PRIVATE 589 590 struct ifbrmnelist { 591 uint32_t ifbml_len; /* buffer size (multiple of elsize) */ 592 uint16_t ifbml_elsize; /* sizeof(ifbrmne) */ 593 uint16_t ifbml_pad; 594 caddr_t ifbml_buf; 595 }; 596 597 #else /* XNU_KERNEL_PRIVATE */ 598 599 struct ifbrmnelist32 { 600 uint32_t ifbml_len; /* buffer size */ 601 uint16_t ifbml_elsize; /* sizeof(ifbrmne) */ 602 uint16_t ifbml_pad; 603 user32_addr_t ifbml_buf; 604 }; 605 606 struct ifbrmnelist64 { 607 uint32_t ifbml_len; /* buffer size */ 608 uint16_t ifbml_elsize; /* sizeof(ifbrmne) */ 609 uint16_t ifbml_pad; 610 user64_addr_t ifbml_buf; 611 }; 612 613 #endif /* XNU_KERNEL_PRIVATE */ 614 615 616 /* 617 * Bridge member-specific request structure 618 */ 619 620 #ifndef XNU_KERNEL_PRIVATE 621 622 struct ifbrmreq { 623 char brmr_ifname[IFNAMSIZ]; /* member if name */ 624 uint32_t brmr_len; /* buffer size (in/out) */ 625 uint32_t brmr_elsize; /* element size (out) */ 626 caddr_t brmr_buf; /* buffer */ 627 }; 628 629 #else /* XNU_KERNEL_PRIVATE */ 630 631 struct ifbrmreq32 { 632 char brmr_ifname[IFNAMSIZ]; /* member if name */ 633 uint32_t brmr_len; /* buffer size (in/out) */ 634 uint32_t brmr_elsize; /* element size (out) */ 635 user32_addr_t brmr_buf; /* buffer */ 636 }; 637 638 struct ifbrmreq64 { 639 char brmr_ifname[IFNAMSIZ]; /* member if name */ 640 uint32_t brmr_len; /* buffer size (in/out) */ 641 uint32_t brmr_elsize; /* element size (out) */ 642 user64_addr_t brmr_buf; /* buffer */ 643 }; 644 645 #endif /* XNU_KERNEL_PRIVATE */ 646 647 struct bripstats { 648 uint64_t bips_ip; 649 uint64_t bips_ip6; 650 uint64_t bips_udp; 651 uint64_t bips_tcp; 652 653 uint64_t bips_bad_ip; 654 uint64_t bips_bad_ip6; 655 uint64_t bips_bad_udp; 656 uint64_t bips_bad_tcp; 657 }; 658 659 struct brcsumstats { 660 uint64_t brcs_ip_checksum; 661 uint64_t brcs_udp_checksum; 662 uint64_t brcs_tcp_checksum; 663 }; 664 665 /* 666 * Bridge member statistics 667 * - "in" and "out" are from the perspective of the bridge: 668 * in: packets received from the bridge member 669 * out: packets destined to the bridge member 670 * - only available when IFBIF_CHECKSUM_OFFLOAD is enabled on the 671 * interface 672 */ 673 struct ifbrmstats { 674 struct bripstats brms_in_ip; 675 struct bripstats brms_out_ip; 676 677 struct brcsumstats brms_in_computed_cksum; 678 679 struct brcsumstats brms_out_cksum_good; 680 struct brcsumstats brms_out_cksum_good_hw; 681 682 struct brcsumstats brms_out_cksum_bad; 683 struct brcsumstats brms_out_cksum_bad_hw; 684 }; 685 686 #pragma pack() 687 688 #endif /* PRIVATE */ 689 #endif /* !_NET_IF_BRIDGEVAR_H_ */ 690