Commit Graph

19315 Commits

Author SHA1 Message Date
Joe Bryan
72e940ee93 jets: remove obsolete, unused +hike and |ap 2023-12-06 10:40:03 -05:00
Joe Bryan
b86ffe06d6 jets: separate declarations for %138 2023-12-06 10:38:21 -05:00
Pyry Kovanen
4a88bd9b1d
stun: minimal working client/server (#545)
WIP branch (on top on ted/ping; will be merged there). Uses
https://github.com/urbit/urbit/pull/6836 for the %arvo side.

- [x] Send/Receive STUN request/response, handled in %arvo by stopping
the %ping app.
- [x] Check DNS resolution -- currently we send STUNs in fakeship mode
  - (check changing hosts.txt)
- [ ] refactor _stun_czar, _ames_czar, 
- make a generic _dns_czar(imp_y) that gets called every ~m5 for our
sponsoring galaxy, and every time an %ames packet is sent to another
galaxy
- [x] refactor _ames_czar/stun_gone 
- [x] Use XOR-MAPPED-ADDRESS to send the sponsee's IP
- [x] Better STUN (re)sends, regarding timers (e.g. number of tries per
attempt... etc)
  - "send requests at times 0 ms, 500 ms, 1500 ms, 3500 ms, 7500
   ms, 15500 ms, and 31500 ms.  If the client has not received a
response after 39500 ms", stop, inject %fail, (re)resolve DNS, and
restart STUN.
- [x] Callback error handling
  - if a response failes, ignore—sender will try again
  - if a request fails, resend it
  - if the DNS resolution fails, stop everyting and restart
- if the response doesn't arrive in ~s39, inject %fail, stop everything
and restart
- [ ] DNS Error handling
  - [x] Failure to resolve DNS (first time) -- have a global ~s25 timer?
- [x] Change in sponsor's IP -- resolve DNS on failure to hear a
response?
  - [x] ~~exponentially backoff~~resolve DNS every 5 minutes
- [x] Better STUN response check
- [x] Add sponsee's IP to MAPPED-ADDRESS attribute field
- [x] cache ip address
- [x] (re)enable %ping app after failure to hear STUN response, if we
eventually hear one
- [ ] Test plan: see last point in
https://github.com/urbit/urbit/pull/6836#issue-1956850750
2023-12-06 15:58:46 +02:00
yosoyubik
c343fc83be stun: stop when finding first attribute 2023-12-06 14:03:44 +01:00
yosoyubik
32843ba32c Merge branch 'next/kelvin/411' into yu/stun 2023-12-06 13:33:56 +01:00
yosoyubik
2901a18230 stun: log port in network byte order 2023-12-06 13:31:17 +01:00
yosoyubik
c55b9d223e stun: fix hear ip:port log message 2023-12-06 13:27:36 +01:00
Edward Amsden
420ee4252e vere: add --serf-bin option to provide path to serf 2023-12-05 12:11:01 -06:00
pkova
0acaf10aea stun: more fixes from joe 2023-12-05 18:12:00 +02:00
Edward Amsden
eb87fc4620 nix: update flake.lock to fix FHSUserEnv 2023-12-05 07:19:36 -06:00
Pyry Kovanen
e7e06d031c
mdns: add mdns for local network routing (#511)
This PR implements [mDNS](https://en.wikipedia.org/wiki/Multicast_DNS)
for vere, significantly improving Urbit routing inside local networks.
On startup vere will now broadcast a service with the format
`dinleb-rambep._ames._udp.local`. Vere will also listen for any services
on the local network with the signature of `_ames._udp`. Whenever new
services are found vere will send the lane to arvo.

On macOS we can use [Bonjour](https://developer.apple.com/bonjour/) and
don't need to pull down any dependencies at all. On Linux we can use
[Avahi](https://www.avahi.org/), specifically the bonjour compatibility
layer. The header we're using is
[dns_sd.h](https://github.com/lathiat/avahi/blob/master/avahi-compat-libdns_sd/dns_sd.h),
[documented
here](https://developer.apple.com/library/archive/documentation/Networking/Conceptual/dns_discovery_api/Introduction.html#//apple_ref/doc/uid/TP40002475-SW1).

Tested on macos aarch64 and linux x86_64 so far. To try it out, build
vere from this PR, start a fakezod and observe:

```
# macos
dns-sd -B _ames._udp

# linux
avahi-browse -r _ames._udp
```

You can also start another fake ship on the same network and do
`|ames-verb %rcv %odd` to see your fakeships find eachother. For this
second part you need the companion arvo PR, here's a pill that has it
already:

```
./urbit -F zod -u https://urbit-foundation.s3.us-east-2.amazonaws.com/dear.pill
```
2023-12-05 14:00:16 +02:00
Pyry Kovanen
ae110cbebe
Merge branch 'develop' into pkova/mdns 2023-12-05 13:33:06 +02:00
Pyry Kovanen
26927c4266
lick: Shut bug (#563)
There is a bug in lick where if a port still has a connection and lick
gets a %shut task the port can still send %soaks to arvo. Arvo poops
when this happens. This bug also shows up when the port is disconnected
and a %disconnect %soak is sent. This PR fixes both of these bugs
2023-12-04 19:21:59 +02:00
Amadeo Bellotti
8240f12db6 oops didnt compile 2023-12-04 11:50:49 -05:00
Pyry Kovanen
3d93dc2327
ames: account for variable-size num fragments (#561)
Currently we assume that the number of fragments in a `meow` has a fixed
size of 4 bytes (which is also how we deserialize meows in in
[lull.hoon](https://github.com/urbit/urbit/blob/develop/pkg/arvo/sys/lull.hoon#L1397);
see `+sift-meow`), but in some cases we will retrieve from the cache a
meow that has less than 4 bytes, which means that we will go over the
actual length of the meow when calculating the size of the response to
be sent.

(To reproduce the problem, [this pdf](https://www.lab6.com/0) will cause
the publisher to crash on the last fragment if anybody requests it using
remote scry)

This PR fixes this by checking how many bytes are actually used in a
word, and then using that information to correctly calculate the size of
the `meow`.

Thanks to @pkova and @joemfb for helping with this.
2023-12-04 18:19:21 +02:00
Amadeo Bellotti
ee2624fd95 cleanup 2023-12-04 10:55:28 -05:00
Amadeo Bellotti
9826d8ae29 close channel on a %shut 2023-12-04 10:54:39 -05:00
Amadeo Bellotti
b95f2280bf fixed lick bug where a shut port will still send soaks and errors if somethign is connected 2023-12-04 10:42:49 -05:00
yosoyubik
9578d35673 stun: fix logging received port 2023-12-01 14:15:21 +01:00
yosoyubik
6f8e718c82 stun: check if found attribute is correct
...and if not, keep trying until we go over the whole buffer

(Note: the parsde port is wrong)
2023-12-01 13:07:50 +01:00
yosoyubik
9bbd71c57c stunL fix wrong fingerprint length 2023-12-01 12:27:16 +01:00
yosoyubik
abb1599669 ames: account for variable-size num fragments 2023-12-01 10:21:32 +01:00
pkova
8de9d8d8ff stun: misc fixes 2023-11-30 19:55:15 +02:00
Joe Bryan
e216586234
merge develop into next/kelvin/411 (#560)
This has fallen way behind -- should fix urbit/urbit#6860
2023-11-29 14:05:14 -05:00
Joe Bryan
65f03b3f08
u3: optimizes u3i_edit (nock opcode 10) (#362)
This PR ports urbit/urbit#6004. It is not urgent.

Benchmarking this against the old implementation would be worthwhile. It
might also be worth inlining/decomposing `u3a_is_mutable()`; this is
(currently) its only call-site, and the road pointer and seniority
predicate cannot change throughout this loop.
2023-11-29 13:31:51 -05:00
Joe Bryan
343c4d9bbc
u3: restore old-style, efficient reap to u3m_love() (#538)
This PR effectively reverts urbit/urbit#1753, which simplified cache
promotion when falling back to an outer road, at the expense of
allocation efficiency.

Early testing shows significant positive effects mitigating snapshot
patch size (see urbit/urbit#6805)
2023-11-29 13:22:59 -05:00
lukechampine
ed2418bea1 jets: support arbitrary-length blake3 output 2023-11-26 15:28:45 -05:00
lukechampine
80888b4952 jets: add +chunk-output and +compress blake3 jets 2023-11-22 11:12:42 -05:00
yosoyubik
2a3ca0edc8 stun: add ship and lane to %arvo task 2023-11-21 10:29:30 +01:00
yosoyubik
7d7f4d236b stun: use required initial value for the crc 2023-11-20 14:59:35 +01:00
yosoyubik
6c174c033f stun: remove custom crc32 function 2023-11-20 14:54:40 +01:00
yosoyubik
71bb1ec03e stun: fix error 2023-11-20 14:18:05 +01:00
yosoyubik
a6569f101c stun: refactor stun attribute parser 2023-11-20 12:41:59 +01:00
yosoyubik
5af451b4ad stun: search for xor-mapped-address attribute 2023-11-20 12:17:42 +01:00
yosoyubik
c07b3158b9 stun: add fingerprint attribute and check 2023-11-20 11:55:51 +01:00
yosoyubik
d72087d679 stun: use 12 bytes of entropy for transaction id 2023-11-17 11:26:41 +01:00
yosoyubik
c44041f219 stun: refactor 2023-11-17 10:35:28 +01:00
Joe Bryan
e182de8ddd u3: further optimizes u3i_edit, inlining axis bit math 2023-11-16 16:04:36 -05:00
Joe Bryan
fa84fd88e8 u3: further optimizes u3i_edit, removing head/tail branches 2023-11-16 15:56:32 -05:00
Joe Bryan
d6988e6f93 u3: rewrites u3i_edit into a loop (tail recursion modulo cons) 2023-11-16 15:53:05 -05:00
Joe Bryan
acd4a94a47 Revert "TMP remove mutation optimization from u3i_edit()"
This reverts commit a6debdb094.
2023-11-16 15:52:46 -05:00
Joe Bryan
a6debdb094 TMP remove mutation optimization from u3i_edit() 2023-11-16 15:52:11 -05:00
Joe Bryan
a244cc57a5 vere: adds benchmark for opcode 10 2023-11-16 15:49:23 -05:00
yosoyubik
42e672c123 stun: pass in expression in _stun_czar 2023-11-16 14:56:38 +01:00
yosoyubik
fd32d71653 stun: refactor _ames_czar_dns 2023-11-16 14:10:04 +01:00
yosoyubik
692bc30546 stun: refactor _ames_czar_gone 2023-11-16 13:33:51 +01:00
yosoyubik
28d5aefdd7 stun: fix check for stun response 2023-11-16 10:46:04 +01:00
Matthew LeVan
629ac36983
build: fix docker workflow (#555)
Resolves #
2023-11-15 17:04:46 -05:00
Matthew LeVan
5682844c04 build: fix docker workflow 2023-11-15 17:03:02 -05:00
Matthew LeVan
68061597c3
build: install autoconf-archive in docker workflow (#554) 2023-11-15 16:53:13 -05:00