mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	fix tun/tap CIDR notation so things work on linux, may break other platforms for all I know
This commit is contained in:
		
							parent
							
								
									5dada3952c
								
							
						
					
					
						commit
						9ce7fe2e3f
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -5,6 +5,7 @@ package tuntap
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/hex"
 | 
						"encoding/hex"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
| 
						 | 
					@ -124,8 +125,9 @@ func (tun *TunAdapter) Start() error {
 | 
				
			||||||
	tun.mtu = tun.config.Current.IfMTU
 | 
						tun.mtu = tun.config.Current.IfMTU
 | 
				
			||||||
	ifname := tun.config.Current.IfName
 | 
						ifname := tun.config.Current.IfName
 | 
				
			||||||
	iftapmode := tun.config.Current.IfTAPMode
 | 
						iftapmode := tun.config.Current.IfTAPMode
 | 
				
			||||||
 | 
						addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(address.GetPrefix())-1)
 | 
				
			||||||
	if ifname != "none" {
 | 
						if ifname != "none" {
 | 
				
			||||||
		if err := tun.setup(ifname, iftapmode, net.IP(tun.addr[:]).String(), tun.mtu); err != nil {
 | 
							if err := tun.setup(ifname, iftapmode, addr, tun.mtu); err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue