Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Fix several problems with the Device Information TLV #825

Merged
merged 4 commits into from
Feb 16, 2020

Conversation

arnout
Copy link
Collaborator

@arnout arnout commented Feb 12, 2020

As reported by @mariomaz, the Device Information TLV was not correct.
This PR fixes all of the issues.

Unfortunately, since we don't inspect the packets sent over the wire, it's not possible to add a test to test_flows.

@arnout
Copy link
Collaborator Author

arnout commented Feb 12, 2020

Although I'm Author of these commits, everything was done together with Mario.

Copy link
Collaborator

@tomereli tomereli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

std::shared_ptr<ieee1905_1::cLocalInterfaceInfo> localInterfaceInfo =
tlvDeviceInformation->create_local_interface_list();

ieee1905_1::eMediaType media_type = ieee1905_1::eMediaType::UNKNONWN_MEDIA;
if (SPEED_100 == speed) {
media_type = ieee1905_1::eMediaType::IEEE_802_3U_FAST_ETHERNET;
} else if (SPEED_1000 == speed) {
} else if (SPEED_1000 <= speed) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a catch all for very unlikely case of a bad 10 Mbps link?

media_type = ieee1905_1::eMediaType::IEEE_802_3U_FAST_ETHERNET;
if (SPEED_1000 <= speed) {
    media_type = ieee1905_1::eMediaType::IEEE_802_3AB_GIGABIT_ETHERNET;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to explain in the commit message what we intentionally don't do that. Actually the catch-all for gigabit is not ideal either.

Copy link
Collaborator

@dob71 dob71 Feb 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I thought that too at first, but then looked in the spec. It requires to report media type IEEE 802.3u (Fast Ethernet) vs IEEE 802.3ab (Gigabit Ethernet). I do not know of a better way, but using current (negotiated) link speed to decide the media type is flawed in the first place. That's why IMO the right thing to do is the best guess/closest match (as you did for 10Gbps).
Strictly speaking your changes already make it better, so this is just a suggestion.

ip link add wlan0 address "${base_mac}:00:10" type dummy
ip link add wlan2 address "${base_mac}:00:20" type dummy
ip link set dev wlan0 up
ip link set dev wlan2 up
for iface in wlan0 wlan2 @BEEROCKS_BH_WIRE_IFACE@ $DATA_IFACE
for iface in wlan0 wlan2 $DATA_IFACE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this one. Isn't it the purpose of the platform_init code to make (for Linux target) a bridge and put wireless and wired interfaces under similarly to a typical AP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DATA_IFACE is supposed to be the wired backhaul interface. I also tried to explain that in the commit message.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't read the commit messages, just the review. No more references to BEEROCKS_BH_WIRE_IFACE in the script and passing the interface name in as a parameter sounds good.

@arnout arnout force-pushed the hotfix/device-information-fixes branch from c4aa1b8 to 1bc4134 Compare February 13, 2020 10:37
To generate the Device Information TLV, we use ethtool for wired
interfaces. However, the dummy interface we use for sim-eth0 in docker
doesn't support ethtool. Therefore, it will error with "operation not
supported".

To be able to generate valid Device Information TLV also in docker, use
eth0 instead of sim-eth0.

sim-eth0 was introduced in commit d16115c to avoid messing up
the host when prplmesh-utils.sh is used natively instead of in docker.
However, since then, prplmesh-utils.sh has been updated with a
DATA_IFACE option, which would/should be eth0. Also, the docker images
no longer use prplmesh-utils.sh to set up the interfaces. Therefore,
remove the sim-eth0 dummy interface from prplmesh-utils.sh as well. It
is no longer used.

Remove the sim-eth0 dummy interface from the docker entrypoint as well.

Note that leaving the dummy interface in prplmesh-utils.sh and in docker
entrypoint does not hurt. It's just not needed any more.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
The Device Information TLV contains a list of interfaces. We currently
put the bridge in it, but this is not actually an interface we should
put in there. Instead, we should put the backhaul interface in it.

Since we currently only support wired backhaul, use wired_iface.

Note that the wireless interfaces should also be added here, but
currently we don't have an easy way to get their speed (i.e. 802.11
subspec), so we simply don't add them. There is already a TODO comment
that explains this.

Note that the other wired interfaces that are in the bridge should also
be mentioned in the interfaces list, but currently we don't.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
The IEEE 1905.1 specification only supports 2 Ethernet media types:
100Mbps and 1Gbps. However, many more media types faster than 1Gbps
exist. In fact, the virtual ethernet interface which is used in docker
is represented as a 10Gbps interface.

Since we don't want to report "unknown media" in our tests, use 1Gbps
for all Ethernet speeds larger than 1Gbps.

Smaller speeds are kept as "unknown media".

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
eMediaType is a 16-bit enum, so it must be swapped. This is currently
not done, which results in the wrong values sent over the wire.

To fix this, do swapping for all enums, based on the size of the type.
This does result in redundant swaps for the 8-bit enums, but that is
negligible. In addition, tlvf_swap is inlined anyway so when optimising
the code will be removed entirely.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
@tomereli tomereli force-pushed the hotfix/device-information-fixes branch from 1bc4134 to df33317 Compare February 16, 2020 08:11
@tomereli tomereli merged commit 5755af3 into master Feb 16, 2020
@tomereli tomereli deleted the hotfix/device-information-fixes branch February 16, 2020 08:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants