On Wed, 11 Dec 2024 at 21:32, Antonio Quartulli <antonio@xxxxxxxxxxx> wrote: > > static int ovpn_newlink(struct net *src_net, struct net_device *dev, > struct nlattr *tb[], struct nlattr *data[], > struct netlink_ext_ack *extack) > { > - return -EOPNOTSUPP; > + struct ovpn_priv *ovpn = netdev_priv(dev); > + enum ovpn_mode mode = OVPN_MODE_P2P; > + > + if (data && data[IFLA_OVPN_MODE]) { > + mode = nla_get_u8(data[IFLA_OVPN_MODE]); > + netdev_dbg(dev, "setting device mode: %u\n", mode); > + } > + > + ovpn->dev = dev; > + ovpn->mode = mode; > + > + /* turn carrier explicitly off after registration, this way state is > + * clearly defined > + */ > + netif_carrier_off(dev); > + > + return register_netdevice(dev); > } > > static struct rtnl_link_ops ovpn_link_ops = { > .kind = "ovpn", > .netns_refund = false, > + .priv_size = sizeof(struct ovpn_priv), > + .setup = ovpn_setup, > + .policy = ovpn_policy, > + .maxtype = IFLA_OVPN_MAX, > .newlink = ovpn_newlink, > .dellink = unregister_netdevice_queue, > }; You need to implement .fill_info to add IFLA_OVPN_MODE into get / dump ops.