mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-19 03:58:36 +00:00
wgengine/wgcfg: restore Config.ListenPort for cmd/lopower
It was removed for being unnecessary in 69cdc30c6d41aab2 in 2021 but now we need it for lopower. Change-Id: I62aca850ad820a83475c8ef7655a08981f23a27f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
6b69efe91a
commit
507c359a44
@ -21,6 +21,7 @@ type Config struct {
|
|||||||
NodeID tailcfg.StableNodeID
|
NodeID tailcfg.StableNodeID
|
||||||
PrivateKey key.NodePrivate
|
PrivateKey key.NodePrivate
|
||||||
Addresses []netip.Prefix
|
Addresses []netip.Prefix
|
||||||
|
ListenPort uint16 // not used by Tailscale's conn.Bind implementation
|
||||||
MTU uint16
|
MTU uint16
|
||||||
DNS []netip.Addr
|
DNS []netip.Addr
|
||||||
Peers []Peer
|
Peers []Peer
|
||||||
|
@ -124,7 +124,13 @@ func (cfg *Config) handleDeviceLine(k, value mem.RO, valueBytes []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case k.EqualString("listen_port") || k.EqualString("fwmark"):
|
case k.EqualString("listen_port"):
|
||||||
|
port, err := mem.ParseUint(value, 10, 16)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to parse listen_port: %w", err)
|
||||||
|
}
|
||||||
|
cfg.ListenPort = uint16(port)
|
||||||
|
case k.EqualString("fwmark"):
|
||||||
// ignore
|
// ignore
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unexpected IpcGetOperation key: %q", k.StringCopy())
|
return fmt.Errorf("unexpected IpcGetOperation key: %q", k.StringCopy())
|
||||||
|
@ -39,6 +39,7 @@ var _ConfigCloneNeedsRegeneration = Config(struct {
|
|||||||
NodeID tailcfg.StableNodeID
|
NodeID tailcfg.StableNodeID
|
||||||
PrivateKey key.NodePrivate
|
PrivateKey key.NodePrivate
|
||||||
Addresses []netip.Prefix
|
Addresses []netip.Prefix
|
||||||
|
ListenPort uint16
|
||||||
MTU uint16
|
MTU uint16
|
||||||
DNS []netip.Addr
|
DNS []netip.Addr
|
||||||
Peers []Peer
|
Peers []Peer
|
||||||
|
@ -42,6 +42,9 @@ func (cfg *Config) ToUAPI(logf logger.Logf, w io.Writer, prev *Config) error {
|
|||||||
if !prev.PrivateKey.Equal(cfg.PrivateKey) {
|
if !prev.PrivateKey.Equal(cfg.PrivateKey) {
|
||||||
set("private_key", cfg.PrivateKey.UntypedHexString())
|
set("private_key", cfg.PrivateKey.UntypedHexString())
|
||||||
}
|
}
|
||||||
|
if prev.ListenPort != cfg.ListenPort {
|
||||||
|
setUint16("listen_port", cfg.ListenPort)
|
||||||
|
}
|
||||||
|
|
||||||
old := make(map[key.NodePublic]Peer)
|
old := make(map[key.NodePublic]Peer)
|
||||||
for _, p := range prev.Peers {
|
for _, p := range prev.Peers {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user