ifconfig.c (179894) | ifconfig.c (181224) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 33 The Regents of the University of California. All rights reserved.\n"; 34#endif /* not lint */ 35 36#ifndef lint 37#if 0 38static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; 39#endif 40static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 33 The Regents of the University of California. All rights reserved.\n"; 34#endif /* not lint */ 35 36#ifndef lint 37#if 0 38static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; 39#endif 40static const char rcsid[] = |
41 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 179894 2008-06-20 17:26:34Z thompsa $"; | 41 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 181224 2008-08-03 03:36:12Z thompsa $"; |
42#endif /* not lint */ 43 44#include <sys/param.h> 45#include <sys/ioctl.h> 46#include <sys/socket.h> 47#include <sys/sysctl.h> 48#include <sys/time.h> 49#include <sys/module.h> 50#include <sys/linker.h> 51 52#include <net/ethernet.h> 53#include <net/if.h> | 42#endif /* not lint */ 43 44#include <sys/param.h> 45#include <sys/ioctl.h> 46#include <sys/socket.h> 47#include <sys/sysctl.h> 48#include <sys/time.h> 49#include <sys/module.h> 50#include <sys/linker.h> 51 52#include <net/ethernet.h> 53#include <net/if.h> |
54#include <net/if_gre.h> | |
55#include <net/if_var.h> 56#include <net/if_dl.h> 57#include <net/if_types.h> 58#include <net/route.h> 59 60/* IP */ 61#include <netinet/in.h> 62#include <netinet/in_var.h> --- 682 unchanged lines hidden (view full) --- 745{ 746 strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); 747 ifr.ifr_mtu = atoi(val); 748 if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) < 0) 749 warn("ioctl (set mtu)"); 750} 751 752static void | 54#include <net/if_var.h> 55#include <net/if_dl.h> 56#include <net/if_types.h> 57#include <net/route.h> 58 59/* IP */ 60#include <netinet/in.h> 61#include <netinet/in_var.h> --- 682 unchanged lines hidden (view full) --- 744{ 745 strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); 746 ifr.ifr_mtu = atoi(val); 747 if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) < 0) 748 warn("ioctl (set mtu)"); 749} 750 751static void |
753setifgrekey(const char *val, int dummy __unused, int s, 754 const struct afswtch *afp) 755{ 756 uint32_t grekey = atol(val); 757 758 strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); 759 ifr.ifr_data = (caddr_t)&grekey; 760 if (ioctl(s, GRESKEY, (caddr_t)&ifr) < 0) 761 warn("ioctl (set grekey)"); 762} 763 764static void | |
765setifname(const char *val, int dummy __unused, int s, 766 const struct afswtch *afp) 767{ 768 char *newname; 769 770 newname = strdup(val); 771 if (newname == NULL) { 772 warn("no memory to set ifname"); --- 98 unchanged lines hidden (view full) --- 871 af_other_status(s); 872 else if (afp->af_other_status != NULL) 873 afp->af_other_status(s); 874 875 strncpy(ifs.ifs_name, name, sizeof ifs.ifs_name); 876 if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) 877 printf("%s", ifs.ascii); 878 | 752setifname(const char *val, int dummy __unused, int s, 753 const struct afswtch *afp) 754{ 755 char *newname; 756 757 newname = strdup(val); 758 if (newname == NULL) { 759 warn("no memory to set ifname"); --- 98 unchanged lines hidden (view full) --- 858 af_other_status(s); 859 else if (afp->af_other_status != NULL) 860 afp->af_other_status(s); 861 862 strncpy(ifs.ifs_name, name, sizeof ifs.ifs_name); 863 if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) 864 printf("%s", ifs.ascii); 865 |
879 int grekey = 0; 880 ifr.ifr_data = (caddr_t)&grekey; 881 if (ioctl(s, GREGKEY, &ifr) == 0) 882 if (grekey != 0) 883 printf("\tgrekey: %d\n", grekey); 884 | |
885 close(s); 886 return; 887} 888 889static void 890tunnel_status(int s) 891{ 892 af_all_tunnel_status(s); --- 155 unchanged lines hidden (view full) --- 1048 DEF_CMD("-wol_mcast", -IFCAP_WOL_MCAST, setifcap), 1049 DEF_CMD("wol_magic", IFCAP_WOL_MAGIC, setifcap), 1050 DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap), 1051 DEF_CMD("normal", -IFF_LINK0, setifflags), 1052 DEF_CMD("compress", IFF_LINK0, setifflags), 1053 DEF_CMD("noicmp", IFF_LINK1, setifflags), 1054 DEF_CMD_ARG("mtu", setifmtu), 1055 DEF_CMD_ARG("name", setifname), | 866 close(s); 867 return; 868} 869 870static void 871tunnel_status(int s) 872{ 873 af_all_tunnel_status(s); --- 155 unchanged lines hidden (view full) --- 1029 DEF_CMD("-wol_mcast", -IFCAP_WOL_MCAST, setifcap), 1030 DEF_CMD("wol_magic", IFCAP_WOL_MAGIC, setifcap), 1031 DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap), 1032 DEF_CMD("normal", -IFF_LINK0, setifflags), 1033 DEF_CMD("compress", IFF_LINK0, setifflags), 1034 DEF_CMD("noicmp", IFF_LINK1, setifflags), 1035 DEF_CMD_ARG("mtu", setifmtu), 1036 DEF_CMD_ARG("name", setifname), |
1056 DEF_CMD_ARG("grekey", setifgrekey), | |
1057}; 1058 1059static __constructor void 1060ifconfig_ctor(void) 1061{ 1062#define N(a) (sizeof(a) / sizeof(a[0])) 1063 int i; 1064 1065 for (i = 0; i < N(basic_cmds); i++) 1066 cmd_register(&basic_cmds[i]); 1067#undef N 1068} | 1037}; 1038 1039static __constructor void 1040ifconfig_ctor(void) 1041{ 1042#define N(a) (sizeof(a) / sizeof(a[0])) 1043 int i; 1044 1045 for (i = 0; i < N(basic_cmds); i++) 1046 cmd_register(&basic_cmds[i]); 1047#undef N 1048} |