Date: Thu, 26 Dec 1996 20:49:49 -0500 (EST) From: root To: FreeBSD-gnats-submit@freebsd.org Cc: andrew@fortress.org Subject: bin/2293: Improvement to sliplogin Message-ID: <199612270149.UAA20174@stills.pubnix.net> Resent-Message-ID: <199612270150.RAA23861@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2293 >Category: bin >Synopsis: Improvement to sliplogin - prints dest. IP address >Confidential: NO >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Dec 26 17:50:01 PST 1996 >Last-Modified: >Originator: Root >Organization: PubNIX Montreal >Release: FreeBSD 2.1.6-RELEASE >Environment: ISP using FreeBSD as modem server >Description: Modification to sliplogin prints desitination's IP address before going into SLIP mode, useful for scripts that can automatically grok IP addresses ala Trumpet Winsock >How-To-Repeat: N/R >Fix: *** sliplogin.c.orig Sat Dec 21 16:45:02 1996 --- sliplogin.c Sat Dec 21 20:57:45 1996 *************** *** 105,110 **** --- 105,133 ---- char loginargs[BUFSIZ]; char loginfile[MAXPATHLEN]; char loginname[BUFSIZ]; + static char raddr[32]; + + + char * + make_ipaddr(void) + { + static char address[20] =""; + struct hostent *he; + unsigned long ipaddr; + int i; + + address[0] = '\0'; + if ((he = gethostbyname(raddr)) != NULL) { + ipaddr = ntohl(*(long *)he->h_addr_list[0]); + sprintf(address, "%lu.%lu.%lu.%lu", + ipaddr >> 24, + (ipaddr & 0x00ff0000) >> 16, + (ipaddr & 0x0000ff00) >> 8, + (ipaddr & 0x000000ff)); + } + + return address; + } struct slip_modes { char *sm_name; *************** *** 124,130 **** FILE *fp; static char slopt[5][16]; static char laddr[16]; - static char raddr[16]; static char mask[16]; char slparmsfile[MAXPATHLEN]; char user[16]; --- 147,152 ---- *************** *** 381,386 **** --- 403,412 ---- } (void) fchmod(0, 0600); (void) fprintf(stderr, "starting slip login for %s\n", loginname); + (void) fprintf(stderr, "your address is %s\n\n", make_ipaddr()); + + (void) fflush(stderr); + sleep(1); /* set up the line parameters */ if (tcgetattr(0, &tios) < 0) { >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612270149.UAA20174>