wg: Implement if_transmit unconditionally

Commit bf454ca88bdf made wg_transmit() defined only when "device netmap"
is configured, as if_wg's if_transmit implementation should never be
called otherwise, but this breaks a requirement that interfaces
implement both or neither of if_transmit and if_qflush.

Restore the old behaviour of unconditionally defining wg_transmit().  It
contains an assertion that the interface is in netmap mode.

Reported by:	peterj
MFC after:	2 weeks
Fixes:	bf454ca88bdf ("wg: Add netmap support")

(cherry picked from commit 5515e8874a8d85a8d961fca64c494dfc1bea4bd0)
This commit is contained in:
Mark Johnston 2024-06-16 13:33:45 -04:00
parent c39d01d73c
commit a9a57c8432

View file

@ -2194,7 +2194,6 @@ determine_af_and_pullup(struct mbuf **m, sa_family_t *af)
return (0);
}
#ifdef DEV_NETMAP
static int
determine_ethertype_and_pullup(struct mbuf **m, int *etp)
{
@ -2256,6 +2255,7 @@ wg_transmit(if_t ifp, struct mbuf *m)
return (0);
}
#ifdef DEV_NETMAP
/*
* This should only be invoked by netmap, via nm_os_send_up(), to process
* packets from the host TX ring.
@ -2919,8 +2919,8 @@ wg_clone_create(struct if_clone *ifc, char *name, size_t len,
if_setinitfn(ifp, wg_init);
if_setreassignfn(ifp, wg_reassign);
if_setqflushfn(ifp, wg_qflush);
#ifdef DEV_NETMAP
if_settransmitfn(ifp, wg_transmit);
#ifdef DEV_NETMAP
if_setinputfn(ifp, wg_if_input);
#endif
if_setoutputfn(ifp, wg_output);