Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
iproute2
Commits
ff9d8f37
Commit
ff9d8f37
authored
Mar 22, 2016
by
Phil Sutter
Committed by
Stephen Hemminger
Mar 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipaddress: colorize peer, broadcast and anycast addresses as well
Signed-off-by:
Phil Sutter
<
phil@nwl.cc
>
parent
a1121aa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
ip/ipaddress.c
ip/ipaddress.c
+17
-14
No files found.
ip/ipaddress.c
View file @
ff9d8f37
...
@@ -862,7 +862,8 @@ int print_linkinfo(const struct sockaddr_nl *who,
...
@@ -862,7 +862,8 @@ int print_linkinfo(const struct sockaddr_nl *who,
fprintf
(
fp
,
" peer "
);
fprintf
(
fp
,
" peer "
);
else
else
fprintf
(
fp
,
" brd "
);
fprintf
(
fp
,
" brd "
);
fprintf
(
fp
,
"%s"
,
ll_addr_n2a
(
RTA_DATA
(
tb
[
IFLA_BROADCAST
]),
color_fprintf
(
fp
,
COLOR_MAC
,
"%s"
,
ll_addr_n2a
(
RTA_DATA
(
tb
[
IFLA_BROADCAST
]),
RTA_PAYLOAD
(
tb
[
IFLA_BROADCAST
]),
RTA_PAYLOAD
(
tb
[
IFLA_BROADCAST
]),
ifi
->
ifi_type
,
ifi
->
ifi_type
,
b1
,
sizeof
(
b1
)));
b1
,
sizeof
(
b1
)));
...
@@ -1062,32 +1063,34 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
...
@@ -1062,32 +1063,34 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
RTA_PAYLOAD
(
rta_tb
[
IFA_LOCAL
]),
RTA_PAYLOAD
(
rta_tb
[
IFA_LOCAL
]),
RTA_DATA
(
rta_tb
[
IFA_LOCAL
]),
RTA_DATA
(
rta_tb
[
IFA_LOCAL
]),
abuf
,
sizeof
(
abuf
)));
abuf
,
sizeof
(
abuf
)));
if
(
rta_tb
[
IFA_ADDRESS
]
==
NULL
||
if
(
rta_tb
[
IFA_ADDRESS
]
&&
memcmp
(
RTA_DATA
(
rta_tb
[
IFA_ADDRESS
]),
RTA_DATA
(
rta_tb
[
IFA_LOCAL
]),
memcmp
(
RTA_DATA
(
rta_tb
[
IFA_ADDRESS
]),
ifa
->
ifa_family
==
AF_INET
?
4
:
16
)
==
0
)
{
RTA_DATA
(
rta_tb
[
IFA_LOCAL
]),
fprintf
(
fp
,
"/%d "
,
ifa
->
ifa_prefixlen
);
ifa
->
ifa_family
==
AF_INET
?
4
:
16
))
{
}
else
{
fprintf
(
fp
,
" peer "
);
fprintf
(
fp
,
" peer %s/%d "
,
color_fprintf
(
fp
,
ifa_family_color
(
ifa
->
ifa_family
),
format_host
(
ifa
->
ifa_family
,
"%s"
,
format_host
(
ifa
->
ifa_family
,
RTA_PAYLOAD
(
rta_tb
[
IFA_ADDRESS
]),
RTA_PAYLOAD
(
rta_tb
[
IFA_ADDRESS
]),
RTA_DATA
(
rta_tb
[
IFA_ADDRESS
]),
RTA_DATA
(
rta_tb
[
IFA_ADDRESS
]),
abuf
,
sizeof
(
abuf
)),
abuf
,
sizeof
(
abuf
)));
ifa
->
ifa_prefixlen
);
}
}
fprintf
(
fp
,
"/%d "
,
ifa
->
ifa_prefixlen
);
}
}
if
(
brief
)
if
(
brief
)
goto
brief_exit
;
goto
brief_exit
;
if
(
rta_tb
[
IFA_BROADCAST
])
{
if
(
rta_tb
[
IFA_BROADCAST
])
{
fprintf
(
fp
,
"brd %s "
,
fprintf
(
fp
,
"brd "
);
color_fprintf
(
fp
,
ifa_family_color
(
ifa
->
ifa_family
),
"%s "
,
format_host
(
ifa
->
ifa_family
,
format_host
(
ifa
->
ifa_family
,
RTA_PAYLOAD
(
rta_tb
[
IFA_BROADCAST
]),
RTA_PAYLOAD
(
rta_tb
[
IFA_BROADCAST
]),
RTA_DATA
(
rta_tb
[
IFA_BROADCAST
]),
RTA_DATA
(
rta_tb
[
IFA_BROADCAST
]),
abuf
,
sizeof
(
abuf
)));
abuf
,
sizeof
(
abuf
)));
}
}
if
(
rta_tb
[
IFA_ANYCAST
])
{
if
(
rta_tb
[
IFA_ANYCAST
])
{
fprintf
(
fp
,
"any %s "
,
fprintf
(
fp
,
"any "
);
color_fprintf
(
fp
,
ifa_family_color
(
ifa
->
ifa_family
),
"%s "
,
format_host
(
ifa
->
ifa_family
,
format_host
(
ifa
->
ifa_family
,
RTA_PAYLOAD
(
rta_tb
[
IFA_ANYCAST
]),
RTA_PAYLOAD
(
rta_tb
[
IFA_ANYCAST
]),
RTA_DATA
(
rta_tb
[
IFA_ANYCAST
]),
RTA_DATA
(
rta_tb
[
IFA_ANYCAST
]),
...
...
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