Skip to content

Commit

Permalink
auth: device promisc mode
Browse files Browse the repository at this point in the history
  • Loading branch information
diredocks committed Oct 29, 2024
1 parent 29afde1 commit 5dc4418
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/auth/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (as *AuthService) HandlePacket(packet gopacket.Packet) error {
case layers.EAPCodeFailure:
switch eapPacket.Type {
case EAPTypeMD5Failed:
// Convet GBK Message from Server to UTF-8
// Convert GBK Message from Server to UTF-8
failMsgSize := eapPacket.TypeData[0]
failMsg, _ := simplifiedchinese.GBK.NewDecoder().Bytes(eapPacket.TypeData[1 : failMsgSize-1])
l.server.Error(fmt.Sprintf("%s", failMsg))
Expand All @@ -127,8 +127,8 @@ func (as *AuthService) HandlePacket(packet gopacket.Packet) error {
if eapPacket.TypeData[H3CIntegrityChanllengeHeader-1] == 0x35 &&
eapPacket.TypeData[H3CIntegrityChanllengeHeader-2] == 0x2b {
// Generate ChallangeResponse
buffer, err := as.h3cInfo.ChallangeResponse(
eapPacket.TypeData[H3CIntegrityChanllengeHeader:][:H3CIntegrityChanllengeLength])
challange := eapPacket.TypeData[H3CIntegrityChanllengeHeader:][:H3CIntegrityChanllengeLength]
buffer, err := as.h3cInfo.ChallangeResponse(challange)
if err != nil {
l.client.Error("failed to set integrity")
l.client.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func New(ifaceName string, hardwareDescription string) (*Device, error) {

func (d *Device) Start(as *nynAuth.AuthService) error {
var err error
d.handle, err = pcap.OpenLive(d.ifaceName, 1600, false, time.Millisecond)
d.handle, err = pcap.OpenLive(d.ifaceName, 1600, true, time.Millisecond)
if d.hardwareDescription != "" {
d.handle, err = pcap.OpenLive(d.hardwareDescription, 1600, false, time.Millisecond)
} // npcap needs hardware description to open devicd
Expand Down

0 comments on commit 5dc4418

Please sign in to comment.