[Devel] [PATCH RHEL9 COMMIT] vzeth: handle custom ioctl using .ndo_siocdevprivate() handler

Konstantin Khorenko khorenko at virtuozzo.com
Fri Feb 25 21:17:26 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-42.vz9.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-42.vz9.14.2
------>
commit 500a0a816c67875d621be0154c87b6e5f5c64827
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Feb 25 19:32:30 2022 +0300

    vzeth: handle custom ioctl using .ndo_siocdevprivate() handler
    
    After ms commit
      b9067f5dc4a0 ("net: split out SIOCDEVPRIVATE handling from dev_ioctl")
    followed by ms commit
      88fc023f7de2 ("net: socket: return changed ifreq from SIOCDEVPRIVATE")
    
    our private ioctls SIOCSVENET and SIOCSFIXEDADDR should use
    net_device_ops::ndo_siocdevprivate() handler instead of old
    .ndo_do_ioctl().
    
    Otherwise we simply get -EOPNOTSUPP on ioctl.
    
    https://jira.sw.ru/browse/PSBM-139005
    Fixes: b9dc6a599138 ("vzeth: bits and pieces of our interface")
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/net/veth.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index a5e1b1458daf..356d1cea239f 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1570,7 +1570,8 @@ static int veth_mac_addr(struct net_device *dev, void *p)
 	return eth_mac_addr(dev, p);
 }
 
-static int vzethdev_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+static int vzethdev_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
+				   void __user *data, int cmd)
 {
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
@@ -1621,7 +1622,7 @@ static const struct net_device_ops veth_netdev_ops = {
 	.ndo_get_peer_dev	= veth_peer_dev,
 #ifdef CONFIG_VE
 	.ndo_set_mac_address	= veth_mac_addr,
-	.ndo_do_ioctl		= vzethdev_net_ioctl,
+	.ndo_siocdevprivate	= vzethdev_siocdevprivate,
 #else
 	.ndo_set_mac_address	= eth_mac_addr,
 #endif


More information about the Devel mailing list