added the udpv6 and also try to identify when v6 is used (tcp/udp)

This commit is contained in:
iceman1001 committed 2023-10-20 12:51:12 +02:00
1 parent a35bfbb13e
commit 0dc921c6b7
5 files changed
+22 -7

No files matched your search

+9 -4
View File
@@ -131,6 +131,10 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
}
}
// assume v4
g_conn.send_via_ip = PM3_TCPv4;
// find the port
char *lColon = strchr(addrPortStr, ':');
char *rColon = strrchr(addrPortStr, ':');
@@ -151,6 +155,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
} else {
portstr = "18888";
}
g_conn.send_via_ip = PM3_TCPv6;
}
// handle the end of the address
@@ -207,7 +212,6 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
return INVALID_SERIAL_PORT;
}
g_conn.send_via_ip = PM3_TCPv4;
return sp;
}
@@ -244,6 +248,9 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
}
}
// Assume v4
g_conn.send_via_ip = PM3_UDPv4;
// find the port
char *lColon = strchr(addrPortStr, ':');
char *rColon = strrchr(addrPortStr, ':');
@@ -264,6 +271,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
} else {
portstr = "18888";
}
g_conn.send_via_ip = PM3_UDPv6;
}
// handle the end of the address
@@ -279,7 +287,6 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
info.ai_family = PF_UNSPEC;
info.ai_socktype = SOCK_DGRAM;
// info.ai_protocol = SOL_UDP;
int s = getaddrinfo(addrstr, portstr, &info, &addr);
if (s != 0) {
@@ -314,8 +321,6 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
sp->fd = sfd;
sp->udpBuffer = RingBuf_create(MAX(sizeof(PacketResponseNGRaw), sizeof(PacketResponseOLD)) * 30);
g_conn.send_via_ip = PM3_UDPv4;
return sp;
}
+8 -3
View File
@@ -135,6 +135,9 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
}
}
// Assume v4
g_conn.send_via_ip = PM3_TCPv4;
// find the port
char *lColon = strchr(addrPortStr, ':');
char *rColon = strrchr(addrPortStr, ':');
@@ -155,6 +158,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
} else {
portstr = "18888";
}
g_conn.send_via_ip = PM3_TCPv6;
}
// handle the end of the address
@@ -225,7 +229,6 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
free(sp);
return INVALID_SERIAL_PORT;
}
g_conn.send_via_ip = PM3_TCPv4;
return sp;
}
@@ -263,6 +266,9 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
}
}
// Assume v4
g_conn.send_via_ip = PM3_UDPv4;
// find the port
char *lColon = strchr(addrPortStr, ':');
char *rColon = strrchr(addrPortStr, ':');
@@ -283,6 +289,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
} else {
portstr = "18888";
}
g_conn.send_via_ip = PM3_UDPv6;
}
// handle the end of the address
@@ -345,8 +352,6 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
sp->hSocket = hSocket;
sp->udpBuffer = RingBuf_create(MAX(sizeof(PacketResponseNGRaw), sizeof(PacketResponseOLD)) * 30);
g_conn.send_via_ip = PM3_UDPv4;
return sp;
}