Page MenuHomeFreeBSD

if_tun: Enable tun devices to be used with netmap
AbandonedPublic

Authored by thj on Nov 18 2022, 4:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 10:23 AM
Unknown Object (File)
Feb 23 2024, 2:37 AM
Unknown Object (File)
Feb 22 2024, 9:02 AM
Unknown Object (File)
Feb 5 2024, 4:12 PM
Unknown Object (File)
Dec 20 2023, 7:53 AM
Unknown Object (File)
Dec 19 2023, 8:26 PM
Unknown Object (File)
Dec 10 2023, 1:31 AM
Unknown Object (File)
Oct 28 2023, 7:11 PM

Details

Reviewers
None
Group Reviewers
Klara
Summary

This requires that a pseudo ethernet header be created so the netmap
processing hooks can pick up on packets coming from tun devices.

Test Plan

Testing was done using the modified netcat from https://reviews.freebsd.org/D37435

#!/bin/sh

. /code/freebsd/worktrees/netmap/tests/sys/common/vnet.subr

nmbridge="/usr/obj/code/freebsd/worktrees/netmap/amd64.amd64/tools/tools/netmap/bridge"
pktgen="/usr/obj/code/freebsd/worktrees/netmap/amd64.amd64/tools/tools/netmap/pkt-gen"
nc="/usr/obj/code/freebsd/worktrees/netmap/amd64.amd64/usr.bin/nc/nc"

vnet_init

epair=$(vnet_mkepair)

tun_duke=$(ifconfig tun create)
tun_bass=$(ifconfig tun create)

vnet_mkjail duke ${epair}a ${tun_duke}
vnet_mkjail bass ${epair}b ${tun_bass}

jexec duke ifconfig ${epair}a inet 10.0.0.1/24 up
jexec bass ifconfig ${epair}b inet 10.0.0.2/24 up

jexec duke $nc -u -l --tun /dev/${tun_duke} 10.0.0.1 2600 &
jexec bass $nc -u --tun /dev/${tun_bass} 10.0.0.1 2600 &

jexec duke ifconfig ${tun_duke} inet 10.100.0.1/24 10.100.0.2 up
jexec bass ifconfig ${tun_bass} inet 10.100.0.2/24 10.100.0.1 up

jexec bass ping -c 1 10.100.0.1

if [ $? -ne 0 ]
then
        echo "ping over tunnel failed"
fi

echo "test environment ready for testing"

echo "duke tun ${tun_duke}"
echo "bass tun ${tun_bass}"

echo "run the following command somewhere else, hit enter to start sending traffic"
echo "sudo jexec duke ${pktgen} -f rx -i ${tun_duke}"

read tmp

jexec bass ${pktgen} -f tx -i ${tun_bass} -n 1000000000 -l 60 -d 198.19.0.1:2000-198.19.0.100 -D a0:36:9f:1e:28:14 -s 198.18.0.1:2000-198.18.0.20 -w 4

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Warnings
SeverityLocationCodeMessage
Warningsys/dev/netmap/if_tun_netmap.h:38SPELL1Possible Spelling Mistake
Unit
No Test Coverage
Build Status
Buildable 48422
Build 45308: arc lint + arc unit