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
a6118deb
Commit
a6118deb
authored
Aug 25, 2015
by
Mike Frysinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: af: constify aftype
Most callers never modify this structure, so constify it everywhere.
parent
2e15dacb
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
29 additions
and
29 deletions
+29
-29
arp.c
arp.c
+1
-1
ifconfig.c
ifconfig.c
+1
-1
lib/af.c
lib/af.c
+8
-8
lib/getroute.c
lib/getroute.c
+1
-1
lib/interface.c
lib/interface.c
+4
-4
lib/ipx_gr.c
lib/ipx_gr.c
+1
-1
lib/masq_info.c
lib/masq_info.c
+1
-1
lib/net-support.h
lib/net-support.h
+3
-3
lib/setroute.c
lib/setroute.c
+1
-1
lib/sockets.c
lib/sockets.c
+1
-1
netstat.c
netstat.c
+7
-7
No files found.
arp.c
View file @
a6118deb
...
...
@@ -88,7 +88,7 @@ int opt_v = 0; /* debugging output flag */
int
opt_D
=
0
;
/* HW-address is devicename */
int
opt_e
=
0
;
/* 0=BSD output, 1=new linux */
int
opt_a
=
0
;
/* all entries, substring match */
struct
aftype
*
ap
;
/* current address family */
const
struct
aftype
*
ap
;
/* current address family */
struct
hwtype
*
hw
;
/* current hardware type */
int
sockfd
=
0
;
/* active socket descriptor */
int
hw_set
=
0
;
/* flag if hw-type was set (-H) */
...
...
ifconfig.c
View file @
a6118deb
...
...
@@ -257,7 +257,7 @@ int main(int argc, char **argv)
struct
sockaddr
*
samask
=
(
struct
sockaddr
*
)
&
_samask
;
struct
sockaddr_in
*
sin
=
(
struct
sockaddr_in
*
)
sa
;
char
host
[
128
];
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
struct
hwtype
*
hw
;
struct
ifreq
ifr
;
int
goterr
=
0
,
didnetmask
=
0
,
neednetmask
=
0
;
...
...
lib/af.c
View file @
a6118deb
...
...
@@ -41,7 +41,7 @@ int flag_ash;
int
flag_bluetooth
;
struct
aftrans_t
{
st
atic
const
st
ruct
aftrans_t
{
char
*
alias
;
char
*
name
;
int
*
flag
;
...
...
@@ -117,7 +117,7 @@ extern struct aftype ash_aftype;
static
short
sVafinit
=
0
;
struct
aftype
*
aftypes
[]
=
struct
aftype
*
const
aftypes
[]
=
{
#if HAVE_AFUNIX
&
unix_aftype
,
...
...
@@ -233,9 +233,9 @@ void aftrans_def(char *tool, char *argv0, char *dflt)
/* Check our protocol family table for this family. */
struct
aftype
*
get_aftype
(
const
char
*
name
)
const
struct
aftype
*
get_aftype
(
const
char
*
name
)
{
struct
aftype
**
afp
;
struct
aftype
*
const
*
afp
;
if
(
!
sVafinit
)
afinit
();
...
...
@@ -253,9 +253,9 @@ struct aftype *get_aftype(const char *name)
/* Check our protocol family table for this family. */
struct
aftype
*
get_afntype
(
int
af
)
const
struct
aftype
*
get_afntype
(
int
af
)
{
struct
aftype
**
afp
;
struct
aftype
*
const
*
afp
;
if
(
!
sVafinit
)
afinit
();
...
...
@@ -278,7 +278,7 @@ int get_socket_for_af(int af)
int
aftrans_opt
(
const
char
*
arg
)
{
struct
aftrans_t
*
paft
;
const
struct
aftrans_t
*
paft
;
char
*
tmp1
,
*
tmp2
;
char
buf
[
256
];
...
...
@@ -321,7 +321,7 @@ int aftrans_opt(const char *arg)
void
print_aflist
(
int
type
)
{
int
count
=
0
;
const
char
*
txt
;
struct
aftype
**
afp
;
struct
aftype
*
const
*
afp
;
if
(
!
sVafinit
)
afinit
();
...
...
lib/getroute.c
View file @
a6118deb
...
...
@@ -75,7 +75,7 @@ void getroute_init(void)
int
route_info
(
const
char
*
afname
,
int
options
)
{
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
char
*
tmp1
,
*
tmp2
;
int
found
=
E_NOTFOUND
,
rc
;
char
buf
[
256
];
...
...
lib/interface.c
View file @
a6118deb
...
...
@@ -646,7 +646,7 @@ void ife_print_short(struct interface *ptr)
void
ife_print_long
(
struct
interface
*
ptr
)
{
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
struct
hwtype
*
hw
;
int
hf
;
int
can_compress
=
0
;
...
...
@@ -656,13 +656,13 @@ void ife_print_long(struct interface *ptr)
static
char
flags
[
200
];
#if HAVE_AFIPX
static
struct
aftype
*
ipxtype
=
NULL
;
static
const
struct
aftype
*
ipxtype
=
NULL
;
#endif
#if HAVE_AFECONET
static
struct
aftype
*
ectype
=
NULL
;
static
const
struct
aftype
*
ectype
=
NULL
;
#endif
#if HAVE_AFATALK
static
struct
aftype
*
ddptype
=
NULL
;
static
const
struct
aftype
*
ddptype
=
NULL
;
#endif
#if HAVE_AFINET6
FILE
*
f
;
...
...
lib/ipx_gr.c
View file @
a6118deb
...
...
@@ -40,7 +40,7 @@ int IPX_rprint(int options)
char
router_node
[
128
];
int
num
;
FILE
*
fp
;
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
struct
sockaddr
sa
;
fp
=
fopen
(
_PATH_PROCNET_IPX_ROUTE1
,
"r"
);
...
...
lib/masq_info.c
View file @
a6118deb
...
...
@@ -54,7 +54,7 @@ struct masq {
short
pdelta
;
/* Delta in sequence numbers before last */
};
static
struct
aftype
*
ap
;
/* current address family */
static
const
struct
aftype
*
ap
;
/* current address family */
static
int
has_pdelta
;
static
void
print_masq
(
struct
masq
*
ms
,
int
numeric_host
,
int
numeric_port
,
...
...
lib/net-support.h
View file @
a6118deb
...
...
@@ -52,7 +52,7 @@ struct aftype {
const
char
*
flag_file
;
};
extern
struct
aftype
*
aftypes
[];
extern
struct
aftype
*
const
aftypes
[];
/* This structure defines hardware protocols and their handlers. */
struct
hwtype
{
...
...
@@ -70,8 +70,8 @@ struct hwtype {
extern
struct
hwtype
*
get_hwtype
(
const
char
*
name
);
extern
struct
hwtype
*
get_hwntype
(
int
type
);
extern
void
print_hwlist
(
int
type
);
extern
struct
aftype
*
get_aftype
(
const
char
*
name
);
extern
struct
aftype
*
get_afntype
(
int
type
);
extern
const
struct
aftype
*
get_aftype
(
const
char
*
name
);
extern
const
struct
aftype
*
get_afntype
(
int
type
);
extern
void
print_aflist
(
int
type
);
extern
int
hw_null_address
(
struct
hwtype
*
hw
,
void
*
addr
);
...
...
lib/setroute.c
View file @
a6118deb
...
...
@@ -72,7 +72,7 @@ void setroute_init(void)
int
route_edit
(
int
action
,
const
char
*
afname
,
int
options
,
char
**
argv
)
{
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
ap
=
get_aftype
(
afname
);
...
...
lib/sockets.c
View file @
a6118deb
...
...
@@ -20,7 +20,7 @@ int skfd = -1; /* generic raw socket desc. */
int
sockets_open
(
int
family
)
{
struct
aftype
**
aft
;
struct
aftype
*
const
*
aft
;
int
sfd
=
-
1
;
static
int
force
=
-
1
;
...
...
netstat.c
View file @
a6118deb
...
...
@@ -622,7 +622,7 @@ static void igmp_do_one(int lnr, const char *line,const char *prot)
#else
struct
sockaddr_in
mcastaddr
;
#endif
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
static
int
idx_flag
=
0
;
static
int
igmp6_flag
=
0
;
static
char
device
[
16
];
...
...
@@ -782,7 +782,7 @@ static int ip_parse_dots(uint32_t *addr, char const *src) {
static
void
print_ip_service
(
struct
sockaddr_in
*
addr
,
char
const
*
protname
,
char
*
buf
,
unsigned
size
)
{
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
if
(
size
==
0
)
return
;
...
...
@@ -930,7 +930,7 @@ static int sctp_info(void) {
return
sctp_info_assocs
();
}
static
void
addr_do_one
(
char
*
buf
,
size_t
buf_len
,
size_t
short_len
,
struct
aftype
*
ap
,
static
void
addr_do_one
(
char
*
buf
,
size_t
buf_len
,
size_t
short_len
,
const
struct
aftype
*
ap
,
#if HAVE_AFINET6
struct
sockaddr_in6
*
addr
,
#else
...
...
@@ -963,7 +963,7 @@ static void tcp_do_one(int lnr, const char *line, const char *prot)
unsigned
long
rxq
,
txq
,
time_len
,
retr
,
inode
;
int
num
,
local_port
,
rem_port
,
d
,
state
,
uid
,
timer_run
,
timeout
;
char
rem_addr
[
128
],
local_addr
[
128
],
timers
[
64
];
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
#if HAVE_AFINET6
struct
sockaddr_in6
localaddr
,
remaddr
;
char
addr6
[
INET6_ADDRSTRLEN
];
...
...
@@ -1082,7 +1082,7 @@ static void udp_do_one(int lnr, const char *line,const char *prot)
#else
struct
sockaddr_in
localaddr
,
remaddr
;
#endif
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
unsigned
long
rxq
,
txq
,
time_len
,
retr
,
inode
;
if
(
lnr
==
0
)
...
...
@@ -1210,7 +1210,7 @@ static void raw_do_one(int lnr, const char *line,const char *prot)
#else
struct
sockaddr_in
localaddr
,
remaddr
;
#endif
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
unsigned
long
rxq
,
txq
,
time_len
,
retr
,
inode
;
if
(
lnr
==
0
)
...
...
@@ -1560,7 +1560,7 @@ static int ipx_info(void)
unsigned
int
uid
;
char
*
st
;
int
nc
;
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
struct
passwd
*
pw
;
char
sad
[
50
],
dad
[
50
];
struct
sockaddr
sa
;
...
...
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