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
c0d46405
Commit
c0d46405
authored
Aug 30, 2013
by
Bernd Eckenfels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show symbolic default only for 0.0.0.0/0 (which fixes Suse Bug#821077)
parent
0348310b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
lib/inet.c
lib/inet.c
+15
-5
No files found.
lib/inet.c
View file @
c0d46405
...
...
@@ -159,20 +159,30 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
#ifdef DEBUG
fprintf
(
stderr
,
"rresolve: %08lx, mask %08x, num %08x
\n
"
,
ad
,
netmask
,
numeric
);
#endif
// if no symbolic names are requested we shortcut with ntoa
if
(
numeric
&
0x0FFF
)
{
safe_strncpy
(
name
,
inet_ntoa
(
sin
->
sin_addr
),
len
);
return
(
0
);
}
// we skip getnetbyaddr for 0.0.0.0/0 and 0.0.0.0/~0
if
(
ad
==
INADDR_ANY
)
{
if
((
numeric
&
0x0FFF
)
==
0
)
{
if
(
netmask
==
INADDR_ANY
)
{
// for 0.0.0.0/0 we hardcode symbolic name
if
(
numeric
&
0x8000
)
safe_strncpy
(
name
,
"default"
,
len
);
else
safe_strncpy
(
name
,
"*"
,
len
);
return
(
0
);
}
else
{
// for 0.0.0.0/1 we skip getnetbyname()
safe_strncpy
(
name
,
"0.0.0.0"
,
len
);
return
(
0
);
}
}
if
(
numeric
&
0x0FFF
)
{
safe_strncpy
(
name
,
inet_ntoa
(
sin
->
sin_addr
),
len
);
return
(
0
);
}
// it is a host address if flagged or any host bits set
if
((
ad
&
(
~
netmask
))
!=
0
||
(
numeric
&
0x4000
))
host
=
1
;
#if 0
...
...
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