diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2011-11-12 04:53:12 +0100 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2011-11-12 04:53:12 +0100 |
commit | 94ac14d2765051a8992c3a822547bc09260492df (patch) | |
tree | 53774d06d9c482c1b56fd7539ae48c7ac81f8775 /protocol.c | |
parent | 904d05c3d9dec35bad0413f933ea690868a09f4f (diff) | |
download | MAC-Telnet-94ac14d2765051a8992c3a822547bc09260492df.tar.gz MAC-Telnet-94ac14d2765051a8992c3a822547bc09260492df.zip |
Rewrote the interface handling. Added full support for kFreeBSD, have not tested with FreeBSD.
Diffstat (limited to 'protocol.c')
-rw-r--r-- | protocol.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -21,7 +21,9 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#ifdef __LINUX__ #include <linux/if_ether.h> +#endif #include <arpa/inet.h> #include <netinet/in.h> #include <netinet/ether.h> @@ -157,10 +159,10 @@ void parse_packet(unsigned char *data, struct mt_mactelnet_hdr *pkthdr) { pkthdr->ptype = data[1]; /* src ethernet addr */ - memcpy(pkthdr->srcaddr, data+2,6); + memcpy(pkthdr->srcaddr, data + 2, ETH_ALEN); /* dst ethernet addr */ - memcpy(pkthdr->dstaddr, data+8,6); + memcpy(pkthdr->dstaddr, data + 8, ETH_ALEN); if (mt_direction_fromserver) { /* Session key */ @@ -168,10 +170,10 @@ void parse_packet(unsigned char *data, struct mt_mactelnet_hdr *pkthdr) { pkthdr->seskey = ntohs(pkthdr->seskey); /* server type */ - memcpy(&(pkthdr->clienttype), data+16, 2); + memcpy(&(pkthdr->clienttype), data + 16, 2); } else { /* server type */ - memcpy(&(pkthdr->clienttype), data+14, 2); + memcpy(&(pkthdr->clienttype), data + 14, 2); /* Session key */ memcpy(&(pkthdr->seskey), data + 16, sizeof(pkthdr->seskey)); |