From ed9ad7793e563253865ad91f9570d26da2e94640 Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Sun, 25 Nov 2012 18:21:25 +0100 Subject: A few fixes taken from aouyar/MAC-Telnet --- mactelnet.c | 2 +- mactelnetd.c | 3 ++- mndp.c | 5 ++++- protocol.h | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mactelnet.c b/mactelnet.c index 19624ea..ad2c985 100644 --- a/mactelnet.c +++ b/mactelnet.c @@ -592,7 +592,7 @@ int main (int argc, char **argv) { inet_pton(AF_INET, (char *)"255.255.255.255", &destip); memcpy(&sourceip, &(si_me.sin_addr), IPV4_ALEN); - /* Sessioon key */ + /* Session key */ sessionkey = rand() % 65535; /* stop output buffering */ diff --git a/mactelnetd.c b/mactelnetd.c index 1738ce8..2c31e90 100644 --- a/mactelnetd.c +++ b/mactelnetd.c @@ -803,6 +803,7 @@ void mndp_broadcast() { mndp_add_attribute(&pdata, MT_MNDPTYPE_PLATFORM, PLATFORM_NAME, strlen(PLATFORM_NAME)); mndp_add_attribute(&pdata, MT_MNDPTYPE_HARDWARE, s_uname.machine, strlen(s_uname.machine)); mndp_add_attribute(&pdata, MT_MNDPTYPE_TIMESTAMP, &uptime, 4); + mndp_add_attribute(&pdata, MT_MNDPTYPE_SOFTID, MT_SOFTID_MACTELNET, strlen(MT_SOFTID_MACTELNET)); header->cksum = in_cksum((unsigned short *)&(pdata.data), pdata.size); send_special_udp(interface, MT_MNDP_PORT, &pdata); @@ -1019,7 +1020,7 @@ int main (int argc, char **argv) { signal(SIGCHLD,SIG_IGN); signal(SIGTSTP,SIG_IGN); signal(SIGTTOU,SIG_IGN); - signal(SIGTTIN,SIG_IGN); + signal(SIGTTIN,SIG_IGN); signal(SIGHUP, sighup_handler); signal(SIGTERM, sigterm_handler); diff --git a/mndp.c b/mndp.c index b229d3b..e8ba8e3 100644 --- a/mndp.c +++ b/mndp.c @@ -109,7 +109,10 @@ int mndp(void) { printf(" (%s %s %s)", packet->platform, packet->version, packet->hardware); } if (packet->uptime > 0) { - printf(_(" up %d days %d hours"), packet->uptime / 86400, packet->uptime % 86400 / 3600); + printf(_(" up %d days %d hours"), packet->uptime / 86400, packet->uptime % 86400 / 3600); + } + if (packet->softid != NULL) { + printf(" %s", packet->softid); } putchar('\n'); } diff --git a/protocol.h b/protocol.h index 11c9aca..28e0345 100644 --- a/protocol.h +++ b/protocol.h @@ -33,6 +33,8 @@ #define MT_MNDP_TIMEOUT 5 #define MT_MNDP_LONGTIMEOUT 120 +#define MT_SOFTID_MACTELNET "MAC-Telnet" + #ifndef ETH_ALEN #define ETH_ALEN 6 #endif -- cgit v1.2.3