diff --git a/Cargo.lock b/Cargo.lock index 5d30a24aa1..22725df47c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,14 +1,14 @@ [[package]] name = "arg_parser" version = "0.1.0" -source = "git+https://github.com/redox-os/arg-parser.git#d16e2d02e87996bbe2bce4a201c66c0df4a1e866" +source = "git+https://github.com/redox-os/arg-parser.git#7503531821b0c111f9fac77a5d2536ea221105fe" [[package]] name = "base64" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "extra" version = "0.1.0" -source = "git+https://github.com/redox-os/libextra.git#402932084acd5fef4812945887ceaaa2ddd5f264" +source = "git+https://github.com/redox-os/libextra.git#f38608acd9cc00e1c8bd41a1a96d31becf239913" [[package]] name = "fuchsia-zircon" @@ -126,12 +126,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -142,7 +142,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "managed" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/m-labs/rust-managed.git?rev=629a6786a1cf1692015f464ed16c04eafa5cb8d1#629a6786a1cf1692015f464ed16c04eafa5cb8d1" [[package]] name = "matches" @@ -166,11 +166,11 @@ dependencies = [ "extra 0.1.0 (git+https://github.com/redox-os/libextra.git)", "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-rustls 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "ntpclient 0.0.1 (git+https://github.com/willem66745/ntpclient-rust)", "pbr 1.0.0 (git+https://github.com/a8m/pb)", "redox_event 0.1.0 (git+https://github.com/redox-os/event.git)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -188,16 +188,16 @@ name = "num_cpus" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pbr" version = "1.0.0" -source = "git+https://github.com/a8m/pb#e9369ed2b94df4f554fe79c2643de41f7338475f" +source = "git+https://github.com/a8m/pb#c63c36895b2989c721e6db70dd4cb9c8dfe52e76" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -214,7 +214,7 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -231,8 +231,8 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -242,7 +242,7 @@ name = "redox_event" version = "0.1.0" source = "git+https://github.com/redox-os/event.git#bb96d9cd6dd01d4118deae84722a522b8328fa9f" dependencies = [ - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -252,18 +252,18 @@ dependencies = [ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "netutils 0.1.0 (git+https://github.com/redox-os/netutils.git)", "redox_event 0.1.0 (git+https://github.com/redox-os/event.git)", - "redox_syscall 0.1.31 (git+https://github.com/redox-os/syscall.git)", + "redox_syscall 0.1.32 (git+https://github.com/redox-os/syscall.git)", "smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp.git)", ] [[package]] name = "redox_syscall" -version = "0.1.31" -source = "git+https://github.com/redox-os/syscall.git#71c51bdbbbac3500074a8ed15a2912f38ee7a0f6" +version = "0.1.32" +source = "git+https://github.com/redox-os/syscall.git#3c765737a5e9146ffb241c67050c1be9bf28aab7" [[package]] name = "redox_syscall" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -271,7 +271,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -280,8 +280,8 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -312,10 +312,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smoltcp" version = "0.4.0" -source = "git+https://github.com/m-labs/smoltcp.git#5e2ae22302d36cea2cc3e1caa4f098e20dc7f612" +source = "git+https://github.com/m-labs/smoltcp.git#960b0012a09d37dde1d86b28bb5531316f606bfd" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "managed 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "managed 0.4.0 (git+https://github.com/m-labs/rust-managed.git?rev=629a6786a1cf1692015f464ed16c04eafa5cb8d1)", ] [[package]] @@ -323,8 +323,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -334,8 +334,8 @@ version = "0.1.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -424,7 +424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" -"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" +"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" "checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3" "checksum extra 0.1.0 (git+https://github.com/redox-os/libextra.git)" = "" @@ -437,10 +437,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "236eb37a62591d4a41a89b7763d7de3e06ca02d5ab2815446a8bae5d2f8c2d57" -"checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2" +"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" -"checksum managed 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d48e8c30a4363e2981fe4db20527f6ab0f32a243bbc75379dea5a64f60dae4" +"checksum managed 0.4.0 (git+https://github.com/m-labs/rust-managed.git?rev=629a6786a1cf1692015f464ed16c04eafa5cb8d1)" = "" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum netutils 0.1.0 (git+https://github.com/redox-os/netutils.git)" = "" @@ -452,8 +452,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c51c07654ddd93f6cb543c7a849863b03abc7e82591afda6dc8ad4ac3ac4a" "checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53" "checksum redox_event 0.1.0 (git+https://github.com/redox-os/event.git)" = "" -"checksum redox_syscall 0.1.31 (git+https://github.com/redox-os/syscall.git)" = "" -"checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" +"checksum redox_syscall 0.1.32 (git+https://github.com/redox-os/syscall.git)" = "" +"checksum redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum ring 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2a6dc7fc06a05e6de183c5b97058582e9da2de0c136eafe49609769c507724" "checksum rustls 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17727f4b991294da2c84d75a43c003151ff58072212768800f66c56ee46dca43" diff --git a/src/smolnetd/arp_cache.rs b/src/smolnetd/arp_cache.rs deleted file mode 100644 index d546b439ad..0000000000 --- a/src/smolnetd/arp_cache.rs +++ /dev/null @@ -1,45 +0,0 @@ -use smoltcp::iface::{ArpCache, SliceArpCache}; -use smoltcp::wire::{EthernetAddress, IpAddress}; -use std::collections::BTreeSet; -use std::iter::FromIterator; - -//TODO: move to EthernetAddress::LOCAL (?) -pub const LOOPBACK_HWADDR: EthernetAddress = EthernetAddress([0; 6]); - -pub struct LoArpCache { - arp_cache: SliceArpCache<'static>, - local_ips: BTreeSet, -} - -impl LoArpCache { - pub fn new(local_ips: I) -> LoArpCache - where - I: IntoIterator, - { - LoArpCache { - arp_cache: SliceArpCache::new(vec![Default::default(); 16]), - local_ips: BTreeSet::from_iter(local_ips), - } - } -} - -impl ArpCache for LoArpCache { - fn fill(&mut self, protocol_addr: &IpAddress, hardware_addr: &EthernetAddress) { - self.arp_cache.fill(protocol_addr, hardware_addr) - } - - fn lookup(&mut self, protocol_addr: &IpAddress) -> Option { - //TODO: use IpAddress::is_loopback - if let IpAddress::Ipv4(ipv4_addr) = *protocol_addr { - if ipv4_addr.is_loopback() { - return Some(LOOPBACK_HWADDR); - } - } - - if self.local_ips.contains(protocol_addr) { - return Some(LOOPBACK_HWADDR); - } - - self.arp_cache.lookup(protocol_addr) - } -} diff --git a/src/smolnetd/device.rs b/src/smolnetd/device.rs index 092df0c598..950f35ff9d 100644 --- a/src/smolnetd/device.rs +++ b/src/smolnetd/device.rs @@ -5,8 +5,8 @@ use std::fs::File; use std::io::Write; use std::rc::Rc; +use smoltcp::wire::EthernetAddress; use buffer_pool::{Buffer, BufferPool}; -use arp_cache::LOOPBACK_HWADDR; struct NetworkDeviceData { network_file: Rc>, @@ -68,7 +68,7 @@ impl smoltcp::phy::TxToken for TxToken { let mut loopback = false; if let Ok(mut frame) = smoltcp::wire::EthernetFrame::new_checked(&mut buffer) { - if frame.dst_addr() == LOOPBACK_HWADDR { + if frame.dst_addr() == EthernetAddress::default() { frame.set_dst_addr(data.local_hwaddr); loopback = true; } diff --git a/src/smolnetd/main.rs b/src/smolnetd/main.rs index 486da5e71b..59e39841e6 100644 --- a/src/smolnetd/main.rs +++ b/src/smolnetd/main.rs @@ -23,7 +23,6 @@ mod error; mod logger; mod port_set; mod scheme; -mod arp_cache; fn run() -> Result<()> { use syscall::flag::*; diff --git a/src/smolnetd/scheme/icmp.rs b/src/smolnetd/scheme/icmp.rs index 5ccc4320e4..412666ca35 100644 --- a/src/smolnetd/scheme/icmp.rs +++ b/src/smolnetd/scheme/icmp.rs @@ -55,12 +55,12 @@ impl<'a, 'b> SchemeSocket for IcmpSocket<'a, 'b> { Ok(0) } - fn ttl(&self) -> u8 { - self.ttl().unwrap_or(64) + fn hop_limit(&self) -> u8 { + self.hop_limit().unwrap_or(64) } - fn set_ttl(&mut self, ttl: u8) { - self.set_ttl(Some(ttl)); + fn set_hop_limit(&mut self, hop_limit: u8) { + self.set_hop_limit(Some(hop_limit)); } fn new_socket( diff --git a/src/smolnetd/scheme/ip.rs b/src/smolnetd/scheme/ip.rs index 220341628e..d862125dc7 100644 --- a/src/smolnetd/scheme/ip.rs +++ b/src/smolnetd/scheme/ip.rs @@ -43,11 +43,11 @@ impl<'a, 'b> SchemeSocket for RawSocket<'a, 'b> { Ok(0) } - fn ttl(&self) -> u8 { + fn hop_limit(&self) -> u8 { 0 } - fn set_ttl(&mut self, _ttl: u8) {} + fn set_hop_limit(&mut self, _hop_limit: u8) {} fn new_socket( socket_set: &mut SocketSet, diff --git a/src/smolnetd/scheme/mod.rs b/src/smolnetd/scheme/mod.rs index c80ca20251..f83a1c5e44 100644 --- a/src/smolnetd/scheme/mod.rs +++ b/src/smolnetd/scheme/mod.rs @@ -1,9 +1,9 @@ use netutils::getcfg; -use smoltcp::iface::{ArpCache, EthernetInterface}; +use smoltcp::iface::{NeighborCache, EthernetInterface, EthernetInterfaceBuilder}; use smoltcp::socket::SocketSet as SmoltcpSocketSet; use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, IpEndpoint, Ipv4Address}; use std::cell::RefCell; -use std::collections::VecDeque; +use std::collections::{VecDeque, BTreeMap}; use std::fs::File; use std::io::{Read, Write}; use std::mem::size_of; @@ -16,7 +16,6 @@ use syscall; use buffer_pool::{Buffer, BufferPool}; use device::NetworkDevice; use error::{Error, Result}; -use arp_cache::LoArpCache; use self::ip::IpScheme; use self::tcp::TcpScheme; use self::udp::UdpScheme; @@ -82,14 +81,12 @@ impl Smolnetd { hardware_addr, Rc::clone(&buffer_pool), ); - let arp_cache = LoArpCache::new(protocol_addrs.iter().map(IpCidr::address)); - let iface = EthernetInterface::new( - network_device, - Box::new(arp_cache) as Box, - hardware_addr, - protocol_addrs, - Some(default_gw), - ); + let iface = EthernetInterfaceBuilder::new(network_device) + .neighbor_cache(NeighborCache::new(BTreeMap::new())) + .ethernet_addr(hardware_addr) + .ip_addrs(protocol_addrs) + .ipv4_gateway(default_gw) + .finalize(); let socket_set = Rc::new(RefCell::new(SocketSet::new(vec![]))); Smolnetd { iface, diff --git a/src/smolnetd/scheme/socket.rs b/src/smolnetd/scheme/socket.rs index b4f39e479c..90e120491e 100644 --- a/src/smolnetd/scheme/socket.rs +++ b/src/smolnetd/scheme/socket.rs @@ -118,8 +118,8 @@ where fn can_send(&self) -> bool; fn can_recv(&self) -> bool; - fn ttl(&self) -> u8; - fn set_ttl(&mut self, u8); + fn hop_limit(&self) -> u8; + fn set_hop_limit(&mut self, u8); fn get_setting(&SocketFile, Self::SettingT, &mut [u8]) -> SyscallResult; fn set_setting(&mut SocketFile, Self::SettingT, &[u8]) -> SyscallResult; @@ -375,10 +375,10 @@ where match setting { Setting::Other(setting) => SocketT::get_setting(file, setting, buf), - Setting::Ttl => if let Some(ttl) = buf.get_mut(0) { + Setting::Ttl => if let Some(hop_limit) = buf.get_mut(0) { let mut socket_set = self.socket_set.borrow_mut(); let socket = socket_set.get::(file.socket_handle); - *ttl = socket.ttl(); + *hop_limit = socket.hop_limit(); Ok(1) } else { Err(SyscallError::new(syscall::EIO)) @@ -443,10 +443,10 @@ where }; Ok(count) } - Setting::Ttl => if let Some(ttl) = buf.get(0) { + Setting::Ttl => if let Some(hop_limit) = buf.get(0) { let mut socket_set = self.socket_set.borrow_mut(); let mut socket = socket_set.get::(file.socket_handle); - socket.set_ttl(*ttl); + socket.set_hop_limit(*hop_limit); Ok(1) } else { Err(SyscallError::new(syscall::EIO)) @@ -596,7 +596,7 @@ where let socket_handle = file.socket_handle(); let (new_handle, update_with) = match path { - "ttl" => ( + "hop_limit" => ( SchemeFile::Setting(SettingFile { socket_handle, fd, diff --git a/src/smolnetd/scheme/tcp.rs b/src/smolnetd/scheme/tcp.rs index 195525689a..7896c22948 100644 --- a/src/smolnetd/scheme/tcp.rs +++ b/src/smolnetd/scheme/tcp.rs @@ -26,12 +26,12 @@ impl<'a> SchemeSocket for TcpSocket<'a> { self.can_recv() } - fn ttl(&self) -> u8 { - self.ttl().unwrap_or(64) + fn hop_limit(&self) -> u8 { + self.hop_limit().unwrap_or(64) } - fn set_ttl(&mut self, ttl: u8) { - self.set_ttl(Some(ttl)); + fn set_hop_limit(&mut self, hop_limit: u8) { + self.set_hop_limit(Some(hop_limit)); } fn get_setting( diff --git a/src/smolnetd/scheme/udp.rs b/src/smolnetd/scheme/udp.rs index 9227bb4f77..fcf4d03936 100644 --- a/src/smolnetd/scheme/udp.rs +++ b/src/smolnetd/scheme/udp.rs @@ -28,12 +28,12 @@ impl<'a, 'b> SchemeSocket for UdpSocket<'a, 'b> { self.can_recv() } - fn ttl(&self) -> u8 { - self.ttl().unwrap_or(64) + fn hop_limit(&self) -> u8 { + self.hop_limit().unwrap_or(64) } - fn set_ttl(&mut self, ttl: u8) { - self.set_ttl(Some(ttl)); + fn set_hop_limit(&mut self, hop_limit: u8) { + self.set_hop_limit(Some(hop_limit)); } fn get_setting(