Size better
This commit is contained in:
parent
3be22b5b9b
commit
6b8ed2f807
3 changed files with 9 additions and 5 deletions
|
@ -23,6 +23,8 @@ import (
|
|||
"github.com/google/gopacket/pcap"
|
||||
)
|
||||
|
||||
const DDPExtHeaderSize = 13
|
||||
|
||||
// StartPcap opens an AppleTalk and AARP listening session on a network device.
|
||||
func StartPcap(device string) (*pcap.Handle, error) {
|
||||
handle, err := pcap.OpenLive(device, 4096, true, 100*time.Millisecond)
|
||||
|
|
7
rtmp.go
7
rtmp.go
|
@ -22,6 +22,7 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"gitea.drjosh.dev/josh/jrouter/atalk"
|
||||
"gitea.drjosh.dev/josh/jrouter/atalk/rtmp"
|
||||
"github.com/google/gopacket/pcap"
|
||||
"github.com/sfiera/multitalk/pkg/aarp"
|
||||
|
@ -97,7 +98,7 @@ func (m *RTMPMachine) Run(ctx context.Context, incomingCh <-chan *ddp.ExtPacket)
|
|||
}
|
||||
ddpPkt := &ddp.ExtPacket{
|
||||
ExtHeader: ddp.ExtHeader{
|
||||
Size: uint16(len(respPktRaw)),
|
||||
Size: uint16(len(respPktRaw)) + atalk.DDPExtHeaderSize,
|
||||
Cksum: 0,
|
||||
DstNet: pkt.SrcNet,
|
||||
DstNode: pkt.SrcNode,
|
||||
|
@ -127,7 +128,7 @@ func (m *RTMPMachine) Run(ctx context.Context, incomingCh <-chan *ddp.ExtPacket)
|
|||
|
||||
ddpPkt := &ddp.ExtPacket{
|
||||
ExtHeader: ddp.ExtHeader{
|
||||
Size: uint16(len(dataPktRaw)),
|
||||
Size: uint16(len(dataPktRaw)) + atalk.DDPExtHeaderSize,
|
||||
Cksum: 0,
|
||||
DstNet: pkt.SrcNet,
|
||||
DstNode: pkt.SrcNode,
|
||||
|
@ -182,7 +183,7 @@ func (m *RTMPMachine) broadcastData(myAddr aarp.AddrPair) error {
|
|||
|
||||
ddpPkt := &ddp.ExtPacket{
|
||||
ExtHeader: ddp.ExtHeader{
|
||||
Size: uint16(len(dataPktRaw)),
|
||||
Size: uint16(len(dataPktRaw)) + atalk.DDPExtHeaderSize,
|
||||
Cksum: 0,
|
||||
DstNet: 0, // this network
|
||||
DstNode: 0xff, // broadcast packet
|
||||
|
|
5
zip.go
5
zip.go
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"gitea.drjosh.dev/josh/jrouter/atalk"
|
||||
"gitea.drjosh.dev/josh/jrouter/atalk/atp"
|
||||
"gitea.drjosh.dev/josh/jrouter/atalk/zip"
|
||||
"github.com/google/gopacket/pcap"
|
||||
|
@ -68,7 +69,7 @@ func handleZIP(pcapHandle *pcap.Handle, srcHWAddr, myHWAddr ethernet.Addr, myAdd
|
|||
}
|
||||
respDDP := ddp.ExtPacket{
|
||||
ExtHeader: ddp.ExtHeader{
|
||||
Size: uint16(len(ddpBody)),
|
||||
Size: uint16(len(ddpBody)) + atalk.DDPExtHeaderSize,
|
||||
Cksum: 0,
|
||||
DstNet: ddpkt.SrcNet,
|
||||
DstNode: ddpkt.SrcNode,
|
||||
|
@ -158,7 +159,7 @@ func handleZIP(pcapHandle *pcap.Handle, srcHWAddr, myHWAddr ethernet.Addr, myAdd
|
|||
// routers should respond with a broadcast."
|
||||
outDDP := ddp.ExtPacket{
|
||||
ExtHeader: ddp.ExtHeader{
|
||||
Size: uint16(len(respRaw)),
|
||||
Size: uint16(len(respRaw)) + atalk.DDPExtHeaderSize,
|
||||
Cksum: 0,
|
||||
DstNet: ddpkt.SrcNet,
|
||||
DstNode: ddpkt.SrcNode,
|
||||
|
|
Loading…
Reference in a new issue