netstack: scheme/ip.rs to smoltcp 0.13.1 API
Three call sites needed 0.13.1 adaptation: - hop_limit/set_hop_limit are now methods, not public fields. Use self.hop_limit() and self.set_hop_limit(). - RawSocket::new takes Option<IpVersion> and Option<IpProtocol>, not the bare enums. - socket.ip_protocol() returns Option<IpProtocol>; print via Debug so both Some(known) and None render usefully. Verified by cargo check.
This commit is contained in:
@@ -53,11 +53,11 @@ impl<'a> SchemeSocket for RawSocket<'a> {
|
||||
}
|
||||
|
||||
fn hop_limit(&self) -> u8 {
|
||||
self.hop_limit
|
||||
self.hop_limit()
|
||||
}
|
||||
|
||||
fn set_hop_limit(&mut self, hop_limit: u8) {
|
||||
self.hop_limit = hop_limit;
|
||||
self.set_hop_limit(hop_limit);
|
||||
}
|
||||
|
||||
fn new_socket(
|
||||
@@ -82,8 +82,8 @@ impl<'a> SchemeSocket for RawSocket<'a> {
|
||||
vec![0; Router::MTU * Smolnetd::SOCKET_BUFFER_SIZE],
|
||||
);
|
||||
let ip_socket = RawSocket::new(
|
||||
IpVersion::Ipv4,
|
||||
IpProtocol::from(proto),
|
||||
Some(IpVersion::Ipv4),
|
||||
Some(IpProtocol::from(proto)),
|
||||
rx_buffer,
|
||||
tx_buffer,
|
||||
);
|
||||
@@ -141,7 +141,7 @@ impl<'a> SchemeSocket for RawSocket<'a> {
|
||||
|
||||
fn fpath(&self, _file: &SchemeFile<Self>, buf: &mut [u8]) -> SyscallResult<usize> {
|
||||
FpathWriter::with(buf, "ip", |w| {
|
||||
write!(w, "{}", self.ip_protocol()).expect("write ip protocol to fpath");
|
||||
write!(w, "{:?}", self.ip_protocol()).expect("write ip protocol to fpath");
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user