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

Specifying interfaceWhitelist does not work #798

Open
rty813 opened this issue Jan 20, 2025 · 7 comments
Open

Specifying interfaceWhitelist does not work #798

rty813 opened this issue Jan 20, 2025 · 7 comments
Assignees

Comments

@rty813
Copy link

rty813 commented Jan 20, 2025

ROS2 Version: Humble

I have two hosts, each with two interconnected network interfaces: eth0 and edge0. I want them to communicate via the eth0 interface rather than the edge0. However, after specifying the interfaceWhiteList, traffic still flows through both network interfaces simultaneously.


NICs information:

Host1(Pub) Host2(Sub)
eth0 192.168.3.11/24 192.168.3.112/24
edge0 10.1.233.165/16 10.1.123.79/16

Publisher's fastrtps xml:

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>CustomUDPTransport</transport_id>
            <type>UDPv4</type>
            <interfaceWhiteList>
                <address>192.168.3.11</address>
                <address>127.0.0.1</address>
            </interfaceWhiteList>
        </transport_descriptor>
    </transport_descriptors>

    <participant profile_name="CustomUDPTransportParticipant">
        <rtps>
            <useBuiltinTransports>false</useBuiltinTransports>
            <userTransports>
                <transport_id>CustomUDPTransport</transport_id>
            </userTransports>
        </rtps>
    </participant>
</profiles>

tcpdump -i edge0 udp:

......
15:28:26.397300 IP 10.1.233.165.46534 > 10.1.123.79.7410: UDP, length 68
15:28:26.400399 IP 10.1.233.165.46534 > 10.1.123.79.7410: UDP, length 68
15:28:26.403855 IP 10.1.233.165.46534 > 10.1.123.79.7410: UDP, length 68
15:28:26.408088 IP 10.1.233.165.46534 > 10.1.123.79.7410: UDP, bad length 20652 > 1256
15:28:26.411637 IP 10.1.233.165 > 10.1.123.79: udp
15:28:36.577914 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:36.778463 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:36.979111 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:37.178606 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:37.379147 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:37.579511 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:37.780080 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:37.980124 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:38.022211 IP 10.1.233.165.46534 > 10.1.123.79.7410: UDP, length 392
15:28:38.028020 IP 10.1.233.165.34813 > 239.255.0.1.7400: UDP, length 392
15:28:38.180172 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
15:28:38.380327 IP 10.1.233.165.46534 > 10.1.123.79.7411: UDP, length 360
......

tcpdump -i eth0 udp:

......
15:32:59.227396 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
15:32:59.427499 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
15:32:59.627599 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
15:32:59.828124 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
15:33:00.028431 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
15:33:00.228654 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
15:33:00.429054 IP 192.168.3.11.46534 > 192.168.3.112.7411: UDP, length 360
......
@MiguelCompany
Copy link
Collaborator

@rty813 In order for the participant configuration to be taken into account, the profile should have is_default_profile="true" attribute.

<participant profile_name="CustomUDPTransportParticipant" is_default_profile="true">

@rty813

This comment has been minimized.

@rty813

This comment has been minimized.

@rty813
Copy link
Author

rty813 commented Jan 21, 2025

@rty813 In order for the participant configuration to be taken into account, the profile should have is_default_profile="true" attribute.

<participant profile_name="CustomUDPTransportParticipant" is_default_profile="true">

I tested it, and now the XML configuration seems to be effective, but there is still some traffic going through the edge0 network interface. If I keep only 127.0.0.1 in the whitelist, I can ensure that no messages are sent through edge0. However, if I add the IP of eth0, the messages are forwarded through both eth0 and edge0 simultaneously.

current xml:

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>CustomUDPTransport</transport_id>
            <type>UDPv4</type>
            <interfaceWhiteList>
                <address>192.168.3.112</address>
                <address>127.0.0.1</address>
            </interfaceWhiteList>
        </transport_descriptor>
    </transport_descriptors>

    <participant profile_name="CustomUDPTransportParticipant" is_default_profile="true">
        <rtps>
            <useBuiltinTransports>false</useBuiltinTransports>
            <userTransports>
                <transport_id>CustomUDPTransport</transport_id>
            </userTransports>
        </rtps>
    </participant>
</profiles>

some traffic log:

15:53:16.774441 IP 192.168.3.112.48183 > 192.168.3.11.7410: UDP, length 252
15:53:16.846314 IP 192.168.3.112.48183 > 10.1.233.165.7410: UDP, length 252
15:53:19.495888 IP 192.168.3.11.54471 > 192.168.3.112.7410: UDP, length 392
15:53:19.774495 IP 192.168.3.112.48183 > 192.168.3.11.7410: UDP, length 252
15:53:19.838977 IP 192.168.3.112.48183 > 10.1.233.165.7410: UDP, length 252
15:53:22.496013 IP 192.168.3.11.54471 > 192.168.3.112.7410: UDP, length 392
15:53:22.774601 IP 192.168.3.112.48183 > 192.168.3.11.7410: UDP, length 252
15:53:22.848379 IP 192.168.3.112.48183 > 10.1.233.165.7410: UDP, length 252

@MiguelCompany
Copy link
Collaborator

If you want to use the same XML in both hosts, put all the addresses you want to whitelist, i.e.:

            <interfaceWhiteList>
                <address>192.168.3.11</address>
                <address>192.168.3.112</address>
                <address>127.0.0.1</address>
            </interfaceWhiteList>

@MiguelCompany
Copy link
Collaborator

In ROS 2 Jazzy, you can also whitelist interface names:

            <interfaceWhiteList>
                <interface>eth0</interface>
                <interface>lo</interface>
            </interfaceWhiteList>

@rty813
Copy link
Author

rty813 commented Jan 21, 2025

If you want to use the same XML in both hosts, put all the addresses you want to whitelist, i.e.:

            <interfaceWhiteList>
                <address>192.168.3.11</address>
                <address>192.168.3.112</address>
                <address>127.0.0.1</address>
            </interfaceWhiteList>

I didn't use the same XML for both hosts, although I did try adding both IPs, but there is still traffic being transmitted through the edge0 network card.

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

2 participants