Skip to content

ignore linux error: File exists while add same route twice#747

Merged
ginuerzh merged 1 commit into
ginuerzh:masterfrom
wencaiwulue:master
Aug 22, 2021
Merged

ignore linux error: File exists while add same route twice#747
ginuerzh merged 1 commit into
ginuerzh:masterfrom
wencaiwulue:master

Conversation

@wencaiwulue

Copy link
Copy Markdown
Contributor
naison@naison-virtual-machine:~$ sudo ip route add 10.10.0.0/16 dev tun0
[sudo] password for naison: 
naison@naison-virtual-machine:~$ sudo ip route add 10.10.0.0/16 dev tun0
RTNETLINK answers: File exists
naison@naison-virtual-machine:~$ 

Linux如果重复添加相同路由,会报错已经存在,window和macOS不会报这样的错误。因此这里加上忽略已经存在的路由。

2021/08/21 11:19:21 tuntap_linux.go:40: [tun] ip link set dev tun0 mtu 1350
2021/08/21 11:19:21 tuntap_linux.go:47: [tun] ip address add 223.254.254.2/24 dev tun0
2021/08/21 11:19:21 tuntap_linux.go:54: [tun] ip link set dev tun0 up
2021/08/21 11:19:21 tuntap_linux.go:151: [tun] ip route add 10.10.0.0/16 dev tun0
2021/08/21 11:19:21 main.go:88: ip route add 10.10.0.0/16 dev tun0: file exists

@ginuerzh ginuerzh merged commit 8f08304 into ginuerzh:master Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants