diff --git a/Target.cc b/Target.cc index 69d505468..121dbc00a 100644 --- a/Target.cc +++ b/Target.cc @@ -266,7 +266,7 @@ void Target::setSourceSockAddr(struct sockaddr_storage *ss, size_t ss_len) { } // Returns IPv4 host address or {0} if unavailable. -struct in_addr Target::v4source() { +struct in_addr Target::v4source() const { const struct in_addr *addy = v4sourceip(); struct in_addr in; if (addy) return *addy; @@ -275,7 +275,7 @@ struct in_addr Target::v4source() { } // Returns IPv4 host address or NULL if unavailable. -const struct in_addr *Target::v4sourceip() { +const struct in_addr *Target::v4sourceip() const { struct sockaddr_in *sin = (struct sockaddr_in *) &sourcesock; if (sin->sin_family == AF_INET) { return &(sin->sin_addr); @@ -451,11 +451,11 @@ const u8 *Target::MACAddress() const { return (MACaddress_set)? MACaddress : NULL; } -const u8 *Target::SrcMACAddress() { +const u8 *Target::SrcMACAddress() const { return (SrcMACaddress_set)? SrcMACaddress : NULL; } -const u8 *Target::NextHopMACAddress() { +const u8 *Target::NextHopMACAddress() const { return (NextHopMACaddress_set)? NextHopMACaddress : NULL; } diff --git a/Target.h b/Target.h index f9c5d848e..086b99376 100644 --- a/Target.h +++ b/Target.h @@ -155,8 +155,8 @@ class Target { /* Note that it is OK to pass in a sockaddr_in or sockaddr_in6 casted to sockaddr_storage */ void setSourceSockAddr(struct sockaddr_storage *ss, size_t ss_len); - struct in_addr v4source(); - const struct in_addr *v4sourceip(); + struct in_addr v4source() const; + const struct in_addr *v4sourceip() const; /* The IPv4 or IPv6 literal string for the target host */ const char *targetipstr() { return targetipstring; } /* Give the name from the last setHostName() call, which should be @@ -236,8 +236,8 @@ class Target { /* Returns a pointer to 6-byte MAC address, or NULL if none is set */ const u8 *MACAddress() const; - const u8 *SrcMACAddress(); - const u8 *NextHopMACAddress(); + const u8 *SrcMACAddress() const; + const u8 *NextHopMACAddress() const; /* Set the device names so that they can be returned by deviceName() and deviceFullName(). The normal name may not include alias