[PATCH net-next v17 04/25] ovpn: keep carrier always on for MP interfaces

From: Antonio Quartulli
Date: Fri Jan 10 2025 - 17:27:21 EST


An ovpn interface configured in MP mode will keep carrier always
on and let the user decide when to bring it administratively up and
down.

This way a MP node (i.e. a server) will keep its interface always
up and running, even when no peer is connected.

Signed-off-by: Antonio Quartulli <antonio@xxxxxxxxxxx>
---
drivers/net/ovpn/main.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/net/ovpn/main.c b/drivers/net/ovpn/main.c
index d3eebab7fa528cb648141021ab513c3ed687e698..97fcf284c06654a6581be592e45f77f0f78f566f 100644
--- a/drivers/net/ovpn/main.c
+++ b/drivers/net/ovpn/main.c
@@ -23,6 +23,15 @@

static int ovpn_net_open(struct net_device *dev)
{
+ struct ovpn_priv *ovpn = netdev_priv(dev);
+
+ /* carrier for P2P interfaces is switched on and off when
+ * the peer is added or deleted.
+ *
+ * in case of P2MP interfaces we just keep the carrier always on
+ */
+ if (ovpn->mode == OVPN_MODE_MP)
+ netif_carrier_on(dev);
netif_tx_start_all_queues(dev);
return 0;
}

--
2.45.2