Skip to content

Commit

Permalink
rename pcket_in: port -> in_port
Browse files Browse the repository at this point in the history
  • Loading branch information
Arikato111 committed May 19, 2024
1 parent 19be69b commit 289482a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> {
*/
fn packet_in_handler(&mut self, xid: u32, packetin: PacketInEvent, stream: &mut TcpStream) {
let pkt = packetin.ether_parse();
self.mac_to_port.insert(pkt.mac_src, packetin.port);
self.mac_to_port.insert(pkt.mac_src, packetin.in_port);

let mac_dst = pkt.mac_des;
let mac_src = pkt.mac_src;
Expand All @@ -49,7 +49,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> {

if let PseudoPort::PhysicalPort(_) = out_port {
let mut match_fields = MatchFields::match_all();
match_fields.in_port = Some(packetin.port);
match_fields.in_port = Some(packetin.in_port);
match_fields.mac_dest = Some(mac_dst);
match_fields.mac_src = Some(mac_src);
if let Some(buf_id) = packetin.buf_id {
Expand All @@ -61,7 +61,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> {
}
let packet_out = self
.ofp
.packet_out(Some(packetin.port), packetin.payload, actions);
.packet_out(Some(packetin.in_port), packetin.payload, actions);
self.send_msg(packet_out, xid, stream);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/openflow/events/packet_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum PacketInReason {
pub struct PacketInEvent {
pub buf_id: Option<u32>,
pub total_len: u16,
pub port: u16,
pub in_port: u16,
pub reason: PacketInReason,
pub table_id: u8,
pub payload: Payload,
Expand All @@ -32,7 +32,7 @@ impl PacketInEvent {
n => Some(n as u32),
};
let total_len = bytes.read_u16::<BigEndian>().unwrap();
let port = bytes.read_u16::<BigEndian>().unwrap();
let in_port = bytes.read_u16::<BigEndian>().unwrap();
let reason = match bytes.read_u8().unwrap() {
1 => PacketInReason::NoMatch,
2 => PacketInReason::Action,
Expand All @@ -47,7 +47,7 @@ impl PacketInEvent {
PacketInEvent {
buf_id,
total_len,
port,
in_port,
reason,
table_id,
payload,
Expand Down

0 comments on commit 289482a

Please sign in to comment.