Stub udp support
UDPConn is needed to get u-root commands such as wget to build. We still need OpError.Timeout():
rminnich@pop-os:~/go/src/github.com/u-root/u-root/cmds/core/wget$ tinygo build -tags purego
# pack.ag/tftp
../../../vendor/pack.ag/tftp/server.go:113:49: err.Timeout undefined (type *net.OpError has no field or method Timeout)
I'd be much happier to just get rid of all tftp usage, but that is not easy, too many people still use it.
Rather than a new file, should this code just be in udpsock.go?
I'm not sure why it says I want to merge into release, I did this, following instructions:
git checkout -b stub-udp-support origin/dev
Did I mess up somehow?
@rminnich I think it just needed the correct base branch in github UI. Just changed it to dev.
This is a bit odd:
Caused by:
0: failed to instantiate "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tinygo2017585412\\main"
1: unknown import: `env::getpagesize` has not been defined
```
is this a flake or is there something I also missed? There's certainly nothing in this PR that should have caused that to be called.
it was something I missed, 2:30 am commits are not my forte it seems
data point: tinygo build -target esp32c3 -tags purego builds u-root wget.
This is a pretty big step forward.
@rminnich have you ever taken a look at the https://github.com/tinygo-org/tinygo/tree/net-submodule-netdev3 branch by any chance? It might do what you need already? It is a part of https://github.com/tinygo-org/tinygo/pull/3704
well I'm prob doing something wrong but git checkout net-submodule-netdev3 git submodule update make
and in building wget I'm back to
rminnich@pop-os:~/go/src/github.com/u-root/u-root/cmds/core/wget$ tinygo build -target esp32c3
# pack.ag/tftp
../../../vendor/pack.ag/tftp/conn.go:39:22: undefined: net.ListenUDP
../../../vendor/pack.ag/tftp/conn.go:754:21: c.netConn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../../vendor/pack.ag/tftp/conn.go:832:28: c.netConn.ReadFrom undefined (type *net.UDPConn has no field or method ReadFrom)
../../../vendor/pack.ag/tftp/conn.go:842:22: c.netConn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../../vendor/pack.ag/tftp/server.go:111:25: conn.ReadFromUDP undefined (type *net.UDPConn has no field or method ReadFromUDP)
../../../vendor/pack.ag/tftp/server.go:170:19: s.conn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../../vendor/pack.ag/tftp/server.go:204:17: s.conn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../../vendor/pack.ag/tftp/server.go:231:17: s.conn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../../vendor/pack.ag/tftp/server.go:299:19: undefined: net.ListenUDP
I don't see any of these functions in that submodule. There is some UDP support but not this?
but if you do end up using the submodule, I suppose I can push a PR against that to get these 4 needed functions?
cc @scottfeldman
Hi, I'm able to reproduce this issue. I'll work on porting the missing UDP parts to tinygo-net...
sfeldma@penguin:~/work/u-root$ ~/go/bin/tinygo build -tags purego ./cmds/core/wget/
go: downloading github.com/cenkalti/backoff/v4 v4.1.3
go: downloading pack.ag/tftp v1.0.1-0.20181129014014-07909dfbde3c
go: downloading github.com/pierrec/lz4/v4 v4.1.14
# pack.ag/tftp
../../go/pkg/mod/pack.ag/[email protected]/conn.go:39:22: ListenUDP not declared by package net
../../go/pkg/mod/pack.ag/[email protected]/conn.go:754:21: c.netConn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../go/pkg/mod/pack.ag/[email protected]/conn.go:832:28: c.netConn.ReadFrom undefined (type *net.UDPConn has no field or method ReadFrom)
../../go/pkg/mod/pack.ag/[email protected]/conn.go:842:22: c.netConn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../go/pkg/mod/pack.ag/[email protected]/server.go:111:25: conn.ReadFromUDP undefined (type *net.UDPConn has no field or method ReadFromUDP)
../../go/pkg/mod/pack.ag/[email protected]/server.go:170:19: s.conn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../go/pkg/mod/pack.ag/[email protected]/server.go:204:17: s.conn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../go/pkg/mod/pack.ag/[email protected]/server.go:231:17: s.conn.WriteTo undefined (type *net.UDPConn has no field or method WriteTo)
../../go/pkg/mod/pack.ag/[email protected]/server.go:299:19: ListenUDP not declared by package net
I opened an issue in tinygo-org/net to add UDP server support: https://github.com/tinygo-org/net/issues/6
I'm trying to wrap my head around u-root. If we had UDP server working, would this mean you could flash a u-root image with wget to a tinygo target, and from there run wget on the network? I ask because it looks like this PR just stubs out the UDP server calls to get a compile. What does it mean for u-root to have full networking so netcat, wget, ping, dhclient work?
I'm interested in picking this issue up again. Could we re-run the CI to check the current state of this PR? @rminnich @scottfeldman @deadprogram