spppcontrol.c (30303) | spppcontrol.c (32274) |
---|---|
1/* 2 * Copyright (c) 1997 Joerg Wunsch 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 8 unchanged lines hidden (view full) --- 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 1/* 2 * Copyright (c) 1997 Joerg Wunsch 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 8 unchanged lines hidden (view full) --- 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 * 26 * $Id$ | |
27 */ 28 | 25 */ 26 |
27#ifndef lint 28static const char rcsid[] = 29 "$Id$"; 30#endif /* not lint */ 31 |
|
29#include <sys/param.h> 30#include <sys/callout.h> 31#include <sys/ioctl.h> 32#include <sys/socket.h> 33#include <sys/time.h> 34 35#include <net/if.h> 36#include <net/if_var.h> 37#include <net/if_sppp.h> 38 39#include <err.h> | 32#include <sys/param.h> 33#include <sys/callout.h> 34#include <sys/ioctl.h> 35#include <sys/socket.h> 36#include <sys/time.h> 37 38#include <net/if.h> 39#include <net/if_var.h> 40#include <net/if_sppp.h> 41 42#include <err.h> |
40#include <errno.h> | |
41#include <fcntl.h> 42#include <stdio.h> 43#include <stdlib.h> 44#include <string.h> 45#include <sysexits.h> 46#include <unistd.h> 47 | 43#include <fcntl.h> 44#include <stdio.h> 45#include <stdlib.h> 46#include <string.h> 47#include <sysexits.h> 48#include <unistd.h> 49 |
48void usage(void); | 50static void usage(void); |
49void print_vals(const char *ifname, struct spppreq *sp); 50const char *phase_name(enum ppp_phase phase); 51const char *proto_name(u_short proto); 52const char *authflags(u_short flags); 53 54#define PPP_PAP 0xc023 55#define PPP_CHAP 0xc223 56 --- 116 unchanged lines hidden (view full) --- 173 err(EX_OSERR, "SIOCSIFGENERIC(SPPPIOSDEFS)"); 174 175 if (verbose) 176 print_vals(ifname, &spr); 177 178 return 0; 179} 180 | 51void print_vals(const char *ifname, struct spppreq *sp); 52const char *phase_name(enum ppp_phase phase); 53const char *proto_name(u_short proto); 54const char *authflags(u_short flags); 55 56#define PPP_PAP 0xc023 57#define PPP_CHAP 0xc223 58 --- 116 unchanged lines hidden (view full) --- 175 err(EX_OSERR, "SIOCSIFGENERIC(SPPPIOSDEFS)"); 176 177 if (verbose) 178 print_vals(ifname, &spr); 179 180 return 0; 181} 182 |
181void | 183static void |
182usage(void) 183{ | 184usage(void) 185{ |
184 errx(EX_USAGE, 185 "usage: [-v] ifname [{my|his}auth{proto|name|secret}=..." 186 "|callin|always]"); | 186 fprintf(stderr, "%s\n%s\n", 187 "usage: spppcontrol [-v] ifname [{my|his}auth{proto|name|secret}=...]", 188 " spppcontrol [-v] ifname callin|always"); 189 exit(EX_USAGE); |
187} 188 189void 190print_vals(const char *ifname, struct spppreq *sp) 191{ 192 printf("%s:\tphase=%s\n", ifname, phase_name(sp->defs.pp_phase)); 193 if (sp->defs.myauth.proto) { 194 printf("\tmyauthproto=%s myauthname=\"%.*s\"\n", --- 47 unchanged lines hidden --- | 190} 191 192void 193print_vals(const char *ifname, struct spppreq *sp) 194{ 195 printf("%s:\tphase=%s\n", ifname, phase_name(sp->defs.pp_phase)); 196 if (sp->defs.myauth.proto) { 197 printf("\tmyauthproto=%s myauthname=\"%.*s\"\n", --- 47 unchanged lines hidden --- |