-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sliptty: introduce a new SLIP to TUN tool #10477
Conversation
ca5d846
to
66aeb28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments below. Will test this later but not much time right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some new comments
The ethos script has a hack to make the Linux host use a proper source address when the host has no IPv6 global addresses configured (any address not beginning in fe80::). ip a a fd00:dead:beef::1/128 dev lo Without this hack and without any other global IPv6 addresses configured on the Linux machine, the outgoing packets directed to global addresses on the RIOT nodes will have the correct destination address, but in lack of global addresses, the source address will be the automatic link local address of the tun0 interface (not fe80::1, but the fe80::random:numbers address). The RIOT node messes up because of missing neighbor entry for the tun0 LL addr and sends replies over the wireless instead. I don't like the hack, but it is unrelated to this PR to fix the neighbor configuration for the point-to-point tunnel interface. |
Sounds more like the RIOT node somewhere loses the interface context :-/. Really hard for me to debug for me, since I don't have access to a machine that has no global IPv6 address. But I try to find one :D (or set-up a VM for that). |
The culprit is this netif rewrite RIOT/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c Lines 619 to 623 in 469c31c
Now I'm unsure what the correct behavior would be. IMHO, since the global address is on the other interface, but the source is link-local address I'd say sending a ICMPv6 error destination unreachable (beyond scope of source address) back to the originator and dropping the packet. |
(which it actually does in RIOT/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c Lines 758 to 761 in 469c31c
|
@gebart regardless, I'd rather merge without the hack and find a satisfactory fix for this. Do you agree? |
Because we apparently never fixed that bug, because the hack was shadowing it ;-). |
@miri64 I agree, let's fix it properly in a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the RIOT side handle empty SLIP frames?
draft-bormann-t2trg-slipmux-02 recommends using SLIP_END both at the start and the end of the frame, currently we only use SLIP_END at the end of the frame.
https://tools.ietf.org/html/draft-bormann-t2trg-slipmux-02#section-6
To make SLIP framing robust, it is important to send SLIP frame delimiters (0xc0) before and after each SLIP frame (maybe unless frames follow each other back to back). This means that empty frames need to be silently ignored by a receiver.
Have to check. |
Code-wise it should be able to. I don't have the ability to test at the moment... |
@gebart I compiled sudo ip link set up dev sl0
sudo ip address add fe80::1/64 dev sl0
sudo ip neigh add fe80::2 dev sl0 I then tried to ping the node which worked:
I then terminated echo "c0c0" | xxd -r -p > /dev/ttyUSB0
echo "c060c0" | xxd -r -p > /dev/ttyUSB0
echo "c06000c0" | xxd -r -p > /dev/ttyUSB0 I see nothing wrong with the output:
So in conclusion: The RIOT side is able to handle empty SLIP frames ;-) |
BTW the one-byte packet is declined in RIOT/sys/net/gnrc/netif/gnrc_netif_raw.c Line 68 in d6cad3c
This doesn't seem right to me in combination with the comment, but not harmful either. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
What's the advantage of SLIP over ethos? |
It is simpler (no intermediate MAC layer) and a
As SLIP only uses byte stuffing, while |
I merged just the current master and used an FTDI adapter with a samr21-xpro for the SLIP connection via the second UART and I did not have those problems using
Same from the host side:
I also double checked that the length field contains in fact the bytes Maybe the bug is in #10480, so can you please retry without it? |
Yup, works like a charm when used standalone! Feel free to squash - want to integrate it into |
It is already. The change of |
It's still pretty handy as it takes all the prefix/baudrate/port parameters straight from the |
But then again: this disables |
Fair enough … How about # TODO uncomment after #10480 is merged
# TERMPROG ?= sudo sh $(RIOTTOOLS)/sliptty/start_network.sh
# TERMFLAGS ?= $(IPV6_PREFIX) $(PORT) $(SLIP_BAUDRATE) So people who want to use SLIP already (and don't care so much about stdout) don't have to memorize/figure out the right start parameters themself. |
They can also still use |
But I'd still have to search for the configuration of Well then, guess I have to forego this bit of comfort for now - please squash. |
IMHO the comfort you seek is a trap ;-). |
I will rebase and adapt #10480 to your wishes as soon as this PR is merged :-) |
fc69a75
to
917ba19
Compare
Squashed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Linux with and without #10480
stdio output over SLIPMUX works, but connection errors occur.
stable connection without SLIPMUX, 2000000 Baud over FT232L worked without issues.
Note: #10480 does not really implement SLIPMUX, as SLIPMUX includes a CoAP parser ;-) |
Well of course, why wouldn't it! 😆 |
How do they say: When you've invented a hammer, everything starts to look like a nail. |
But that's basically it. The assumption of SLIPMUX is: you already have an IoT node there that is talked to by CBOR via CoAP, so why not re-use those parsers instead of requiring new ones. |
(+ if you don't support the full feature set a CoAP message parser could be as minimal as a simple whitespace tokenizer, maybe even more minimal). |
Yea but as a debugging tool, you don't want the added complexity. |
That's why you still have the diagnostic channel (which in an extended way [due to its bidirectionality] #10480 basically implemented) |
Contribution description
sliptty
is a new tool for SLIP-to-TUN dispatching. In comparison totunslip6
it is made to be very stripped down (592 vs 1294 loc). However, in addition to that it supports stdio packet formats according to SLIPMUX (however not the CoAP part - yet).Some stuff was taken from
ethos
to ensure IoT-LAB support and some stuff fromtunslip6
and #6718 to ensure MacOSX support.Testing procedure
The an application using
slipdev
should be able to communicate with Linux via the interface created bydist/tools/sliptty/start_network
(without stdio of course). Also try pinging the node (or the linux host) with payload sizes 184 and 211. They will cause the length field of the IPv6 header to be escaped according to the slip protocol, so if it works it works correctly.Please also test on MacOSX.
Issues/PRs references
Some code migrated from #6718. There will be a follow-up to adapt
slipdev
for the stdio multiplexing.