aboutsummaryrefslogtreecommitdiff
path: root/pkg/ipstack
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-10-24 01:12:05 +0000
committersotech117 <michael_foiani@brown.edu>2023-10-24 01:12:05 +0000
commit87b6e36391a0a37f5136910dfc331807add61eef (patch)
treeefcf0df633d1cf72545f823d44856394e552f704 /pkg/ipstack
parent6ac55a56369b2f98f094e7e36fa917b84c02cd07 (diff)
more descriptive errors to match reference. final commit :)
Diffstat (limited to 'pkg/ipstack')
-rw-r--r--pkg/ipstack/ipstack.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/ipstack/ipstack.go b/pkg/ipstack/ipstack.go
index d3178b8..fe8d743 100644
--- a/pkg/ipstack/ipstack.go
+++ b/pkg/ipstack/ipstack.go
@@ -330,7 +330,7 @@ func SendIP(src *netip.Addr, dest *Neighbor, protocolNum int, message []byte, de
// check if the interface is up
iface, err := GetInterfaceByName(dest.Name)
if !iface.State {
- return -1, errors.Errorf("error SEND: %s is down", iface.Name)
+ return 0, errors.Errorf("error SEND: %s is down", iface.Name)
}
// if the header is nil, create a new one
if hdr == nil {
@@ -371,7 +371,7 @@ func SendIP(src *netip.Addr, dest *Neighbor, protocolNum int, message []byte, de
// Assemble the header into a byte array
headerBytes, err := hdr.Marshal()
if err != nil {
- return -1, err
+ return 0, err
}
// Compute the checksum (see below)
@@ -397,7 +397,7 @@ func SendIP(src *netip.Addr, dest *Neighbor, protocolNum int, message []byte, de
bytesWritten, err := iface.Socket.WriteToUDP(bytesToSend, sendAddr)
if err != nil {
fmt.Println("Error writing to UDP socket")
- return -1, errors.WithMessage(err, "Error writing to UDP socket")
+ return 0, errors.WithMessage(err, "Error writing to UDP socket")
}
return bytesWritten, nil
@@ -1005,4 +1005,4 @@ func CleanUp() {
routingTable = make(map[netip.Prefix]Hop)
time.Sleep(5 * time.Millisecond)
-} \ No newline at end of file
+}