Yes, you missed one element in the net_device_ops structure
Add .ndo_start_xmit , and the function should return NETDEV_TX_OK or NETDEV_TX_BUSY.
use as follows
static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) { return NETDEV_TX_OK; }
And also change open as
static int veth_open(struct net_device *dev) { memcpy(dev->dev_addr, "\0ABCD0", ETH_ALEN); netif_start_queue(dev); return 0; }
Then in veth_ops
static struct net_device_ops veth_ops = { .ndo_init = veth_dev_init, .ndo_open = veth_open, .ndo_stop = veth_close, .ndo_start_xmit = veth_xmit, .ndo_do_ioctl = veth_ioctl, };
Then after inserting the module
specify ifconfig my_dev 192.168.10.98 ...
source share