Deleted Added
full compact
ifconfig.c (79105) ifconfig.c (80057)
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

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
43#endif
44static 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

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
43#endif
44static const char rcsid[] =
45 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 79105 2001-07-02 20:52:34Z brooks $";
45 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 80057 2001-07-21 00:35:11Z obrien $";
46#endif /* not lint */
47
48#include <sys/param.h>
49#include <sys/ioctl.h>
50#include <sys/socket.h>
51#include <sys/sysctl.h>
52#include <sys/time.h>
53#include <sys/module.h>

--- 11 unchanged lines hidden (view full) ---

65#include <netinet/in_var.h>
66#include <arpa/inet.h>
67#include <netdb.h>
68
69#ifdef INET6
70#include <netinet6/nd6.h> /* Define ND6_INFINITE_LIFETIME */
71#endif
72
46#endif /* not lint */
47
48#include <sys/param.h>
49#include <sys/ioctl.h>
50#include <sys/socket.h>
51#include <sys/sysctl.h>
52#include <sys/time.h>
53#include <sys/module.h>

--- 11 unchanged lines hidden (view full) ---

65#include <netinet/in_var.h>
66#include <arpa/inet.h>
67#include <netdb.h>
68
69#ifdef INET6
70#include <netinet6/nd6.h> /* Define ND6_INFINITE_LIFETIME */
71#endif
72
73#ifndef NO_IPX
73/* IPX */
74#define IPXIP
75#define IPTUNNEL
76#include <netipx/ipx.h>
77#include <netipx/ipx_if.h>
74/* IPX */
75#define IPXIP
76#define IPTUNNEL
77#include <netipx/ipx.h>
78#include <netipx/ipx_if.h>
79#endif
78
79/* Appletalk */
80#include <netatalk/at.h>
81
82/* XNS */
83#ifdef NS
84#define NSIP
85#include <netns/ns.h>

--- 197 unchanged lines hidden (view full) ---

283/*
284 * XNS support liberally adapted from code written at the University of
285 * Maryland principally by James O'Toole and Chris Torek.
286 */
287typedef void af_status __P((int, struct rt_addrinfo *));
288typedef void af_getaddr __P((const char *, int));
289typedef void af_getprefix __P((const char *, int));
290
80
81/* Appletalk */
82#include <netatalk/at.h>
83
84/* XNS */
85#ifdef NS
86#define NSIP
87#include <netns/ns.h>

--- 197 unchanged lines hidden (view full) ---

285/*
286 * XNS support liberally adapted from code written at the University of
287 * Maryland principally by James O'Toole and Chris Torek.
288 */
289typedef void af_status __P((int, struct rt_addrinfo *));
290typedef void af_getaddr __P((const char *, int));
291typedef void af_getprefix __P((const char *, int));
292
291af_status in_status, ipx_status, at_status, ether_status;
292af_getaddr in_getaddr, ipx_getaddr, at_getaddr, ether_getaddr;
293af_status in_status, at_status, ether_status;
294af_getaddr in_getaddr, at_getaddr, ether_getaddr;
293
295
296#ifndef NO_IPX
297af_status ipx_status;
298af_getaddr ipx_getaddr;
299#endif
300
294#ifdef INET6
295af_status in6_status;
296af_getaddr in6_getaddr;
297af_getprefix in6_getprefix;
298#endif /*INET6*/
299#ifdef NS
300af_status xns_status;
301af_getaddr xns_getaddr;

--- 15 unchanged lines hidden (view full) ---

