Deleted Added
sdiff udiff text old ( 179894 ) new ( 181224 )
full compact
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 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>
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
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
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),
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}