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)
Wed, Dec 18, 1:04 PM
Unknown Object (File)
Nov 16 2024, 3:40 PM
Unknown Object (File)
Nov 16 2024, 1:36 PM
Unknown Object (File)
Nov 12 2024, 3:18 AM
Unknown Object (File)
Nov 8 2024, 10:10 PM
Unknown Object (File)
Sep 13 2024, 4:19 AM
Unknown Object (File)
Sep 2 2024, 8:06 AM
Unknown Object (File)
Aug 15 2024, 7:21 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