gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/tcpip/stack/BUILD (about)

     1  load("//pkg/sync/locking:locking.bzl", "declare_mutex", "declare_rwmutex")
     2  load("//tools:defs.bzl", "go_library", "go_test", "most_shards")
     3  load("//tools/go_generics:defs.bzl", "go_template_instance")
     4  
     5  package(
     6      default_applicable_licenses = ["//:license"],
     7      licenses = ["notice"],
     8  )
     9  
    10  declare_rwmutex(
    11      name = "addressable_endpoint_state_mutex",
    12      out = "addressable_endpoint_state_mutex.go",
    13      package = "stack",
    14      prefix = "addressableEndpointState",
    15  )
    16  
    17  declare_rwmutex(
    18      name = "address_state_mutex",
    19      out = "address_state_mutex.go",
    20      package = "stack",
    21      prefix = "addressState",
    22  )
    23  
    24  declare_rwmutex(
    25      name = "route_mutex",
    26      out = "route_mutex.go",
    27      package = "stack",
    28      prefix = "route",
    29  )
    30  
    31  declare_rwmutex(
    32      name = "route_stack_mutex",
    33      out = "route_stack_mutex.go",
    34      package = "stack",
    35      prefix = "routeStack",
    36  )
    37  
    38  declare_rwmutex(
    39      name = "stack_mutex",
    40      out = "stack_mutex.go",
    41      package = "stack",
    42      prefix = "stack",
    43  )
    44  
    45  declare_rwmutex(
    46      name = "nic_mutex",
    47      out = "nic_mutex.go",
    48      package = "stack",
    49      prefix = "nic",
    50  )
    51  
    52  declare_rwmutex(
    53      name = "packet_eps_mutex",
    54      out = "packet_eps_mutex.go",
    55      package = "stack",
    56      prefix = "packetEPs",
    57  )
    58  
    59  declare_rwmutex(
    60      name = "packet_endpoint_list_mutex",
    61      out = "packet_endpoint_list_mutex.go",
    62      package = "stack",
    63      prefix = "packetEndpointList",
    64  )
    65  
    66  declare_rwmutex(
    67      name = "transport_endpoints_mutex",
    68      out = "transport_endpoints_mutex.go",
    69      package = "stack",
    70      prefix = "transportEndpoints",
    71  )
    72  
    73  declare_rwmutex(
    74      name = "endpoints_by_nic_mutex",
    75      out = "endpoints_by_nic_mutex.go",
    76      package = "stack",
    77      prefix = "endpointsByNIC",
    78  )
    79  
    80  declare_rwmutex(
    81      name = "multi_port_endpoint_mutex",
    82      out = "multi_port_endpoint_mutex.go",
    83      package = "stack",
    84      prefix = "multiPortEndpoint",
    85  )
    86  
    87  declare_rwmutex(
    88      name = "neighbor_entry_mutex",
    89      out = "neighbor_entry_mutex.go",
    90      package = "stack",
    91      prefix = "neighborEntry",
    92  )
    93  
    94  declare_rwmutex(
    95      name = "neighbor_cache_mutex",
    96      out = "neighbor_cache_mutex.go",
    97      package = "stack",
    98      prefix = "neighborCache",
    99  )
   100  
   101  declare_rwmutex(
   102      name = "conn_mutex",
   103      out = "conn_mutex.go",
   104      package = "stack",
   105      prefix = "conn",
   106  )
   107  
   108  declare_rwmutex(
   109      name = "state_conn_mutex",
   110      out = "state_conn_mutex.go",
   111      package = "stack",
   112      prefix = "stateConn",
   113  )
   114  
   115  declare_rwmutex(
   116      name = "bucket_mutex",
   117      out = "bucket_mutex.go",
   118      nested_lock_names = ["otherTuple"],
   119      package = "stack",
   120      prefix = "bucket",
   121  )
   122  
   123  declare_rwmutex(
   124      name = "conn_track_mutex",
   125      out = "conn_track_mutex.go",
   126      package = "stack",
   127      prefix = "connTrack",
   128  )
   129  
   130  declare_rwmutex(
   131      name = "iptables_mutex",
   132      out = "iptables_mutex.go",
   133      package = "stack",
   134      prefix = "ipTables",
   135  )
   136  
   137  declare_mutex(
   138      name = "cleanup_endpoints_mutex",
   139      out = "cleanup_endpoints_mutex.go",
   140      package = "stack",
   141      prefix = "cleanupEndpoints",
   142  )
   143  
   144  declare_mutex(
   145      name = "packets_pending_link_resolution_mutex",
   146      out = "packets_pending_link_resolution_mutex.go",
   147      package = "stack",
   148      prefix = "packetsPendingLinkResolution",
   149  )
   150  
   151  go_template_instance(
   152      name = "neighbor_entry_list",
   153      out = "neighbor_entry_list.go",
   154      package = "stack",
   155      prefix = "neighborEntry",
   156      template = "//pkg/ilist:generic_list",
   157      types = {
   158          "Element": "*neighborEntry",
   159          "Linker": "*neighborEntry",
   160      },
   161  )
   162  
   163  go_template_instance(
   164      name = "tuple_list",
   165      out = "tuple_list.go",
   166      package = "stack",
   167      prefix = "tuple",
   168      template = "//pkg/ilist:generic_list",
   169      types = {
   170          "Element": "*tuple",
   171          "Linker": "*tuple",
   172      },
   173  )
   174  
   175  go_template_instance(
   176      name = "packet_buffer_refs",
   177      out = "packet_buffer_refs.go",
   178      package = "stack",
   179      prefix = "packetBuffer",
   180      template = "//pkg/refs:refs_template",
   181      types = {
   182          "T": "PacketBuffer",
   183      },
   184  )
   185  
   186  go_template_instance(
   187      name = "address_state_refs",
   188      out = "address_state_refs.go",
   189      package = "stack",
   190      prefix = "addressState",
   191      template = "//pkg/refs:refs_template",
   192      types = {
   193          "T": "addressState",
   194      },
   195  )
   196  
   197  go_library(
   198      name = "stack",
   199      srcs = [
   200          "address_state_mutex.go",
   201          "address_state_refs.go",
   202          "addressable_endpoint_state.go",
   203          "addressable_endpoint_state_mutex.go",
   204          "bucket_mutex.go",
   205          "cleanup_endpoints_mutex.go",
   206          "conn_mutex.go",
   207          "conn_track_mutex.go",
   208          "conntrack.go",
   209          "endpoints_by_nic_mutex.go",
   210          "headertype_string.go",
   211          "hook_string.go",
   212          "icmp_rate_limit.go",
   213          "iptables.go",
   214          "iptables_mutex.go",
   215          "iptables_targets.go",
   216          "iptables_types.go",
   217          "multi_port_endpoint_mutex.go",
   218          "neighbor_cache.go",
   219          "neighbor_cache_mutex.go",
   220          "neighbor_entry.go",
   221          "neighbor_entry_list.go",
   222          "neighbor_entry_mutex.go",
   223          "neighborstate_string.go",
   224          "nic.go",
   225          "nic_mutex.go",
   226          "nic_stats.go",
   227          "nud.go",
   228          "packet_buffer.go",
   229          "packet_buffer_list.go",
   230          "packet_buffer_refs.go",
   231          "packet_buffer_unsafe.go",
   232          "packet_endpoint_list_mutex.go",
   233          "packet_eps_mutex.go",
   234          "packets_pending_link_resolution_mutex.go",
   235          "pending_packets.go",
   236          "rand.go",
   237          "registration.go",
   238          "route.go",
   239          "route_mutex.go",
   240          "route_stack_mutex.go",
   241          "stack.go",
   242          "stack_mutex.go",
   243          "stack_options.go",
   244          "state_conn_mutex.go",
   245          "tcp.go",
   246          "transport_demuxer.go",
   247          "transport_endpoints_mutex.go",
   248          "tuple_list.go",
   249      ],
   250      visibility = ["//visibility:public"],
   251      deps = [
   252          "//pkg/atomicbitops",
   253          "//pkg/buffer",
   254          "//pkg/ilist",
   255          "//pkg/log",
   256          "//pkg/rand",
   257          "//pkg/refs",
   258          "//pkg/sleep",
   259          "//pkg/sync",
   260          "//pkg/sync/locking",
   261          "//pkg/tcpip",
   262          "//pkg/tcpip/checksum",
   263          "//pkg/tcpip/hash/jenkins",
   264          "//pkg/tcpip/header",
   265          "//pkg/tcpip/internal/tcp",
   266          "//pkg/tcpip/ports",
   267          "//pkg/tcpip/seqnum",
   268          "//pkg/tcpip/transport/tcpconntrack",
   269          "//pkg/waiter",
   270          "@org_golang_x_time//rate:go_default_library",
   271      ],
   272  )
   273  
   274  go_test(
   275      name = "stack_x_test",
   276      size = "small",
   277      srcs = [
   278          "addressable_endpoint_state_test.go",
   279          "ndp_test.go",
   280          "nud_test.go",
   281          "stack_test.go",
   282          "transport_demuxer_test.go",
   283          "transport_test.go",
   284      ],
   285      shard_count = most_shards,
   286      deps = [
   287          ":stack",
   288          "//pkg/buffer",
   289          "//pkg/rand",
   290          "//pkg/sync",
   291          "//pkg/tcpip",
   292          "//pkg/tcpip/checker",
   293          "//pkg/tcpip/checksum",
   294          "//pkg/tcpip/faketime",
   295          "//pkg/tcpip/header",
   296          "//pkg/tcpip/link/channel",
   297          "//pkg/tcpip/link/loopback",
   298          "//pkg/tcpip/network/arp",
   299          "//pkg/tcpip/network/ipv4",
   300          "//pkg/tcpip/network/ipv6",
   301          "//pkg/tcpip/ports",
   302          "//pkg/tcpip/prependable",
   303          "//pkg/tcpip/testutil",
   304          "//pkg/tcpip/transport/icmp",
   305          "//pkg/tcpip/transport/udp",
   306          "//pkg/waiter",
   307          "@com_github_google_go_cmp//cmp:go_default_library",
   308          "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
   309      ],
   310  )
   311  
   312  go_test(
   313      name = "stack_test",
   314      size = "small",
   315      srcs = [
   316          "conntrack_test.go",
   317          "forwarding_test.go",
   318          "iptables_test.go",
   319          "neighbor_cache_test.go",
   320          "neighbor_entry_test.go",
   321          "nic_test.go",
   322          "packet_buffer_test.go",
   323      ],
   324      library = ":stack",
   325      deps = [
   326          "//pkg/atomicbitops",
   327          "//pkg/buffer",
   328          "//pkg/sync",
   329          "//pkg/tcpip",
   330          "//pkg/tcpip/faketime",
   331          "//pkg/tcpip/header",
   332          "//pkg/tcpip/seqnum",
   333          "//pkg/tcpip/testutil",
   334          "//pkg/tcpip/transport/tcpconntrack",
   335          "@com_github_google_go_cmp//cmp:go_default_library",
   336          "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
   337      ],
   338  )