From 4a25226f2abc3699de9d7bb4ba320e29002c8682 Mon Sep 17 00:00:00 2001 From: iulianbarbu Date: Wed, 25 Mar 2020 13:07:01 +0200 Subject: [PATCH] mmds: added support for custom ipv4 address Added a new API for configuring MMDS. At the moment, this configuration applies only for the MMDS IPv4 address. Besides the new API, this commits comprises changes to the NetBuilder implementation and usages. Signed-off-by: iulianbarbu Signed-off-by: YUAN LYU --- src/connection.rs | 1 + src/vmm/src/vmm_config/mmds.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/vmm/src/vmm_config/mmds.rs diff --git a/src/connection.rs b/src/connection.rs index ce7a594..c465b8b 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -131,6 +131,7 @@ impl HttpConnection { Err(e) => return Err(ConnectionError::StreamError(e)), } } + Ok(bytes_read + self.read_cursor) } /// Parses bytes in `buffer` for a valid request line. diff --git a/src/vmm/src/vmm_config/mmds.rs b/src/vmm/src/vmm_config/mmds.rs new file mode 100644 index 0000000..f6eddd0 --- /dev/null +++ b/src/vmm/src/vmm_config/mmds.rs @@ -0,0 +1,20 @@ +// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +use std::net::Ipv4Addr; + +/// Keeps the MMDS configuration. +#[derive(Debug, Deserialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct MmdsConfig { + /// MMDS IPv4 configured address. + ipv4_address: Option, +} + +impl MmdsConfig { + /// Returns the MMDS IPv4 address if one was configured. + /// Otherwise returns None. + pub fn ipv4_addr(&self) -> Option { + self.ipv4_address + } +}