From c94b66c3bb7df6e84650707d99abf74cea3d77f4 Mon Sep 17 00:00:00 2001 From: astoycos Date: Thu, 31 Aug 2023 12:29:31 -0400 Subject: [PATCH] bump deps update loader for aya:main bump deps so build-ebpf doesn't fail + bump all deps that had more recent versions, like tonic clap etc. make sure to run `cargo install bpf-linker` locally to ensure that its up to date. use the `take_map` aya API to take ownership of the CONNTRACK map before passing it to our "api-server". Signed-off-by: astoycos --- dataplane/Cargo.toml | 4 + dataplane/api-server/Cargo.toml | 4 +- dataplane/api-server/src/backends.rs | 99 +++++++++++++++++++++---- dataplane/api-server/src/lib.rs | 4 +- dataplane/api-server/src/server.rs | 6 +- dataplane/ebpf/Cargo.toml | 2 +- dataplane/ebpf/src/bindings.rs | 105 ++++++++++++++++----------- dataplane/ebpf/src/egress/icmp.rs | 8 +- dataplane/ebpf/src/egress/tcp.rs | 4 +- dataplane/ebpf/src/ingress/tcp.rs | 6 +- dataplane/ebpf/src/ingress/udp.rs | 8 +- dataplane/loader/Cargo.toml | 4 +- dataplane/loader/src/main.rs | 3 +- dataplane/xtask/Cargo.toml | 6 +- 14 files changed, 177 insertions(+), 86 deletions(-) diff --git a/dataplane/Cargo.toml b/dataplane/Cargo.toml index c15780a1..2bbf231e 100644 --- a/dataplane/Cargo.toml +++ b/dataplane/Cargo.toml @@ -1,2 +1,6 @@ [workspace] members = ["api-server", "loader", "common", "xtask"] + +[patch.crates-io] +aya = { git = "https://github.com/aya-rs/aya", branch="main" } +aya-log = { git = "https://github.com/aya-rs/aya", branch = "main" } diff --git a/dataplane/api-server/Cargo.toml b/dataplane/api-server/Cargo.toml index 7c504005..94c5e467 100644 --- a/dataplane/api-server/Cargo.toml +++ b/dataplane/api-server/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] prost = "0.11.9" -tonic = "0.8.3" +tonic = "0.9.2" anyhow = "1" log = "0.4" aya = { version = ">=0.11", features=["async_tokio"] } @@ -16,4 +16,4 @@ regex = "1" libc = "0.2" [build-dependencies] -tonic-build = "0.8.4" +tonic-build = "0.9.2" diff --git a/dataplane/api-server/src/backends.rs b/dataplane/api-server/src/backends.rs index 9b6e0736..b6a66306 100644 --- a/dataplane/api-server/src/backends.rs +++ b/dataplane/api-server/src/backends.rs @@ -55,7 +55,7 @@ pub mod backends_client { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; @@ -111,10 +111,29 @@ pub mod backends_client { self.inner = self.inner.accept_compressed(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } pub async fn get_interface_index( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await @@ -128,12 +147,15 @@ pub mod backends_client { let path = http::uri::PathAndQuery::from_static( "/backends.backends/GetInterfaceIndex", ); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("backends.backends", "GetInterfaceIndex")); + self.inner.unary(req, path, codec).await } pub async fn update( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await @@ -145,12 +167,14 @@ pub mod backends_client { })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/backends.backends/Update"); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("backends.backends", "Update")); + self.inner.unary(req, path, codec).await } pub async fn delete( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await @@ -162,7 +186,9 @@ pub mod backends_client { })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/backends.backends/Delete"); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("backends.backends", "Delete")); + self.inner.unary(req, path, codec).await } } } @@ -176,21 +202,26 @@ pub mod backends_server { async fn get_interface_index( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; async fn delete( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct BackendsServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl BackendsServer { @@ -203,6 +234,8 @@ pub mod backends_server { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, } } pub fn with_interceptor( @@ -226,6 +259,22 @@ pub mod backends_server { self.send_compression_encodings.enable(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } } impl tonic::codegen::Service> for BackendsServer where @@ -239,7 +288,7 @@ pub mod backends_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -259,7 +308,7 @@ pub mod backends_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).get_interface_index(request).await }; @@ -268,6 +317,8 @@ pub mod backends_server { } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -277,6 +328,10 @@ pub mod backends_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) @@ -297,13 +352,15 @@ pub mod backends_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).update(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -313,6 +370,10 @@ pub mod backends_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) @@ -333,13 +394,15 @@ pub mod backends_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).delete(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -349,6 +412,10 @@ pub mod backends_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) @@ -377,12 +444,14 @@ pub mod backends_server { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/dataplane/api-server/src/lib.rs b/dataplane/api-server/src/lib.rs index aa29d37f..83cccc2f 100644 --- a/dataplane/api-server/src/lib.rs +++ b/dataplane/api-server/src/lib.rs @@ -5,7 +5,7 @@ pub mod server; use std::net::{Ipv4Addr, SocketAddrV4}; use anyhow::Error; -use aya::maps::{HashMap, MapRefMut}; +use aya::maps::{HashMap, MapData}; use tonic::transport::Server; use backends::backends_server::BackendsServer; @@ -14,7 +14,7 @@ use common::{Backend, BackendKey}; pub async fn start( addr: Ipv4Addr, port: u16, - bpf_map: HashMap, + bpf_map: HashMap, ) -> Result<(), Error> { let server = server::BackendService::new(bpf_map); // TODO: mTLS https://github.com/Kong/blixt/issues/50 diff --git a/dataplane/api-server/src/server.rs b/dataplane/api-server/src/server.rs index 54f1d432..9388103c 100644 --- a/dataplane/api-server/src/server.rs +++ b/dataplane/api-server/src/server.rs @@ -2,7 +2,7 @@ use std::net::Ipv4Addr; use std::sync::Arc; use anyhow::Error; -use aya::maps::{HashMap, MapRefMut}; +use aya::maps::{HashMap, MapData}; use tokio::sync::Mutex; use tonic::{Request, Response, Status}; @@ -12,11 +12,11 @@ use crate::netutils::{if_name_for_routing_ip, if_nametoindex}; use common::{Backend, BackendKey}; pub struct BackendService { - bpf_map: Arc>>, + bpf_map: Arc>>, } impl BackendService { - pub fn new(bpf_map: HashMap) -> BackendService { + pub fn new(bpf_map: HashMap) -> BackendService { BackendService { bpf_map: Arc::new(Mutex::new(bpf_map)), } diff --git a/dataplane/ebpf/Cargo.toml b/dataplane/ebpf/Cargo.toml index 1805d00c..356f8279 100644 --- a/dataplane/ebpf/Cargo.toml +++ b/dataplane/ebpf/Cargo.toml @@ -8,7 +8,7 @@ publish = false aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } common = { path = "../common" } -memoffset = "0.8" +memoffset = "0.9" [[bin]] name = "loader" diff --git a/dataplane/ebpf/src/bindings.rs b/dataplane/ebpf/src/bindings.rs index 333b1dcc..54fb6434 100644 --- a/dataplane/ebpf/src/bindings.rs +++ b/dataplane/ebpf/src/bindings.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.64.0 */ +/* automatically generated by rust-bindgen 0.66.1 */ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -85,13 +85,6 @@ pub type __u16 = ::aya_bpf::cty::c_ushort; pub type __u32 = ::aya_bpf::cty::c_uint; pub type __be16 = __u16; pub type __be32 = __u32; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ethhdr { - pub h_dest: [::aya_bpf::cty::c_uchar; 6usize], - pub h_source: [::aya_bpf::cty::c_uchar; 6usize], - pub h_proto: __be16, -} pub type __sum16 = __u16; #[repr(C)] #[derive(Copy, Clone)] @@ -105,6 +98,23 @@ pub struct iphdr { pub ttl: __u8, pub protocol: __u8, pub check: __sum16, + pub __bindgen_anon_1: iphdr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union iphdr__bindgen_ty_1 { + pub __bindgen_anon_1: iphdr__bindgen_ty_1__bindgen_ty_1, + pub addrs: iphdr__bindgen_ty_1__bindgen_ty_2, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iphdr__bindgen_ty_1__bindgen_ty_1 { + pub saddr: __be32, + pub daddr: __be32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iphdr__bindgen_ty_1__bindgen_ty_2 { pub saddr: __be32, pub daddr: __be32, } @@ -147,6 +157,49 @@ impl iphdr { } #[repr(C)] #[derive(Copy, Clone)] +pub struct icmphdr { + pub type_: __u8, + pub code: __u8, + pub checksum: __sum16, + pub un: icmphdr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union icmphdr__bindgen_ty_1 { + pub echo: icmphdr__bindgen_ty_1__bindgen_ty_1, + pub gateway: __be32, + pub frag: icmphdr__bindgen_ty_1__bindgen_ty_2, + pub reserved: [__u8; 4usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct icmphdr__bindgen_ty_1__bindgen_ty_1 { + pub id: __be16, + pub sequence: __be16, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct icmphdr__bindgen_ty_1__bindgen_ty_2 { + pub __unused: __be16, + pub mtu: __be16, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct udphdr { + pub source: __be16, + pub dest: __be16, + pub len: __be16, + pub check: __sum16, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ethhdr { + pub h_dest: [::aya_bpf::cty::c_uchar; 6usize], + pub h_source: [::aya_bpf::cty::c_uchar; 6usize], + pub h_proto: __be16, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct tcphdr { pub source: __be16, pub dest: __be16, @@ -326,39 +379,3 @@ impl tcphdr { __bindgen_bitfield_unit } } -#[repr(C)] -#[derive(Copy, Clone)] -pub struct udphdr { - pub source: __be16, - pub dest: __be16, - pub len: __be16, - pub check: __sum16, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct icmphdr { - pub type_: __u8, - pub code: __u8, - pub checksum: __sum16, - pub un: icmphdr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union icmphdr__bindgen_ty_1 { - pub echo: icmphdr__bindgen_ty_1__bindgen_ty_1, - pub gateway: __be32, - pub frag: icmphdr__bindgen_ty_1__bindgen_ty_2, - pub reserved: [__u8; 4usize], -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct icmphdr__bindgen_ty_1__bindgen_ty_1 { - pub id: __be16, - pub sequence: __be16, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct icmphdr__bindgen_ty_1__bindgen_ty_2 { - pub __unused: __be16, - pub mtu: __be16, -} diff --git a/dataplane/ebpf/src/egress/icmp.rs b/dataplane/ebpf/src/egress/icmp.rs index 6cacd720..a1941ed5 100644 --- a/dataplane/ebpf/src/egress/icmp.rs +++ b/dataplane/ebpf/src/egress/icmp.rs @@ -25,19 +25,19 @@ pub fn handle_icmp_egress(ctx: TcContext) -> Result { return Ok(TC_ACT_PIPE); } - let dest_addr = unsafe { (*ip_hdr).daddr }; + let dest_addr = unsafe { (*ip_hdr).__bindgen_anon_1.addrs.daddr }; let new_src = unsafe { BLIXT_CONNTRACK.get(&dest_addr) }.ok_or(TC_ACT_PIPE)?; info!( &ctx, "Received a ICMP Unreachable packet destined for svc ip: {:i} ", - u32::from_be(unsafe { (*ip_hdr).daddr }) + u32::from_be(dest_addr) ); // redirect icmp unreachable message back to client unsafe { - (*ip_hdr).saddr = new_src.0; + (*ip_hdr).__bindgen_anon_1.addrs.saddr = new_src.0; (*ip_hdr).check = 0; } @@ -56,7 +56,7 @@ pub fn handle_icmp_egress(ctx: TcContext) -> Result { let icmp_inner_ip_hdr: *mut iphdr = unsafe { ptr_at(&ctx, icmp_header_offset + ICMP_HDR_LEN) }?; unsafe { - (*icmp_inner_ip_hdr).daddr = new_src.0; + (*icmp_inner_ip_hdr).__bindgen_anon_1.addrs.daddr = new_src.0; (*icmp_inner_ip_hdr).check = 0; } diff --git a/dataplane/ebpf/src/egress/tcp.rs b/dataplane/ebpf/src/egress/tcp.rs index 9548aee2..6cffc4ee 100644 --- a/dataplane/ebpf/src/egress/tcp.rs +++ b/dataplane/ebpf/src/egress/tcp.rs @@ -20,7 +20,7 @@ pub fn handle_tcp_egress(ctx: TcContext) -> Result { let tcp_hdr: *mut tcphdr = unsafe { ptr_at(&ctx, tcp_header_offset)? }; // capture some IP and port information - let client_addr = unsafe { (*ip_hdr).daddr }; + let client_addr = unsafe { (*ip_hdr).__bindgen_anon_1.addrs.daddr }; let dest_port = unsafe { (*tcp_hdr).dest.to_be() }; let ip_port_tuple = unsafe { BLIXT_CONNTRACK.get(&client_addr) }.ok_or(TC_ACT_PIPE)?; @@ -38,7 +38,7 @@ pub fn handle_tcp_egress(ctx: TcContext) -> Result { ); unsafe { - (*ip_hdr).saddr = ip_port_tuple.0; + (*ip_hdr).__bindgen_anon_1.addrs.saddr = ip_port_tuple.0; }; if (ctx.data() + ETH_HDR_LEN + mem::size_of::()) > ctx.data_end() { diff --git a/dataplane/ebpf/src/ingress/tcp.rs b/dataplane/ebpf/src/ingress/tcp.rs index 914da17b..b2289494 100644 --- a/dataplane/ebpf/src/ingress/tcp.rs +++ b/dataplane/ebpf/src/ingress/tcp.rs @@ -21,7 +21,7 @@ pub fn handle_tcp_ingress(ctx: TcContext) -> Result { let tcp_hdr: *mut tcphdr = unsafe { ptr_at(&ctx, tcp_header_offset)? }; - let original_daddr = unsafe { (*ip_hdr).daddr }; + let original_daddr = unsafe { (*ip_hdr).__bindgen_anon_1.addrs.daddr }; let key = BackendKey { ip: u32::from_be(original_daddr), @@ -38,7 +38,7 @@ pub fn handle_tcp_ingress(ctx: TcContext) -> Result { ); unsafe { - (*ip_hdr).daddr = backend.daddr.to_be(); + (*ip_hdr).__bindgen_anon_1.addrs.daddr = backend.daddr.to_be(); } if (ctx.data() + ETH_HDR_LEN + mem::size_of::()) > ctx.data_end() { @@ -76,7 +76,7 @@ pub fn handle_tcp_ingress(ctx: TcContext) -> Result { unsafe { BLIXT_CONNTRACK.insert( - &(*ip_hdr).saddr, + &(*ip_hdr).__bindgen_anon_1.addrs.saddr, &(original_daddr, (*tcp_hdr).source.to_be() as u32), 0 as u64, )?; diff --git a/dataplane/ebpf/src/ingress/udp.rs b/dataplane/ebpf/src/ingress/udp.rs index d0e817b7..ddc6222c 100644 --- a/dataplane/ebpf/src/ingress/udp.rs +++ b/dataplane/ebpf/src/ingress/udp.rs @@ -21,7 +21,7 @@ pub fn handle_udp_ingress(ctx: TcContext) -> Result { let udp_hdr: *mut udphdr = unsafe { ptr_at(&ctx, udp_header_offset)? }; - let original_daddr = unsafe { (*ip_hdr).daddr }; + let original_daddr = unsafe { (*ip_hdr).__bindgen_anon_1.addrs.daddr }; let key = BackendKey { ip: u32::from_be(original_daddr), @@ -33,17 +33,17 @@ pub fn handle_udp_ingress(ctx: TcContext) -> Result { info!( &ctx, "Received a UDP packet destined for svc ip: {:i} at Port: {} ", - u32::from_be(unsafe { (*ip_hdr).daddr }), + u32::from_be(original_daddr), u16::from_be(unsafe { (*udp_hdr).dest }) ); unsafe { BLIXT_CONNTRACK.insert( - &(*ip_hdr).saddr, + &(*ip_hdr).__bindgen_anon_1.addrs.saddr, &(original_daddr, (*udp_hdr).dest as u32), 0 as u64, )?; - (*ip_hdr).daddr = backend.daddr.to_be(); + (*ip_hdr).__bindgen_anon_1.addrs.daddr = backend.daddr.to_be(); }; if (ctx.data() + ETH_HDR_LEN + mem::size_of::()) > ctx.data_end() { diff --git a/dataplane/loader/Cargo.toml b/dataplane/loader/Cargo.toml index 5107ec3a..95db1f13 100644 --- a/dataplane/loader/Cargo.toml +++ b/dataplane/loader/Cargo.toml @@ -8,8 +8,8 @@ publish = false aya = { version = ">=0.11", features=["async_tokio"] } aya-log = "0.1" common = { path = "../common", features=["user"] } -clap = { version = "3.2", features = ["derive"] } -env_logger = "0.9" +clap = { version = "4.4", features = ["derive"] } +env_logger = "0.10.0" log = "0.4" tokio = { version = "1.32.0", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } api-server = { path = "../api-server" } diff --git a/dataplane/loader/src/main.rs b/dataplane/loader/src/main.rs index 0ea18577..be2b8da4 100644 --- a/dataplane/loader/src/main.rs +++ b/dataplane/loader/src/main.rs @@ -55,7 +55,8 @@ async fn main() -> Result<(), anyhow::Error> { .context("failed to attach the egress TC program")?; info!("starting api server"); - let backends: HashMap<_, BackendKey, Backend> = HashMap::try_from(bpf.map_mut("BACKENDS")?)?; + let backends: HashMap<_, BackendKey, Backend> = + HashMap::try_from(bpf.take_map("BACKENDS").expect("no maps named BACKENDS"))?; start_api_server(Ipv4Addr::new(0, 0, 0, 0), 9874, backends).await?; info!("Exiting..."); diff --git a/dataplane/xtask/Cargo.toml b/dataplane/xtask/Cargo.toml index 9765a84e..6a34d8c3 100644 --- a/dataplane/xtask/Cargo.toml +++ b/dataplane/xtask/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" [dependencies] anyhow = "1" aya-tool = { git = "https://github.com/aya-rs/aya", branch = "main" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.4.1", features = ["derive"] } prost = "0.11.9" tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread"] } -tonic = "0.8.3" +tonic = "0.9.2" api-server = { path = "../api-server" } [build-dependencies] -tonic-build = "0.8.4" +tonic-build = "0.9.2"