|
@@ -469,6 +469,8 @@ void BAddr_InitIPv6 (BAddr *addr, uint8_t *ip, uint16_t port)
|
|
|
addr->ipv6.port = port;
|
|
addr->ipv6.port = port;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#ifndef BADVPN_USE_WINAPI
|
|
|
|
|
+
|
|
|
void BAddr_InitPacket (BAddr *addr, uint16_t phys_proto, int interface_index, int header_type, int packet_type, uint8_t *phys_addr)
|
|
void BAddr_InitPacket (BAddr *addr, uint16_t phys_proto, int interface_index, int header_type, int packet_type, uint8_t *phys_addr)
|
|
|
{
|
|
{
|
|
|
ASSERT(header_type == BADDR_PACKET_HEADER_TYPE_ETHERNET)
|
|
ASSERT(header_type == BADDR_PACKET_HEADER_TYPE_ETHERNET)
|
|
@@ -484,13 +486,17 @@ void BAddr_InitPacket (BAddr *addr, uint16_t phys_proto, int interface_index, in
|
|
|
memcpy(addr->packet.phys_addr, phys_addr, 6);
|
|
memcpy(addr->packet.phys_addr, phys_addr, 6);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
int BAddr_IsRecognized (BAddr *addr)
|
|
int BAddr_IsRecognized (BAddr *addr)
|
|
|
{
|
|
{
|
|
|
switch (addr->type) {
|
|
switch (addr->type) {
|
|
|
case BADDR_TYPE_NONE:
|
|
case BADDR_TYPE_NONE:
|
|
|
case BADDR_TYPE_IPV4:
|
|
case BADDR_TYPE_IPV4:
|
|
|
case BADDR_TYPE_IPV6:
|
|
case BADDR_TYPE_IPV6:
|
|
|
|
|
+ #ifndef BADVPN_USE_WINAPI
|
|
|
case BADDR_TYPE_PACKET:
|
|
case BADDR_TYPE_PACKET:
|
|
|
|
|
+ #endif
|
|
|
return 1;
|
|
return 1;
|
|
|
default:
|
|
default:
|
|
|
return 0;
|
|
return 0;
|
|
@@ -524,6 +530,7 @@ void BAddr_Print (BAddr *addr, char *out)
|
|
|
BIPAddr_Print(&ipaddr, out);
|
|
BIPAddr_Print(&ipaddr, out);
|
|
|
sprintf(out + strlen(out), ":%"PRIu16, ntoh16(addr->ipv6.port));
|
|
sprintf(out + strlen(out), ":%"PRIu16, ntoh16(addr->ipv6.port));
|
|
|
break;
|
|
break;
|
|
|
|
|
+ #ifndef BADVPN_USE_WINAPI
|
|
|
case BADDR_TYPE_PACKET:
|
|
case BADDR_TYPE_PACKET:
|
|
|
ASSERT(addr->packet.header_type == BADDR_PACKET_HEADER_TYPE_ETHERNET)
|
|
ASSERT(addr->packet.header_type == BADDR_PACKET_HEADER_TYPE_ETHERNET)
|
|
|
sprintf(out, "proto=%"PRIu16",ifindex=%d,htype=eth,ptype=%d,addr=%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8,
|
|
sprintf(out, "proto=%"PRIu16",ifindex=%d,htype=eth,ptype=%d,addr=%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8,
|
|
@@ -531,6 +538,7 @@ void BAddr_Print (BAddr *addr, char *out)
|
|
|
addr->packet.phys_addr[0], addr->packet.phys_addr[1], addr->packet.phys_addr[2],
|
|
addr->packet.phys_addr[0], addr->packet.phys_addr[1], addr->packet.phys_addr[2],
|
|
|
addr->packet.phys_addr[3], addr->packet.phys_addr[4], addr->packet.phys_addr[5]);
|
|
addr->packet.phys_addr[3], addr->packet.phys_addr[4], addr->packet.phys_addr[5]);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ #endif
|
|
|
default:
|
|
default:
|
|
|
ASSERT(0);
|
|
ASSERT(0);
|
|
|
}
|
|
}
|