google / google/gopacket

pppoe code returns UnknownPPPoECode even though I specified a valid one (PADI).

Open
#1,085 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

This is how I create a default PPPoE packet. Here, I'm setting the code byte as 0x09 that means PADI packet.
```
func createDefaultPPPoE(code layers.PPPoECode) layers.PPPoE {
return layers.PPPoE{
Version: 0x1,
Type: 0x1,
Code: layers.PPPoECodePADI,
SessionId: 0x0000,
}
}
```
However, when I invoke the function and print the code name as `log.Println(pppoe.Code)` I get `UnknownPPPoECode` as an output which I'm expecting PPPoEPADI or something similar.
```
func SendPPPoEPADI(ponPortId, gemPortId, portNo, uniId, onuId uint32, serviceName, serialNumber string,
cTag int, pbit uint8, onuHwAddress net.HardwareAddr) {

pppoe := createDefaultPPPoE(layers.PPPoECodePADI)
log.Println("pppoe-code: ", pppoe.Code)
payload := createPADIPayload(onuId, uniId, ponPortId)
serializePPPoEPacket(cTag, onuHwAddress, nil, pbit, pppoe, payload)
}
```

Here is the output.
```
INFO[0000] pppoe-code: UnknownPPPoECode
```

What's wrong here?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.