Skip to content

Commit 3bda434

Browse files
committedJul 25, 2024·
Remove MAC address management policy implementation
1 parent c658ee6 commit 3bda434

File tree

1 file changed

+2
-86
lines changed

1 file changed

+2
-86
lines changed
 

‎proton_wap/src/ap.rs

+2-86
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,8 @@ use pnet::{
3535

3636
use tokio::task;
3737

38-
use proton_mac::MacAddrPolicy;
39-
4038
use proton_nat::NatTable;
4139

42-
use proton_nif::{
43-
ifnames::{
44-
DEFAULT_WIRED_INTERFACE,
45-
DEFAULT_WIRELESS_INTERFACE,
46-
},
47-
NetworkInterface,
48-
};
49-
5040
use crate::AccessPointResult;
5141

5242
/// Transport channel buffer size.
@@ -59,9 +49,6 @@ pub struct AccessPoint {
5949

6050
/// CIDR network range.
6151
range: Ipv4Cidr,
62-
63-
/// MAC address management policy.
64-
mac_policy: MacAddrPolicy,
6552
}
6653

6754
impl AccessPoint {
@@ -72,20 +59,16 @@ impl AccessPoint {
7259
/// to this access point
7360
/// - `range` (`Ipv4Cidr`): the internal network range associated to
7461
/// this access point
75-
/// - `mac_policy` (`MacAddrPolicy`): the MAC address policy of this
76-
/// access point
7762
///
7863
/// # Returns
7964
/// A new `AccessPoint`.
8065
pub fn new(
8166
external_ipv4: Ipv4Addr,
8267
range: Ipv4Cidr,
83-
mac_policy: MacAddrPolicy,
8468
) -> Self {
8569
Self {
8670
nat: NatTable::new(vec![external_ipv4]),
8771
range,
88-
mac_policy,
8972
}
9073
}
9174

@@ -106,15 +89,10 @@ impl AccessPoint {
10689
// Get network range
10790
let range = self.range;
10891

109-
// Get MAC policy
110-
let mac_policy = self.mac_policy.clone();
111-
112-
let layer_2_task = task::spawn(Self::run_layer_2(mac_policy));
113-
11492
let layer_4_task = task::spawn(Self::run_layer_4(nat, range));
11593

116-
match tokio::join!(layer_2_task, layer_4_task) {
117-
(Ok (_), Ok (_)) => Ok (()),
94+
match tokio::join!(layer_4_task) {
95+
(Ok (_),) => Ok (()),
11896
_ => todo!(),
11997
}
12098
}
@@ -170,68 +148,6 @@ impl AccessPoint {
170148
}
171149
}
172150

173-
/// Continuously route frames on the Data Link Layer (OSI Layer 2).
174-
///
175-
/// # Parameters
176-
/// - `mac_policy` (`MacAddrPolicy`): the MAC address management policy
177-
///
178-
/// # Returns
179-
/// An `AccessPointResult<()>` indicating an error, if one occurred.
180-
///
181-
/// This function does not return during nominal operation.
182-
async fn run_layer_2(mac_policy: MacAddrPolicy) -> AccessPointResult<()> {
183-
// Construct the wired network interface
184-
let wired_if = NetworkInterface::new(DEFAULT_WIRED_INTERFACE)
185-
.ok_or(io::Error::new(io::ErrorKind::Other, "could not find wired interface"))?;
186-
187-
// Construct the wireless network interface
188-
let wireless_if = NetworkInterface::new(DEFAULT_WIRELESS_INTERFACE)
189-
.ok_or(io::Error::new(io::ErrorKind::Other, "could not find wireless interface"))?;
190-
191-
// Route outgoing ETH frames
192-
let outgoing_task = task::spawn(Self::route_outgoing_frames(wired_if.clone(), wireless_if.clone(), mac_policy));
193-
194-
// Route incoming ETH frames
195-
let incoming_task = task::spawn(Self::route_incoming_frames(wired_if, wireless_if));
196-
197-
match tokio::join!(outgoing_task, incoming_task) {
198-
(Ok (_), Ok (_)) => Ok (()),
199-
_ => todo!(),
200-
}
201-
}
202-
203-
/// Route incoming Ethernet frames.
204-
///
205-
/// # Parameters
206-
/// - `wired_if` (`NetworkInterface`): the wired network interface
207-
/// - `wireless_if` (`NetworkInterface`): the wireless network interface
208-
///
209-
/// # Returns
210-
/// TODO
211-
async fn route_incoming_frames(
212-
_wired_if: NetworkInterface,
213-
_wireless_if: NetworkInterface,
214-
) {
215-
todo!()
216-
}
217-
218-
/// Route outgoing Ethernet frames.
219-
///
220-
/// # Parameters
221-
/// - `wired_if` (`NetworkInterface`): the wired network interface
222-
/// - `wireless_if` (`NetworkInterface`): the wireless network interface
223-
/// - `mac_policy` (`MacAddrPolicy`): the MAC address management policy
224-
///
225-
/// # Returns
226-
/// TODO
227-
async fn route_outgoing_frames(
228-
_wired_if: NetworkInterface,
229-
_wireless_if: NetworkInterface,
230-
_mac_policy: MacAddrPolicy,
231-
) {
232-
todo!()
233-
}
234-
235151
/// Translate an IPv4 packet.
236152
///
237153
/// # Parameters

0 commit comments

Comments
 (0)
Please sign in to comment.