2020-12-16 17:48:02 +00:00
|
|
|
diff -up ./tunnel/IpTunnel.c.warn ./tunnel/IpTunnel.c
|
|
|
|
--- ./tunnel/IpTunnel.c.warn 2020-09-18 14:24:44.000000000 -0400
|
|
|
|
+++ ./tunnel/IpTunnel.c 2020-12-16 12:41:53.284105519 -0500
|
|
|
|
@@ -622,7 +622,7 @@ static Iface_DEFUN incomingControlMessag
|
|
|
|
Endian_bigEndianToHost32(x); \
|
|
|
|
}))
|
2016-03-22 15:40:36 +00:00
|
|
|
|
2020-12-16 17:48:02 +00:00
|
|
|
-static bool prefixMatches6(uint8_t* addressA, uint8_t* refAddr, uint8_t prefixLen)
|
|
|
|
+static bool prefixMatches6(const uint8_t* addressA, const uint8_t* refAddr, uint8_t prefixLen)
|
|
|
|
{
|
|
|
|
if (!prefixLen) {
|
|
|
|
Assert_true(Bits_isZero(refAddr, 16));
|
|
|
|
@@ -661,7 +661,7 @@ static bool isValidAddress4(uint8_t sour
|
|
|
|
return prefixMatches4(compareAddr, conn->connectionIp4, conn->connectionIp4Alloc);
|
|
|
|
}
|
2016-03-22 15:40:36 +00:00
|
|
|
|
2020-12-16 17:48:02 +00:00
|
|
|
-static bool isValidAddress6(uint8_t sourceAndDestIp6[32],
|
|
|
|
+static bool isValidAddress6(const uint8_t* sourceAndDestIp6,
|
|
|
|
bool isFromTun,
|
|
|
|
struct IpTunnel_Connection* conn)
|
|
|
|
{
|
|
|
|
@@ -669,7 +669,7 @@ static bool isValidAddress6(uint8_t sour
|
|
|
|
|| AddressCalc_validAddress(&sourceAndDestIp6[16])) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
- uint8_t* compareAddr = (isFromTun)
|
|
|
|
+ const uint8_t* compareAddr = (isFromTun)
|
|
|
|
? ((conn->isOutgoing) ? sourceAndDestIp6 : &sourceAndDestIp6[16])
|
|
|
|
: ((conn->isOutgoing) ? &sourceAndDestIp6[16] : sourceAndDestIp6);
|
|
|
|
return prefixMatches6(compareAddr, conn->connectionIp6, conn->connectionIp6Alloc);
|
|
|
|
diff -up ./util/AddrTools.c.warn ./util/AddrTools.c
|
|
|
|
--- ./util/AddrTools.c.warn 2020-12-15 22:01:15.611690648 -0500
|
|
|
|
+++ ./util/AddrTools.c 2020-12-16 12:44:11.013175227 -0500
|
|
|
|
@@ -187,7 +187,7 @@ void AddrTools_printShortIp(uint8_t outp
|
|
|
|
* "fc4f:630d:e499:8f5b:c49f:6e6b:01ae:3120".
|
|
|
|
* @return 0 if successful, -1 if the hexAddr is malformed.
|
2016-03-22 15:40:36 +00:00
|
|
|
*/
|
2020-12-16 17:48:02 +00:00
|
|
|
-int AddrTools_parseIp(uint8_t out[16], const uint8_t hexAddr[40])
|
|
|
|
+int AddrTools_parseIp(uint8_t out[16], const uint8_t* hexAddr)
|
|
|
|
{
|
|
|
|
struct Sockaddr_storage ss;
|
|
|
|
if (Sockaddr_parse((const char*) hexAddr, &ss)
|
|
|
|
diff -up ./util/AddrTools.h.warn ./util/AddrTools.h
|
|
|
|
--- ./util/AddrTools.h.warn 2020-12-15 22:03:56.036099586 -0500
|
|
|
|
+++ ./util/AddrTools.h 2020-12-16 12:44:18.772291827 -0500
|
|
|
|
@@ -44,7 +44,7 @@ void AddrTools_printShortIp(uint8_t outp
|
|
|
|
* "fc4f:630d:e499:8f5b:c49f:6e6b:01ae:3120".
|
|
|
|
* @return 0 if successful, -1 if the hexAddr is malformed.
|
|
|
|
*/
|
|
|
|
-int AddrTools_parseIp(uint8_t out[16], const uint8_t hexAddr[40]);
|
|
|
|
+int AddrTools_parseIp(uint8_t out[16], const uint8_t* hexAddr);
|
2017-02-24 18:11:57 +00:00
|
|
|
|
2020-12-16 17:48:02 +00:00
|
|
|
/**
|
|
|
|
* Parse out an ethernet MAC address.
|
|
|
|
diff -up ./util/Bits.h.warn ./util/Bits.h
|
|
|
|
--- ./util/Bits.h.warn 2020-12-15 21:52:43.800005230 -0500
|
|
|
|
+++ ./util/Bits.h 2020-12-15 21:52:57.496210893 -0500
|
|
|
|
@@ -98,7 +98,7 @@ static inline uint64_t Bits_bitReverse64
|
|
|
|
* @length the nuber of bytes to check for zero'd-ness.
|
|
|
|
* @return true if all bytes checked are zero.
|
|
|
|
*/
|
|
|
|
-static inline int Bits_isZero(void* buffer, size_t length)
|
|
|
|
+static inline int Bits_isZero(const void* buffer, size_t length)
|
|
|
|
{
|
|
|
|
uint8_t* buff = (uint8_t*) buffer;
|
|
|
|
for (size_t i = 0; i < length; i++) {
|
|
|
|
diff -up ./util/platform/Sockaddr.c.warn ./util/platform/Sockaddr.c
|
|
|
|
--- ./util/platform/Sockaddr.c.warn 2020-12-15 21:37:34.152353751 -0500
|
|
|
|
+++ ./util/platform/Sockaddr.c 2020-12-16 12:43:27.035514362 -0500
|
|
|
|
@@ -306,8 +306,9 @@ struct Sockaddr* Sockaddr_fromBytes(cons
|
2017-02-24 18:11:57 +00:00
|
|
|
|
2020-12-16 17:48:02 +00:00
|
|
|
struct Sockaddr_pvt* out = Allocator_calloc(alloc, addrLen + Sockaddr_OVERHEAD, 1);
|
|
|
|
Bits_memcpy(&out->ss, &ss, addrLen);
|
|
|
|
- out->pub.addrLen = addrLen + Sockaddr_OVERHEAD;
|
|
|
|
- return &out->pub;
|
|
|
|
+ struct Sockaddr* pub = &out->pub;
|
|
|
|
+ pub->addrLen = addrLen + Sockaddr_OVERHEAD;
|
|
|
|
+ return pub;
|
|
|
|
}
|
2016-03-22 15:40:36 +00:00
|
|
|
|
2020-12-16 17:48:02 +00:00
|
|
|
void Sockaddr_normalizeNative(void* nativeSockaddr)
|
|
|
|
@@ -344,4 +345,4 @@ void Sockaddr_addrFromHandle(struct Sock
|
|
|
|
addr->type = Sockaddr_HANDLE;
|
|
|
|
addr->addrLen = sizeof(struct Sockaddr);
|
|
|
|
Bits_memcpy(&((uint8_t*)addr)[4], &handle, 4);
|
|
|
|
-}
|
|
|
|
\ No newline at end of file
|
|
|
|
+}
|