Skip to content

Deserialize Problem #2

@Tom-Plants

Description

@Tom-Plants

Title:
Unexpected Behavior When Serializing and Deserializing PppoePkt


Description:
Hi, I encountered an unexpected behavior when serializing and deserializing the ppproperly::pppoe::PppoePkt struct. After deserialization, the PADI field is empty, even though I originally added two tags.


Reproduction Steps:

Here is a minimal code snippet to reproduce the issue:

let pkt = ppproperly::pppoe::PppoePkt::new_padi(
    iface_mac,
    vec![
        ppproperly::pppoe::PppoeTag {
            data: ppproperly::pppoe::PppoeVal::HostUniq("aaaaaaa".as_bytes().to_vec()),
        },
        ppproperly::pppoe::PppoeTag {
            data: ppproperly::pppoe::PppoeVal::ServiceName("".to_string()),
        },
    ],
);

let mut vec = std::vec::Vec::new();
pkt.serialize(&mut vec)?;

let mut x = ppproperly::pppoe::PppoePkt { ..std::default::Default::default() };
let x1 = vec.as_slice();
let mut x2 = std::io::Cursor::new(x1);
x.deserialize(&mut x2)?;
println!("{}", x);

Expected Behavior:

-- After deserialization, the PADI field inside the PppoePkt struct should contain the two tags I originally added. --

Actual Behavior:

The output is:

PPPoED dst=ff:ff:ff:ff:ff:ff src=0a:f8:b3:20:f9:0d sid=0: PADI []

The tags array inside PADI is empty.

Thanks for your work on this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions