Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
5d4b8602
Commit
5d4b8602
authored
Mar 03, 1999
by
Phil Blundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Crusade against bogus AF specifics. Make it work (mostly)
to build without AF_INET.
parent
cbd46240
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
42 deletions
+65
-42
ifconfig.c
ifconfig.c
+14
-13
lib/hw.c
lib/hw.c
+12
-1
lib/inet.c
lib/inet.c
+9
-3
lib/interface.c
lib/interface.c
+27
-23
lib/net-support.h
lib/net-support.h
+1
-0
netstat.c
netstat.c
+2
-2
No files found.
ifconfig.c
View file @
5d4b8602
...
...
@@ -3,7 +3,7 @@
* that either displays or sets the characteristics of
* one or more of the system's networking interfaces.
*
* Version: $Id: ifconfig.c,v 1.2
7 1999/01/17 21:20:25
philip Exp $
* Version: $Id: ifconfig.c,v 1.2
8 1999/03/03 19:40:28
philip Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
...
...
@@ -140,9 +140,6 @@ void ife_print(struct interface *ptr)
int
plen
,
scope
,
dad_status
,
if_idx
;
extern
struct
aftype
inet6_aftype
;
char
addr6p
[
8
][
5
];
if
(
!
strncmp
(
ptr
->
name
,
"sit"
,
3
))
ptr
->
addr
.
sa_family
=
AF_INET6
;
/* fix this up properly one day */
#endif
ap
=
get_afntype
(
ptr
->
addr
.
sa_family
);
...
...
@@ -163,20 +160,22 @@ void ife_print(struct interface *ptr)
printf
(
_
(
"%-9.9s Link encap:%s "
),
ptr
->
name
,
hw
->
title
);
/* Don't print the hardware address for ATM or Ash if it's null. */
/* FIXME. Make this an option in struct hwtype. */
if
(
hw
->
sprint
!=
NULL
&&
((
strncmp
(
ptr
->
name
,
"atm"
,
3
)
&&
strncmp
(
ptr
->
name
,
"ash"
,
3
))
||
(
ptr
->
hwaddr
[
0
]
||
ptr
->
hwaddr
[
1
]
||
ptr
->
hwaddr
[
2
]
||
ptr
->
hwaddr
[
3
]
||
ptr
->
hwaddr
[
4
]
||
ptr
->
hwaddr
[
5
])))
(
!
hw_null_address
(
hw
,
ptr
->
hwaddr
))))
printf
(
_
(
"HWaddr %s "
),
hw
->
print
(
ptr
->
hwaddr
));
#ifdef IFF_PORTSEL
if
(
ptr
->
flags
&
IFF_PORTSEL
)
printf
(
_
(
"Media:%s%s"
),
if_port_text
[
ptr
->
map
.
port
][
0
],
(
ptr
->
flags
&
IFF_AUTOMEDIA
)
?
_
(
"(auto)"
)
:
""
);
if
(
ptr
->
flags
&
IFF_PORTSEL
)
{
printf
(
_
(
"Media:%s"
),
if_port_text
[
ptr
->
map
.
port
][
0
]);
if
(
ptr
->
flags
&
IFF_AUTOMEDIA
)
printf
(
_
(
"(auto)"
));
}
#endif
printf
(
"
\n
"
);
#if HAVE_AFINET6
if
(
ap
->
af
!=
AF_INET6
)
{
#endif
#if HAVE_AFINET
if
(
ptr
->
has_ip
)
{
printf
(
_
(
" %s addr:%s "
),
ap
->
name
,
ap
->
sprint
(
&
ptr
->
addr
,
1
));
if
(
ptr
->
flags
&
IFF_POINTOPOINT
)
{
...
...
@@ -186,8 +185,10 @@ void ife_print(struct interface *ptr)
printf
(
_
(
" Bcast:%s "
),
ap
->
sprint
(
&
ptr
->
broadaddr
,
1
));
}
printf
(
_
(
" Mask:%s
\n
"
),
ap
->
sprint
(
&
ptr
->
netmask
,
1
));
#if HAVE_AFINET6
}
#endif
#if HAVE_AFINET6
/* FIXME: should be integrated into interface.c. */
if
((
f
=
fopen
(
_PATH_PROCNET_IFINET6
,
"r"
))
!=
NULL
)
{
...
...
lib/hw.c
View file @
5d4b8602
...
...
@@ -2,7 +2,7 @@
* lib/hw.c This file contains the top-level part of the hardware
* support functions module.
*
* Version: $Id: hw.c,v 1.1
0 1999/01/05 20:53:31
philip Exp $
* Version: $Id: hw.c,v 1.1
1 1999/03/03 19:40:38
philip Exp $
*
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
*
...
...
@@ -237,3 +237,14 @@ void print_hwlist(int type) {
}
fprintf
(
stderr
,
"
\n
"
);
}
/* return 1 if address is all zeros */
int
hw_null_address
(
struct
hwtype
*
hw
,
void
*
ap
)
{
unsigned
int
i
;
unsigned
char
*
address
=
(
unsigned
char
*
)
ap
;
for
(
i
=
0
;
i
<
hw
->
alen
;
i
++
)
if
(
address
[
i
])
return
0
;
return
1
;
}
lib/inet.c
View file @
5d4b8602
...
...
@@ -3,7 +3,7 @@
* support functions for the net-tools.
* (NET-3 base distribution).
*
* Version: $Id: inet.c,v 1.
9 1999/03/02 21:09:14
philip Exp $
* Version: $Id: inet.c,v 1.
10 1999/03/03 19:40:41
philip Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation
...
...
@@ -26,10 +26,13 @@
*/
#include "config.h"
#if HAVE_AFINET
/* FIXME. Split this file into inet4.c for the IPv4 specific parts
and inet.c for those shared between IPv4 and IPv6. */
#if HAVE_AFINET || HAVE_AFINET6
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <ctype.h>
...
...
@@ -45,6 +48,7 @@
#include "pathnames.h"
#include "intl.h"
#include "util.h"
#endif
extern
int
h_errno
;
/* some netdb.h versions don't export this */
...
...
@@ -63,6 +67,8 @@ struct service {
static
struct
service
*
tcp_name
=
NULL
,
*
udp_name
=
NULL
,
*
raw_name
=
NULL
;
#if HAVE_AFINET
static
struct
addr
*
INET_nn
=
NULL
;
/* addr-to-name cache */
...
...
lib/interface.c
View file @
5d4b8602
...
...
@@ -4,7 +4,7 @@
10/1998 partly rewriten by Andi Kleen to support an interface list.
I don't claim that the list operations are efficient @).
$Id: interface.c,v 1.
1 1999/01/09 14:36:36
philip Exp $
$Id: interface.c,v 1.
2 1999/03/03 19:40:42
philip Exp $
*/
#include "config.h"
...
...
@@ -113,7 +113,10 @@ static int if_readconf(void)
if
(
skfd
<
0
)
{
fprintf
(
stderr
,
_
(
"warning: no inet socket available: %s
\n
"
),
strerror
(
errno
));
return
-
1
;
/* Try to soldier on with whatever socket we can get hold of. */
skfd
=
sockets_open
(
0
);
if
(
skfd
<
0
)
return
-
1
;
}
ifc
.
ifc_buf
=
NULL
;
...
...
@@ -394,31 +397,32 @@ int if_fetch(struct interface *ife)
#endif
#if HAVE_AFINET
/* IPv4 address? */
fd
=
get_socket_for_af
(
AF_INET
);
if
(
fd
>=
0
)
{
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFDSTADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
dstaddr
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
dstaddr
=
ifr
.
ifr_dstaddr
;
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFBRDADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
broadaddr
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
broadaddr
=
ifr
.
ifr_broadaddr
;
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFNETMASK
,
&
ifr
)
<
0
)
memset
(
&
ife
->
netmask
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
netmask
=
ifr
.
ifr_netmask
;
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
addr
,
0
,
sizeof
(
struct
sockaddr
));
else
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
==
0
)
{
ife
->
has_ip
=
1
;
ife
->
addr
=
ifr
.
ifr_addr
;
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFDSTADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
dstaddr
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
dstaddr
=
ifr
.
ifr_dstaddr
;
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFBRDADDR
,
&
ifr
)
<
0
)
memset
(
&
ife
->
broadaddr
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
broadaddr
=
ifr
.
ifr_broadaddr
;
strcpy
(
ifr
.
ifr_name
,
ifname
);
if
(
ioctl
(
fd
,
SIOCGIFNETMASK
,
&
ifr
)
<
0
)
memset
(
&
ife
->
netmask
,
0
,
sizeof
(
struct
sockaddr
));
else
ife
->
netmask
=
ifr
.
ifr_netmask
;
}
else
memset
(
&
ife
->
addr
,
0
,
sizeof
(
struct
sockaddr
));
}
#endif
...
...
lib/net-support.h
View file @
5d4b8602
...
...
@@ -73,6 +73,7 @@ extern void print_hwlist(int type);
extern
struct
aftype
*
get_aftype
(
const
char
*
name
);
extern
struct
aftype
*
get_afntype
(
int
type
);
extern
void
print_aflist
(
int
type
);
extern
int
hw_null_address
(
struct
hwtype
*
hw
,
void
*
addr
);
extern
int
getargs
(
char
*
string
,
char
*
arguments
[]);
...
...
netstat.c
View file @
5d4b8602
...
...
@@ -6,7 +6,7 @@
* NET-3 Networking Distribution for the LINUX operating
* system.
*
* Version: $Id: netstat.c,v 1.2
0 1999/03/02 09:20:44 ralf
Exp $
* Version: $Id: netstat.c,v 1.2
1 1999/03/03 19:40:32 philip
Exp $
*
* Authors: Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
...
...
@@ -257,7 +257,7 @@ static int netrom_info(void)
#endif
#if HAVE_AFINET
#if HAVE_AFINET
|| HAVE_AFINET6
enum
{
TCP_ESTABLISHED
=
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment