1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 05:24:26 +01:00

Use 802.1ad protocol flag when seralizing stacked Dot1Q

Fixes #68
This commit is contained in:
Matias Fontanini
2016-01-09 14:30:43 -08:00
parent d84f10cf08
commit 2169b1f71f
4 changed files with 42 additions and 19 deletions

View File

@@ -101,10 +101,15 @@ uint32_t Dot1Q::trailer_size() const {
void Dot1Q::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *) {
OutputMemoryStream stream(buffer, total_sz);
if (inner_pdu()) {
// Set the appropriate payload type flag
Constants::Ethernet::e flag = Internals::pdu_flag_to_ether_type(
inner_pdu()->pdu_type()
);
Constants::Ethernet::e flag;
PDUType type = inner_pdu()->pdu_type();
if (type == PDU::DOT1Q) {
flag = Constants::Ethernet::QINQ;
}
else {
// Set the appropriate payload type flag
flag = Internals::pdu_flag_to_ether_type(type);
}
payload_type(static_cast<uint16_t>(flag));
}
stream.write(header_);