diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:46 +0000 |
commit | 96647a898d62d699808316238dfb933d960413f2 (patch) | |
tree | 0138491ada40b7b3fcb80d4b219fa7922ae8f512 /src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c | |
parent | Adding debian version 7.0.14-dfsg-4. (diff) | |
download | virtualbox-96647a898d62d699808316238dfb933d960413f2.tar.xz virtualbox-96647a898d62d699808316238dfb933d960413f2.zip |
Merging upstream version 7.0.16-dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c')
-rw-r--r-- | src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c index eaf07e8c..85777fa1 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c +++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c @@ -73,6 +73,7 @@ #include <VBox/intnetinline.h> #include <VBox/vmm/pdmnetinline.h> #include <VBox/param.h> +#include <VBox/VBoxLnxModInline.h> #include <iprt/alloca.h> #include <iprt/assert.h> #include <iprt/spinlock.h> @@ -166,6 +167,17 @@ typedef struct VBOXNETFLTNOTIFIER *PVBOXNETFLTNOTIFIER; # endif #endif +#if RTLNX_VER_MIN(6,9,0) +# define VBOX_SKB_FRAG_LEN(_pFrag) ((_pFrag)->len) +# define VBOX_SKB_FRAG_OFFSET(_pFrag) ((_pFrag)->offset) +#elif RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2) +# define VBOX_SKB_FRAG_LEN(_pFrag) ((_pFrag)->bv_len) +# define VBOX_SKB_FRAG_OFFSET(_pFrag) ((_pFrag)->bv_offset) +#else /* < KERNEL_VERSION(5, 4, 0) */ +# define VBOX_SKB_FRAG_LEN(_pFrag) ((_pFrag)->size) +# define VBOX_SKB_FRAG_OFFSET(_pFrag) ((_pFrag)->page_offset) +#endif /* > KERNEL_VERSION(6, 9, 0) */ + #if RTLNX_VER_MIN(3,20,0) || RTLNX_RHEL_RANGE(7,2, 8,0) || RTLNX_RHEL_RANGE(6,8, 7,0) # define VBOX_HAVE_SKB_VLAN #endif @@ -273,6 +285,11 @@ unsigned dev_get_flags(const struct net_device *dev) static int __init VBoxNetFltLinuxInit(void) { int rc; + + /* Check if modue loading was disabled. */ + if (!vbox_mod_should_load()) + return -EINVAL; + /* * Initialize IPRT. */ @@ -926,13 +943,8 @@ static void vboxNetFltLinuxSkBufToSG(PVBOXNETFLTINS pThis, struct sk_buff *pBuf, for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++) { skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i]; -# if RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2) - pSG->aSegs[iSeg].cb = pFrag->bv_len; - pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset; -# else /* < KERNEL_VERSION(5, 4, 0) */ - pSG->aSegs[iSeg].cb = pFrag->size; - pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset; -# endif /* >= KERNEL_VERSION(5, 4, 0) */ + pSG->aSegs[iSeg].cb = VBOX_SKB_FRAG_LEN(pFrag); + pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + VBOX_SKB_FRAG_OFFSET(pFrag); Log6((" %p", pSG->aSegs[iSeg].pv)); pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS; Assert(iSeg <= pSG->cSegsAlloc); @@ -947,13 +959,8 @@ static void vboxNetFltLinuxSkBufToSG(PVBOXNETFLTINS pThis, struct sk_buff *pBuf, for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++) { skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i]; -# if RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2) - pSG->aSegs[iSeg].cb = pFrag->bv_len; - pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset; -# else /* < KERNEL_VERSION(5, 4, 0) */ - pSG->aSegs[iSeg].cb = pFrag->size; - pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset; -# endif /* >= KERNEL_VERSION(5, 4, 0) */ + pSG->aSegs[iSeg].cb = VBOX_SKB_FRAG_LEN(pFrag); + pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + VBOX_SKB_FRAG_OFFSET(pFrag); Log6((" %p", pSG->aSegs[iSeg].pv)); pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS; Assert(iSeg <= pSG->cSegsAlloc); |