@@ -454,6 +454,7 @@
buf_printf(&out, "UNKNOWN");
break;
}
+ buf_printf(&out, "|%d", maddr.proto);
return BSTR(&out);
}
else
@@ -74,7 +74,7 @@
struct mroute_addr {
uint8_t len; /* length of address */
- uint8_t unused;
+ uint8_t proto;
uint8_t type; /* MR_ADDR/MR_WITH flags */
uint8_t netbits; /* number of bits in network part of address,
* valid if MR_WITH_NETBITS is set */
@@ -183,6 +183,15 @@
{
unsigned int ret = 0;
verify_align_4(buf);
+
+ /*
+ * Since we don't really need the protocol on vaddresses for internal VPN
+ * payload packets, make sure we have the same value to avoid hashing insert
+ * and search issues.
+ */
+ src->proto = 0;
+ dest->proto = src->proto;
+
if (tunnel_type == DEV_TYPE_TUN)
{
ret = mroute_extract_addr_ip(src, dest, buf);
@@ -216,13 +225,13 @@
mroute_addr_hash_ptr(const struct mroute_addr *a)
{
/* NOTE: depends on ordering of struct mroute_addr */
- return (uint8_t *) &a->type;
+ return (uint8_t *) &a->proto;
}
static inline uint32_t
mroute_addr_hash_len(const struct mroute_addr *a)
{
- return (uint32_t) a->len + 2;
+ return (uint32_t) a->len + 3;
}
static inline void
@@ -56,6 +56,7 @@
mi = multi_create_instance(m, NULL, ls);
if (mi)
{
+ mi->real.proto = ls->info.proto;
struct hash_element *he;
const uint32_t hv = hash_value(hash, &mi->real);
struct hash_bucket *bucket = hash_bucket(hash, hv);
@@ -192,6 +192,7 @@
struct mroute_addr real = {0};
struct multi_instance *mi = NULL;
struct hash *hash = m->hash;
+ real.proto = ls->info.proto;
if (mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true)
&& m->top.c2.buf.len > 0)
@@ -1243,6 +1243,7 @@
CLEAR(remote_si);
remote_si.addr.in4.sin_family = AF_INET;
remote_si.addr.in4.sin_addr.s_addr = htonl(a);
+ addr.proto = 0;
ASSERT(mroute_extract_openvpn_sockaddr(&addr, &remote_si, false));
if (netbits >= 0)
@@ -3548,7 +3549,6 @@
const int dev_type = TUNNEL_TYPE(m->top.c1.tuntap);
int16_t vid = 0;
-
#ifdef MULTI_DEBUG_EVENT_LOOP
printf("TUN -> TCP/UDP [%d]\n", BLEN(&m->top.c2.buf));
#endif