(t *testing.T)
| 279 | } |
| 280 | |
| 281 | func TestShouldProcessInbound(t *testing.T) { |
| 282 | testCases := []struct { |
| 283 | name string |
| 284 | pkt *packet.Parsed |
| 285 | afterStart func(*Impl) // optional; after Impl.Start is called |
| 286 | beforeStart func(*Impl) // optional; before Impl.Start is called |
| 287 | want bool |
| 288 | runOnGOOS string |
| 289 | }{ |
| 290 | { |
| 291 | name: "ipv6-via", |
| 292 | pkt: &packet.Parsed{ |
| 293 | IPVersion: 6, |
| 294 | IPProto: ipproto.TCP, |
| 295 | Src: netip.MustParseAddrPort("100.101.102.103:1234"), |
| 296 | |
| 297 | // $ tailscale debug via 7 10.1.1.9/24 |
| 298 | // fd7a:115c:a1e0:b1a:0:7:a01:109/120 |
| 299 | Dst: netip.MustParseAddrPort("[fd7a:115c:a1e0:b1a:0:7:a01:109]:5678"), |
| 300 | TCPFlags: packet.TCPSyn, |
| 301 | }, |
| 302 | afterStart: func(i *Impl) { |
| 303 | prefs := ipn.NewPrefs() |
| 304 | prefs.AdvertiseRoutes = []netip.Prefix{ |
| 305 | // $ tailscale debug via 7 10.1.1.0/24 |
| 306 | // fd7a:115c:a1e0:b1a:0:7:a01:100/120 |
| 307 | netip.MustParsePrefix("fd7a:115c:a1e0:b1a:0:7:a01:100/120"), |
| 308 | } |
| 309 | i.lb.Start(ipn.Options{ |
| 310 | UpdatePrefs: prefs, |
| 311 | }) |
| 312 | i.atomicIsLocalIPFunc.Store(looksLikeATailscaleSelfAddress) |
| 313 | }, |
| 314 | beforeStart: func(i *Impl) { |
| 315 | // This should be handled even if we're |
| 316 | // otherwise not processing local IPs or |
| 317 | // subnets. |
| 318 | i.ProcessLocalIPs = false |
| 319 | i.ProcessSubnets = false |
| 320 | }, |
| 321 | want: true, |
| 322 | }, |
| 323 | { |
| 324 | name: "ipv6-via-not-advertised", |
| 325 | pkt: &packet.Parsed{ |
| 326 | IPVersion: 6, |
| 327 | IPProto: ipproto.TCP, |
| 328 | Src: netip.MustParseAddrPort("100.101.102.103:1234"), |
| 329 | |
| 330 | // $ tailscale debug via 7 10.1.1.9/24 |
| 331 | // fd7a:115c:a1e0:b1a:0:7:a01:109/120 |
| 332 | Dst: netip.MustParseAddrPort("[fd7a:115c:a1e0:b1a:0:7:a01:109]:5678"), |
| 333 | TCPFlags: packet.TCPSyn, |
| 334 | }, |
| 335 | afterStart: func(i *Impl) { |
| 336 | prefs := ipn.NewPrefs() |
| 337 | prefs.AdvertiseRoutes = []netip.Prefix{ |
| 338 | // tailscale debug via 7 10.1.2.0/24 |
nothing calls this directly
no test coverage detected
searching dependent graphs…