Skip to content

Commit

Permalink
add option to ignore logoff packets
Browse files Browse the repository at this point in the history
  • Loading branch information
pyther committed Jun 29, 2020
1 parent 4cbe61f commit 12ebcc8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ Usage of goeap_proxy:
interface of the AT&T ONT/WAN
-if-wan string
interface of the AT&T Router
-ignore-logoff
ignore EAP-Logoff packets
-promiscuous
place interfaces into promiscuous mode instead of multicast
-syslog
log to syslog
```

### Ignore Logoff
It has been reported that some gateways such as the Pace 5268ac will send a EAPOLLogOff causing a sporadic outage. Use the `-ignore-logoff` flag if you encounter this issue. This is not needed for the BGW210.

### Example Run
```
root@OpenWrt:~# goeap_proxy -if-router eth3 -if-wan eth2
Expand All @@ -46,12 +51,11 @@ $ go build -o goeap_proxy main.go
```
$ CC=/usr/local/bin/musl-gcc go build -o goeap_proxy main.go
```
Note: This is useful for testing changes on router distributions that use musl without needing to go through the package process.
**For OpenWRT**
Note: This is useful for testing changes on router distributions that use musl without needing to go through the packaging process.

Custom feed: [pyther/openwrt-feed](https://github.com/pyther/openwrt-feed)

README contains insructions
**For OpenWRT**
Openwrt feed: [pyther/openwrt-feed](https://github.com/pyther/openwrt-feed)
Package building instructions in README

## Other Projects
- [jaysoffian/eap_proxy](https://github.com/jaysoffian/eap_proxy): python implementation with a primary focus on EdgeOS
Expand Down
16 changes: 10 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ func main() {
var rtrInt string
var wanInt string
var promiscuous bool
var ignoreLogoff bool
var version bool

flag.StringVar(&rtrInt, "if-router", "", "interface of the AT&T Router")
flag.StringVar(&wanInt, "if-wan", "", "interface of the AT&T ONT/WAN")
flag.BoolVar(&ignoreLogoff, "ignore-logoff", false, "ignore EAPOL-Logoff packets")
flag.BoolVar(&promiscuous, "promiscuous", false, "place interfaces into promiscuous mode instead of multicast")
flag.BoolVar(&version, "version", false, "display version")
flag.Parse()
Expand Down Expand Up @@ -89,12 +91,12 @@ func main() {
// Wait until both subroutines exit
fmt.Printf("proxy started. router: %s, wan: %s\n", rtrInt, wanInt)
quit := make(chan int)
go proxyPackets(rtr, wan)
go proxyPackets(wan, rtr)
go proxyPackets(rtr, wan, ignoreLogoff)
go proxyPackets(wan, rtr, ignoreLogoff)
<-quit
}

func proxyPackets(src *eapInterface, dst *eapInterface) {
func proxyPackets(src *eapInterface, dst *eapInterface, ignoreLogoff bool) {
// This might break for jumbo frames
recvBuf := make([]byte, 1500)
for {
Expand All @@ -120,12 +122,14 @@ func proxyPackets(src *eapInterface, dst *eapInterface) {
continue
}

continue
}

//DEBUG: Print Decoded Layers
//fmt.Fprintf(os.Stderr, "Decoded: %v\n", decoded)

if ignoreLogoff && eapol.Type == layers.EAPOLTypeLogOff {
printPacketInfo(src.name, "IGNORE", eth, eapol, eap)
continue
}

// print a log message with useful information
printPacketInfo(src.name, dst.name, eth, eapol, eap)

Expand Down

0 comments on commit 12ebcc8

Please sign in to comment.