From 61809b4cf7467ae3988a2f6832c94d4d211552c8 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Sep 2010 18:09:38 +0200 Subject: Done splitting files --- Makefile | 5 +++++ main.c | 10 ++++++++++ udp.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f7786b0..5a7429d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ all: mactelnet +clean: dist-clean + +dist-clean: + rm -f mactelnet + mactelnet: main.c udp.h udp.c gcc -o mactelnet main.c udp.c diff --git a/main.c b/main.c index 402b676..3020db6 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,17 @@ #include +#include +#include #include "udp.h" int main (int argc, char **argv) { + int sockfd; + int result; + char data[11] = "1234567890"; + + sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); + result = sendCustomUDP(sockfd, "00:19:db:66:e5::bf", "04:1e:64:ea:e5:15", "10.0.0.100", 20561, "255.255.255.255", 20561, data, 10); + printf("Send result: %d\n", result); + close(sockfd); return 0; } diff --git a/udp.c b/udp.c index 191054d..b4bfb34 100644 --- a/udp.c +++ b/udp.c @@ -122,5 +122,5 @@ int sendCustomUDP(const int socket, const char *sourcemac, const char *destmac, send_result = sendto(socket, buffer, datalen+8+14+20, 0, (struct sockaddr*)&socket_address, sizeof(socket_address)); free(buffer); - return send_result; + return send_result-8-14-20; } -- cgit v1.2.3