Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | /* * Copyright (c) 2000-2023 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)if.h 8.1 (Berkeley) 6/10/93 */ #ifndef _NET_IF_PRIVATE_H_ #define _NET_IF_PRIVATE_H_ #include <mach/vm_types.h> #include <net/if.h> #include <net/if_dl.h> #include <net/if_var.h> #include <net/if_var_private.h> #include <netinet/in.h> #include <sys/types.h> #include <uuid/uuid.h> #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #ifndef DRIVERKIT #ifdef KERNEL_PRIVATE #define IF_MAXUNIT 0x7fff /* historical value */ struct if_clonereq64 { int ifcr_total; /* total cloners (out) */ int ifcr_count; /* room for this many in user buffer */ user64_addr_t ifcru_buffer __attribute__((aligned(8))); }; struct if_clonereq32 { int ifcr_total; /* total cloners (out) */ int ifcr_count; /* room for this many in user buffer */ user32_addr_t ifcru_buffer; }; #endif /* KERNEL_PRIVATE */ /* extended flags definitions: (all bits reserved for internal/future use) */ #define IFEF_AUTOCONFIGURING 0x00000001 /* allow BOOTP/DHCP replies to enter */ #define IFEF_ENQUEUE_MULTI 0x00000002 /* enqueue multiple packets at once */ #define IFEF_DELAY_START 0x00000004 /* delay start callback */ #define IFEF_PROBE_CONNECTIVITY 0x00000008 /* Probe connections going over this interface */ #define IFEF_ADV_REPORT 0x00000010 /* Supports interface advisory report */ #define IFEF_IPV6_DISABLED 0x00000020 /* coupled to ND6_IFF_IFDISABLED */ #define IFEF_ACCEPT_RTADV 0x00000040 /* accepts IPv6 RA on the interface */ #define IFEF_TXSTART 0x00000080 /* has start callback */ #define IFEF_RXPOLL 0x00000100 /* supports opportunistic input poll */ #define IFEF_VLAN 0x00000200 /* interface has one or more vlans */ #define IFEF_BOND 0x00000400 /* interface is part of bond */ #define IFEF_ARPLL 0x00000800 /* ARP for IPv4LL addresses */ #define IFEF_CLAT46 0x00001000 /* CLAT46 RFC 6877 */ #define IS_INTF_CLAT46(ifp) ((ifp) != NULL && ((ifp)->if_eflags & IFEF_CLAT46)) #define INTF_ADJUST_MTU_FOR_CLAT46(intf) \ (IS_INTF_CLAT46((intf)) || \ IS_INTF_CLAT46((intf)->if_delegated.ifp)) \ /* * XXX IFEF_NOAUTOIPV6LL is deprecated and should be done away with. * Configd pretty much manages the interface configuration. * Rather than looking at the flag we check if a specific LLA * has to be configured or the IID has to be generated by kernel. */ #define IFEF_NOAUTOIPV6LL 0x00002000 /* Need explicit IPv6 LL address */ #define IFEF_EXPENSIVE 0x00004000 /* Data access has a cost */ #define IFEF_IPV4_ROUTER 0x00008000 /* interior when in IPv4 router mode */ #define IFEF_CLONE 0x00010000 /* created using if_clone */ #define IFEF_LOCALNET_PRIVATE 0x00020000 /* local private network */ #define IFEF_SERVICE_TRIGGERED IFEF_LOCALNET_PRIVATE #define IFEF_IPV6_ND6ALT 0x00040000 /* alternative. KPI for ND6 */ #define IFEF_RESTRICTED_RECV 0x00080000 /* interface restricts inbound pkts */ #define IFEF_AWDL 0x00100000 /* Apple Wireless Direct Link */ #define IFEF_NOACKPRI 0x00200000 /* No TCP ACK prioritization */ #define IFEF_AWDL_RESTRICTED 0x00400000 /* Restricted AWDL mode */ #define IFEF_2KCL 0x00800000 /* prefers 2K cluster (socket based tunnel) */ #define IFEF_UNUSED1 0x01000000 #define IFEF_UNUSED2 0x02000000 #define IFEF_SKYWALK_NATIVE 0x04000000 /* Native Skywalk support */ #define IFEF_3CA 0x08000000 /* Capable of 3CA */ #define IFEF_SENDLIST 0x10000000 /* Supports tx packet lists */ #define IFEF_DIRECTLINK 0x20000000 /* point-to-point topology */ #define IFEF_QOSMARKING_ENABLED 0x40000000 /* QoS marking is enabled */ #define IFEF_UPDOWNCHANGE 0x80000000 /* up/down state is changing */ #ifdef XNU_KERNEL_PRIVATE /* * Extra flags */ #define IFXF_WAKE_ON_MAGIC_PACKET 0x00000001 /* wake on magic packet */ #define IFXF_TIMESTAMP_ENABLED 0x00000002 /* time stamping enabled */ #define IFXF_NX_NOAUTO 0x00000004 /* no auto config nexus */ #define IFXF_LEGACY 0x00000008 /* legacy (non-netif) mode */ #define IFXF_LOW_INTERNET_UL 0x00000010 /* Uplink Low Internet is confirmed */ #define IFXF_LOW_INTERNET_DL 0x00000020 /* Downlink Low Internet is confirmed */ #define IFXF_ALLOC_KPI 0x00000040 /* Allocated via the ifnet_alloc KPI */ #define IFXF_LOW_POWER 0x00000080 /* Low Power Mode */ #define IFXF_MPK_LOG 0x00000100 /* Multi-layer Packet Logging */ #define IFXF_CONSTRAINED 0x00000200 /* Constrained - Save Data Mode */ #define IFXF_LOW_LATENCY 0x00000400 /* Low latency interface */ #define IFXF_MARK_WAKE_PKT 0x00000800 /* Mark next input packet as wake packet */ #define IFXF_FAST_PKT_DELIVERY 0x00001000 /* Fast Packet Delivery */ #define IFXF_NO_TRAFFIC_SHAPING 0x00002000 /* Skip dummynet and netem traffic shaping */ #define IFXF_MANAGEMENT 0x00004000 /* Management interface */ #define IFXF_ULTRA_CONSTRAINED 0x00008000 /* Ultra constrained mode */ #define IFXF_IS_VPN 0x00010000 /* Is VPN */ #define IFXF_DELAYWAKEPKTEVENT 0x00020000 /* Delay notification of wake packet events */ #define IFXF_DISABLE_INPUT 0x00040000 /* Drop receive traffic */ #define IFXF_CONGESTED_LINK 0x00080000 /* Link is congested */ #define IFXF_IS_COMPANIONLINK 0x00100000 /* Is companion link */ #define IFXF_RX_FLOW_STEERING 0x00200000 /* Rx flow steering */ #define IFXF_LINK_HEURISTICS 0x00800000 /* Link heuristics enabled */ #define IFXF_LINK_HEUR_OFF_PENDING 0x01000000 /* Link heurisitics delay disable */ #define IFXF_POINTOPOINT_MDNS 0x02000000 /* Point-to-point interface supports mDNS */ #define IFXF_INBAND_WAKE_PKT_TAGGING 0x04000000 /* Inband tagging of packet wake flag */ #define IFXF_LOW_POWER_WAKE 0x08000000 /* Low Power Wake */ #define IFXF_REQUIRE_CELL_THREAD_GROUP 0x10000000 /* Require cellular thread group */ /* * Current requirements for an AWDL interface. Setting/clearing IFEF_AWDL * will also trigger the setting/clearing of the rest of the flags. Once * IFEF_AWDL is set, the rest of flags cannot be cleared, by definition. */ #define IFEF_AWDL_MASK \ (IFEF_LOCALNET_PRIVATE | IFEF_IPV6_ND6ALT | IFEF_RESTRICTED_RECV | \ IFEF_AWDL) #endif /* XNU_KERNEL_PRIVATE */ #ifdef KERNEL_PRIVATE /* * !!! NOTE !!! * * if_idle_flags definitions: (all bits are reserved for internal/future * use). Setting these flags MUST be done via the ifnet_set_idle_flags() * KPI due to the associated reference counting. Clearing them may be done by * calling the KPI, otherwise implicitly at interface detach time. Setting * the if_idle_flags field to a non-zero value will cause the networking * stack to aggressively purge expired objects (routes, etc.) */ #define IFRF_IDLE_NOTIFY 0x1 /* Generate notifications on idle */ /* flags set internally only: */ #define IFF_CANTCHANGE \ (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) #define IF_WAKE_VALID_FLAGS IF_WAKE_ON_MAGIC_PACKET #endif /* KERNEL_PRIVATE */ #ifdef IFREQ_OPAQUE /* * This is the private version of the ifreq structure, the * public version lives in if.h. If you make any changes * here, you probably also need to make them in if.h! */ struct ifreq { char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; short ifru_flags; int ifru_metric; int ifru_mtu; int ifru_phys; int ifru_media; int ifru_intval; caddr_t ifru_data; #ifdef KERNEL_PRIVATE u_int64_t ifru_data64; /* 64-bit ifru_data */ #endif /* KERNEL_PRIVATE */ struct ifdevmtu ifru_devmtu; struct ifkpi ifru_kpi; u_int32_t ifru_wake_flags; u_int32_t ifru_route_refcnt; int ifru_link_quality_metric; int ifru_cap[2]; struct { uint32_t ifo_flags; #define IFRIFOF_BLOCK_OPPORTUNISTIC 0x00000001 |