Skip to content

Commit

Permalink
Minor cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiceatscion committed Feb 28, 2025
1 parent 0ba0d52 commit 0c98715
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions router/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -1258,8 +1258,6 @@ func (p *scionPacketProcessor) respInvalidDstIA() disposition {
// Provided that underlying network infrastructure prevents address spoofing,
// this check prevents malicious end hosts in the local AS from bypassing the
// SrcIA checks by disguising packets as transit traffic.
//
// TODO(multi_underlay): All or part of this check should move to the underlay.
func (p *scionPacketProcessor) validateTransitUnderlaySrc() disposition {
if p.path.IsFirstHop() || p.pkt.Ingress != 0 {
// not a transit packet, nothing to check
Expand All @@ -1271,6 +1269,8 @@ func (p *scionPacketProcessor) validateTransitUnderlaySrc() disposition {
// Drop
return errorDiscard("error", invalidSrcAddrForTransit)
}

// TODO(multi_underlay): This check should move to the underlay, in siblingLink.
src, okS := netip.AddrFromSlice(p.pkt.SrcAddr.IP)
if !(okS && ingressLink.Remote().Addr() == src) {
// Drop
Expand Down
5 changes: 0 additions & 5 deletions router/underlayproviders/udpip/udpip.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ func (l *externalLink) SendBlocking(p *router.Packet) {
l.egressQ <- p
}

// TODO(multi_underlay): try and move code common to all links back into the router.
func (l *externalLink) receive(size int, srcAddr *net.UDPAddr, pkt *router.Packet) {
metrics := l.metrics
sc := router.ClassOfSize(size)
Expand All @@ -506,7 +505,6 @@ func (l *externalLink) receive(size int, srcAddr *net.UDPAddr, pkt *router.Packe
return
}

pkt.RawPacket = pkt.RawPacket[:size] // Update size; readBatch does not.
pkt.Ingress = l.ifID
pkt.SrcAddr = srcAddr
// TODO(multi_underlay): would an expected/src check be useful here?
Expand Down Expand Up @@ -642,7 +640,6 @@ func (l *siblingLink) SendBlocking(p *router.Packet) {
l.egressQ <- p
}

// TODO(multi_underlay): try and move code common to all links back into the router.
func (l *siblingLink) receive(size int, srcAddr *net.UDPAddr, pkt *router.Packet) {
metrics := l.metrics
sc := router.ClassOfSize(size)
Expand All @@ -656,7 +653,6 @@ func (l *siblingLink) receive(size int, srcAddr *net.UDPAddr, pkt *router.Packet
metrics[sc].DroppedPacketsInvalid.Inc()
}

pkt.RawPacket = pkt.RawPacket[:size]
pkt.Ingress = 0
pkt.SrcAddr = srcAddr
// TODO(multi_underlay): can move expected/src check here.
Expand Down Expand Up @@ -773,7 +769,6 @@ func (l *internalLink) receive(size int, srcAddr *net.UDPAddr, pkt *router.Packe
return
}

pkt.RawPacket = pkt.RawPacket[:size] // Update size; readBatch does not.
pkt.Ingress = 0
pkt.SrcAddr = srcAddr
select {
Expand Down

0 comments on commit 0c98715

Please sign in to comment.