Skip to content

Commit

Permalink
add dns cidr route when using custom diverter.
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything committed Feb 12, 2024
1 parent 0f6eb50 commit 39697c6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tunnel/intercept/tproxy/tproxy_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ func New(config Config) (intercept.Interceptor, error) {
log.Infof("tproxy config: udpIdleTimeout = [%s]", self.udpIdleTimeout.String())
log.Infof("tproxy config: udpCheckInterval = [%s]", self.udpCheckInterval.String())

dnsNet := intercept.GetDnsInterceptIpRange()
err := router.AddLocalAddress(dnsNet, "lo")
if err != nil {
log.WithError(err).Errorf("unable to add %v to lo", dnsNet)
return nil, err
}

if self.diverter != "" {
cmd := exec.Command(self.diverter, "-V")
out, err := cmd.CombinedOutput()
Expand Down Expand Up @@ -137,8 +144,6 @@ func New(config Config) (intercept.Interceptor, error) {
logrus.Infof("no lan interface specified with '-lanIf'. please ensure firewall accepts intercepted service addresses")
}

dnsNet := intercept.GetDnsInterceptIpRange()
err = router.AddLocalAddress(dnsNet, "lo")
return self, err
}

Expand Down

0 comments on commit 39697c6

Please sign in to comment.