317#define C(x) ((caddr_t) &x)
318 { "inet", AF_INET, in_status, in_getaddr, NULL,
319 SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
320#ifdef INET6
321 { "inet6", AF_INET6, in6_status, in6_getaddr, in6_getprefix,
322 SIOCDIFADDR_IN6, SIOCAIFADDR_IN6,
323 C(in6_ridreq), C(in6_addreq) },
324#endif /*INET6*/
301#ifdef INET6
302af_status in6_status;
303af_getaddr in6_getaddr;
304af_getprefix in6_getprefix;
305#endif /*INET6*/
306#ifdef NS
307af_status xns_status;
308af_getaddr xns_getaddr;

--- 15 unchanged lines hidden (view full) ---

324#define C(x) ((caddr_t) &x)
325 { "inet", AF_INET, in_status, in_getaddr, NULL,
326 SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
327#ifdef INET6
328 { "inet6", AF_INET6, in6_status, in6_getaddr, in6_getprefix,
329 SIOCDIFADDR_IN6, SIOCAIFADDR_IN6,
330 C(in6_ridreq), C(in6_addreq) },
331#endif /*INET6*/
332#ifndef NO_IPX
325 { "ipx", AF_IPX, ipx_status, ipx_getaddr, NULL,
326 SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
333 { "ipx", AF_IPX, ipx_status, ipx_getaddr, NULL,
334 SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
335#endif
327 { "atalk", AF_APPLETALK, at_status, at_getaddr, NULL,
328 SIOCDIFADDR, SIOCAIFADDR, C(addreq), C(addreq) },
329#ifdef NS
330 { "ns", AF_NS, xns_status, xns_getaddr, NULL,
331 SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
332#endif
333 { "ether", AF_LINK, ether_status, ether_getaddr, NULL,
334 0, SIOCSIFLLADDR, NULL, C(ridreq) },

--- 343 unchanged lines hidden (view full) ---

678 if (ifr.ifr_addr.sa_family == AF_INET6 && explicit_prefix == 0) {
679 /* Aggregatable address architecture defines all prefixes
680 are 64. So, it is convenient to set prefixlen to 64 if
681 it is not specified. */
682 setifprefixlen("64", 0, s, afp);
683 /* in6_getprefix("64", MASK) if MASK is available here... */
684 }
685#endif
336 { "atalk", AF_APPLETALK, at_status, at_getaddr, NULL,
337 SIOCDIFADDR, SIOCAIFADDR, C(addreq), C(addreq) },
338#ifdef NS
339 { "ns", AF_NS, xns_status, xns_getaddr, NULL,
340 SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
341#endif
342 { "ether", AF_LINK, ether_status, ether_getaddr, NULL,
343 0, SIOCSIFLLADDR, NULL, C(ridreq) },

--- 343 unchanged lines hidden (view full) ---

687 if (ifr.ifr_addr.sa_family == AF_INET6 && explicit_prefix == 0) {
688 /* Aggregatable address architecture defines all prefixes
689 are 64. So, it is convenient to set prefixlen to 64 if
690 it is not specified. */
691 setifprefixlen("64", 0, s, afp);
692 /* in6_getprefix("64", MASK) if MASK is available here... */
693 }
694#endif
695#ifndef NO_IPX
686 if (setipdst && ifr.ifr_addr.sa_family == AF_IPX) {
687 struct ipxip_req rq;
688 int size = sizeof(rq);
689
690 rq.rq_ipx = addreq.ifra_addr;
691 rq.rq_ip = addreq.ifra_dstaddr;
692
693 if (setsockopt(s, 0, SO_IPXIP_ROUTE, &rq, size) < 0)
694 Perror("Encapsulation Routing");
695 }
696 if (setipdst && ifr.ifr_addr.sa_family == AF_IPX) {
697 struct ipxip_req rq;
698 int size = sizeof(rq);
699
700 rq.rq_ipx = addreq.ifra_addr;
701 rq.rq_ip = addreq.ifra_dstaddr;
702
703 if (setsockopt(s, 0, SO_IPXIP_ROUTE, &rq, size) < 0)
704 Perror("Encapsulation Routing");
705 }
706#endif
696 if (ifr.ifr_addr.sa_family == AF_APPLETALK)
697 checkatrange((struct sockaddr_at *) &addreq.ifra_addr);
698#ifdef NS
699 if (setipdst && ifr.ifr_addr.sa_family == AF_NS) {
700 struct nsip_req rq;
701 int size = sizeof(rq);
702
703 rq.rq_ns = addreq.ifra_addr;

--- 720 unchanged lines hidden (view full) ---

1424 } else
1425 printf("infty ");
1426 }
1427
1428 putchar('\n');
1429}
1430#endif /*INET6*/
1431
707 if (ifr.ifr_addr.sa_family == AF_APPLETALK)
708 checkatrange((struct sockaddr_at *) &addreq.ifra_addr);
709#ifdef NS
710 if (setipdst && ifr.ifr_addr.sa_family == AF_NS) {
711 struct nsip_req rq;
712 int size = sizeof(rq);
713
714 rq.rq_ns = addreq.ifra_addr;

--- 720 unchanged lines hidden (view full) ---

1435 } else
1436 printf("infty ");
1437 }
1438
1439 putchar('\n');
1440}
1441#endif /*INET6*/
1442
1443#ifndef NO_IPX
1432void
1433ipx_status(s, info)
1434 int s __unused;
1435 struct rt_addrinfo * info;
1436{
1437 struct sockaddr_ipx *sipx, null_sipx;
1438
1439 memset(&null_sipx, 0, sizeof(null_sipx));

--- 4 unchanged lines hidden (view full) ---

1444 if (flags & IFF_POINTOPOINT) {
1445 sipx = (struct sockaddr_ipx *)info->rti_info[RTAX_BRD];
1446 if (!sipx)
1447 sipx = &null_sipx;
1448 printf("--> %s ", ipx_ntoa(sipx->sipx_addr));
1449 }
1450 putchar('\n');
1451}
1444void
1445ipx_status(s, info)
1446 int s __unused;
1447 struct rt_addrinfo * info;
1448{
1449 struct sockaddr_ipx *sipx, null_sipx;
1450
1451 memset(&null_sipx, 0, sizeof(null_sipx));

--- 4 unchanged lines hidden (view full) ---

1456 if (flags & IFF_POINTOPOINT) {
1457 sipx = (struct sockaddr_ipx *)info->rti_info[RTAX_BRD];
1458 if (!sipx)
1459 sipx = &null_sipx;
1460 printf("--> %s ", ipx_ntoa(sipx->sipx_addr));
1461 }
1462 putchar('\n');
1463}
1464#endif
1452
1453void
1454at_status(s, info)
1455 int s __unused;
1456 struct rt_addrinfo * info;
1457{
1458 struct sockaddr_at *sat, null_sat;
1459 struct netrange *nr;

--- 236 unchanged lines hidden (view full) ---

1696 } else
1697 for (; *bits > 32; bits++)
1698 ;
1699 }
1700 putchar('>');
1701 }
1702}
1703
1465
1466void
1467at_status(s, info)
1468 int s __unused;
1469 struct rt_addrinfo * info;
1470{
1471 struct sockaddr_at *sat, null_sat;
1472 struct netrange *nr;

--- 236 unchanged lines hidden (view full) ---

1709 } else
1710 for (; *bits > 32; bits++)
1711 ;
1712 }
1713 putchar('>');
1714 }
1715}
1716
1717#ifndef NO_IPX
1704#define SIPX(x) ((struct sockaddr_ipx *) &(x))
1705struct sockaddr_ipx *sipxtab[] = {
1706SIPX(ridreq.ifr_addr), SIPX(addreq.ifra_addr),
1707SIPX(addreq.ifra_mask), SIPX(addreq.ifra_broadaddr)};
1708
1709void
1710ipx_getaddr(addr, which)
1711 const char *addr;
1712 int which;
1713{
1714 struct sockaddr_ipx *sipx = sipxtab[which];
1715
1716 sipx->sipx_family = AF_IPX;
1717 sipx->sipx_len = sizeof(*sipx);
1718 sipx->sipx_addr = ipx_addr(addr);
1719 if (which == MASK)
1720 printf("Attempt to set IPX netmask will be ineffectual\n");
1721}
1718#define SIPX(x) ((struct sockaddr_ipx *) &(x))
1719struct sockaddr_ipx *sipxtab[] = {
1720SIPX(ridreq.ifr_addr), SIPX(addreq.ifra_addr),
1721SIPX(addreq.ifra_mask), SIPX(addreq.ifra_broadaddr)};
1722
1723void
1724ipx_getaddr(addr, which)
1725 const char *addr;
1726 int which;
1727{
1728 struct sockaddr_ipx *sipx = sipxtab[which];
1729
1730 sipx->sipx_family = AF_IPX;
1731 sipx->sipx_len = sizeof(*sipx);
1732 sipx->sipx_addr = ipx_addr(addr);
1733 if (which == MASK)
1734 printf("Attempt to set IPX netmask will be ineffectual\n");
1735}
1736#endif
1722
1723void
1724at_getaddr(addr, which)
1725 const char *addr;
1726 int which;
1727{
1728 struct sockaddr_at *sat = (struct sockaddr_at *) &addreq.ifra_addr;
1729 u_int net, node;

--- 282 unchanged lines hidden ---
1737
1738void
1739at_getaddr(addr, which)
1740 const char *addr;
1741 int which;
1742{
1743 struct sockaddr_at *sat = (struct sockaddr_at *) &addreq.ifra_addr;
1744 u_int net, node;

--- 282 unchanged lines hidden ---