Skip to content

Commit

Permalink
pkg/snet: fix isShimDispatcher condition (scionproto#4672)
Browse files Browse the repository at this point in the history
The condition was missing brackets around the IP. While at it this also
simplifies the code a bit.
  • Loading branch information
lukedirtwalker authored Dec 23, 2024
1 parent 0b42cbc commit ca52e4f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/snet/packet_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,8 @@ func (c *SCIONPacketConn) LocalAddr() net.Addr {
// comes from *loopback:30041*.
func (c *SCIONPacketConn) isShimDispatcher(udpAddr *net.UDPAddr) bool {
localAddr := c.LocalAddr().(*net.UDPAddr)
if udpAddr.IP.Equal(localAddr.IP) ||
udpAddr.IP.IsLoopback() &&
udpAddr.Port == underlay.EndhostPort {
return true
}
return false
return udpAddr.Port == underlay.EndhostPort &&
(udpAddr.IP.Equal(localAddr.IP) || udpAddr.IP.IsLoopback())
}

func (c *SCIONPacketConn) lastHop(p *Packet) (*net.UDPAddr, error) {
Expand Down

0 comments on commit ca52e4f

Please sign in to comment.