Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, can bpf_redirect_map(...) be used for interface created by VirtualBox? #71

Open
bradley-code-again opened this issue Oct 22, 2023 · 6 comments

Comments

@bradley-code-again
Copy link

Hi, thanks for you sharing.
I am trying with your code with two virtual machine created by VirtualBox on the same ubuntu host machine. VirtualBox created two local network vboxnet0 and vboxnet1, I trying to send data from vboxnet1 to vboxnet0 with your code, but it doesn't successfull.
The code runs to bpf_redirect_map(...), and I filled with the correct mac address of vboxnet0, but vboxnet0 always can't received any data at all.
I wondering if bpf_redirect_map(...) can be used with virtual network or not? thanks.

@kcl17
Copy link

kcl17 commented Oct 25, 2023

hello @bradley-code-again
can you please share your env.sh file .
Thanks

@restart-again
Copy link

Hello @kcl17
This is my env.sh, thanks.

Docker container workspace.

WORKSPACE=/workspaces

BPF_SAMPLES_DIR="${WORKSPACE}"/build/samples
BPF_BINARY_DIR="${WORKSPACE}"/build/tests

Compilation environment variable.

NUM_THREADS=

Docker environment variable.

USERNAME=oai-spgwu
IMAGE_TAG=upee
IMAGE_VERSION=v1.0
DOCKERFILE=Dockerfile
DOCKERCOMPOSEFILE=docker-compose.yml
SSH_FOLDER=/.ssh
SSH_PUBLIC_KEY_FILE=id_rsa.pub
SSH_PRIVATE_KEY_FILE=id_rsa
SSH_CONFIG_FILE=config
GIT_CONFIG=
/.gitconfig
BASH_RC=~/.bashrc

TODO navarrothiago - Remove hardcoded #24

DEVICE_IN=
DEVICE_OUT_UL=
DEVICE_OUT_DL=

TODO navarrothiago - pass as exec param.

GTP_INTERFACE=
UDP_INTERFACE=
SOCKET_BUFFER_ENABLED=0

Test environment variables.

TEST_CASE=hello_world
GTEST_FILTER_ARGS="."

Jump server.

JUMP_SERVER_NAME=
JUMP_SERVER_USERNAME=
JUMP_SERVER_IP=
JUMP_SERVER_PORT=

Trex version.

TREX_VERSION=v2.87
TREX_SHA256SUM=290c1be468335a2de2e69f217b139c9b1198732e529bfd069348d05297548b8a

Trex server configuration.

TREX_SERVER_NAME= # Warning: Optional - If you set the name, it must be configured on your ssh config.
TREX_SERVER_IP=
TREX_SERVER_ASYNC_PORT=
TREX_SERVER_SYNC_PORT=
TREX_SERVER_USERNAME=
TREX_SERVER_SSH="${TREX_SERVER_NAME}"

TREX_SERVER_SSH="${TREX_SERVER_USERNAME}"@"${TREX_SERVER_IP}"

TREX_SERVER_UPLOAD_DIR=
TREX_SERVER_DIR="${TREX_SERVER_UPLOAD_DIR}"/"${TREX_VERSION}"

Trex client configuration.

TREX_CLIENT_NAME= # Warning: Optional - If you set the name, it must be configured on your ssh config.
TREX_CLIENT_IP=
TREX_CLIENT_USERNAME=
TREX_CLIENT_SSH="${TREX_CLIENT_NAME}"

TREX_CLIENT_SSH="${TREX_CLIENT_USERNAME}"@"${TREX_CLIENT_IP}"

TREX_CLIENT_UPLOAD_DIR=
TREX_CLIENT_DIR="${TREX_CLIENT_UPLOAD_DIR}"/trex_client
TREX_CLIENT_LIB_DIR="${TREX_CLIENT_DIR}"/interactive

DUT - Device Under Test Configuration.

DUT_NAME= # Warning: Optional - If you set the name, it must be configured on your ssh config.
DUT_IP=
DUT_USERNAME=
DUT_UPLOAD_DIR=

Test local configuration.

LOCAL_CONFIG_DIR="${WORKSPACE}"/tests/trex/config
LOCAL_TRAFFIC_DIR="${WORKSPACE}"/tests/trex/traffic
LOCAL_TEST_CASES_DIR="${WORKSPACE}"/tests/trex/test_cases
LOCAL_SERVER_UPLOAD_DIR="${WORKSPACE}"/tests/trex
LOCAL_PACKAGE="${WORKSPACE}"/package

Test remote configuration

REMOTE_CONFIG_DIR="${TREX_SERVER_UPLOAD_DIR}"/config
REMOTE_TRAFFIC_DIR="${TREX_SERVER_UPLOAD_DIR}"/traffic
REMOTE_TEST_CASES_DIR="${TREX_SERVER_UPLOAD_DIR}"/test_cases

SSH port forwarding configuration

LOCAL_HTTP_SSH_PORT_FORWARDING=
LOCAL_TREX_SYNC_SSH_PORT_FORWARDING=
LOCAL_TREX_ASYNC_SSH_PORT_FORWARDING=
API_HTTP_PORT=

Programs name

API_PROGRAM_NAME=api

PYTHONPATH=/workspaces/tests/trex/trex_client/interactive/

@hrkgarg
Copy link

hrkgarg commented Oct 30, 2023

Hi @restart-again,

I dont see any changes in your env file from the default value. Are you able to compile and run as per the steps provided in the help section?

@navarrothiago
Copy link
Owner

@bradley-code-again, There might have some issue. Could you try to put your interface in the promiscuous and capture the packet on vboxnet0? I don't know if you have already tried that. Btw, the OAI guys are doing a great job improving this code. PTAL: https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf/-/tree/develop/src/upf_app

@restart-again
Copy link

@navarrothiago, many thanks for your idea and sharing. I tried with virtualbox again, it is not working. But I find it is working with a L2 link, vboxnet0 is a L3 link. I am wondering if bpf_redirect_map or bpf_redirect only works for L2 link? And in your experiment, you also configured veth somewhere, veth is also a L2 link. Is that right? thanks.

@navarrothiago
Copy link
Owner

@restart-again yes. As I recall, veth pairs was used to test locally only. See Section UTs in the README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants