@@ -572,36 +572,31 @@ func (t *NativeTun) rules() []*netlink.Rule {
572
572
priority ++
573
573
}
574
574
if p6 {
575
- // FIXME: this match connections from public address
576
- it = netlink .NewRule ()
577
- it .Priority = priority6
578
- it .Table = t .options .TableIndex
579
- it .Family = unix .AF_INET6
580
- rules = append (rules , it )
575
+ if ! t .options .StrictRoute {
576
+ it = netlink .NewRule ()
577
+ it .Priority = priority6
578
+ it .IifName = "lo"
579
+ it .Src = netip .PrefixFrom (netip .IPv6Unspecified (), 1 )
580
+ it .Goto = nopPriority
581
+ it .Family = unix .AF_INET6
582
+ rules = append (rules , it )
581
583
582
- /* it = netlink.NewRule()
583
- it.Priority = priority
584
- it.Invert = true
585
- it.IifName = "lo"
586
- it.Table = tunTableIndex
587
- it.Family = unix.AF_INET6
588
- rules = append(rules, it)
584
+ it = netlink .NewRule ()
585
+ it .Priority = priority6
586
+ it .IifName = "lo"
587
+ it .Src = netip . PrefixFrom ( netip . AddrFrom16 ([ 16 ] byte { 0 : 128 }), 1 )
588
+ it .Goto = nopPriority
589
+ it .Family = unix .AF_INET6
590
+ rules = append (rules , it )
589
591
590
- it = netlink.NewRule()
591
- it.Priority = priority
592
- it.IifName = "lo"
593
- it.Src = netip.PrefixFrom(netip.IPv6Unspecified(), 128) // not working
594
- it.Table = tunTableIndex
595
- it.Family = unix.AF_INET6
596
- rules = append(rules, it)
592
+ priority6 ++
593
+ }
597
594
598
595
it = netlink .NewRule ()
599
- it.Priority = priority
600
- it.IifName = "lo"
601
- it.Src = t.options.Inet6Address.Masked()
602
- it.Table = tunTableIndex
596
+ it .Priority = priority6
597
+ it .Table = t .options .TableIndex
603
598
it .Family = unix .AF_INET6
604
- rules = append(rules, it)*/
599
+ rules = append (rules , it )
605
600
priority6 ++
606
601
}
607
602
if p4 {
0 commit comments