summaryrefslogtreecommitdiff
path: root/udp.c
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-01 10:31:28 +0200
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-01 10:31:28 +0200
commitc9711c2fa0ae0efbf0e847d4226d0ab04edc05f2 (patch)
tree40a0ea453a654ec66f38b8a0aff6303f4667d372 /udp.c
parent471b10f6b547bb9b6088c8b079360ad91aaf8510 (diff)
downloadMAC-Telnet-c9711c2fa0ae0efbf0e847d4226d0ab04edc05f2.tar.gz
MAC-Telnet-c9711c2fa0ae0efbf0e847d4226d0ab04edc05f2.zip
Some code cleanup, and support for several sessions/instances on one interface. (random source port)
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/udp.c b/udp.c
index 2bed39a..4c1a383 100644
--- a/udp.c
+++ b/udp.c
@@ -34,7 +34,7 @@ unsigned short in_cksum(unsigned short *addr, int len)
return (answer);
}
-int sendCustomUDP(const int socket, const int ifindex, const unsigned char *sourcemac, const unsigned char *destmac, const struct in_addr *sourceip, const int sourceport, const struct in_addr *destip, const int destport, const char *data, const int datalen) {
+int sendCustomUDP(const int socket, const int ifindex, const unsigned char *sourcemac, const unsigned char *destmac, const struct in_addr *sourceip, const int sourceport, const struct in_addr *destip, const int destport, const unsigned char *data, const int datalen) {
struct sockaddr_ll socket_address;
/*
@@ -89,8 +89,8 @@ int sendCustomUDP(const int socket, const int ifindex, const unsigned char *sour
ip->check = in_cksum((unsigned short *)ip, sizeof(struct iphdr));
/* Init UDP Header */
- udp->source = htons(20561);
- udp->dest = htons(20561);
+ udp->source = htons(sourceport);
+ udp->dest = htons(destport);
udp->check = 0;
udp->len = htons(sizeof(struct udphdr) + datalen);