We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dfb9976 commit 63b0aa2Copy full SHA for 63b0aa2
internal/tunnel/tunnel.go
@@ -87,6 +87,17 @@ func New(opts PeerOpts) (*Tunnel, error) {
87
return nil, fmt.Errorf("error bringing up the link: %w", err)
88
}
89
90
+ // Add route for the entire CIDR range through this interface.
91
+ // This is needed for userspace WireGuard since kernel doesn't automatically
92
+ // add routes like it does for kernel WireGuard.
93
+ route := &netlink.Route{
94
+ Dst: cidrNet, // 10.100.0.0/24
95
+ LinkIndex: link.Attrs().Index, // wg0 interface
96
+ }
97
+ if err = netlink.RouteAdd(route); err != nil {
98
+ return nil, fmt.Errorf("error adding route for CIDR %s: %w", opts.CIDR, err)
99
100
+
101
// Decode the private key.
102
pk, err := encodeBase64ToHex(opts.PrivateKey)
103
if err != nil {
0 commit comments