1

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 

The package I'm using: github.com/google/gopacket@v1.1.17 What's wrong here?

baris
  • 157
  • 1
  • 9

0 Answers0