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
98bde989
Commit
98bde989
authored
Nov 10, 2006
by
Thomas Graf
Committed by
Stephen Hemminger
Nov 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rule notification support to ip monitor
Signed-off-by:
Stephen Hemminger
<
shemminger@osdl.org
>
parent
3123a0cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
ip/ip_common.h
ip/ip_common.h
+2
-0
ip/ipmonitor.c
ip/ipmonitor.c
+4
-0
ip/iprule.c
ip/iprule.c
+5
-3
No files found.
ip/ip_common.h
View file @
98bde989
...
...
@@ -20,6 +20,8 @@ extern int print_route(const struct sockaddr_nl *who,
struct
nlmsghdr
*
n
,
void
*
arg
);
extern
int
print_prefix
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
);
extern
int
print_rule
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
);
extern
int
do_ipaddr
(
int
argc
,
char
**
argv
);
extern
int
do_iproute
(
int
argc
,
char
**
argv
);
extern
int
do_iprule
(
int
argc
,
char
**
argv
);
...
...
ip/ipmonitor.c
View file @
98bde989
...
...
@@ -62,6 +62,10 @@ int accept_msg(const struct sockaddr_nl *who,
print_prefix
(
who
,
n
,
arg
);
return
0
;
}
if
(
n
->
nlmsg_type
==
RTM_NEWRULE
||
n
->
nlmsg_type
==
RTM_DELRULE
)
{
print_rule
(
who
,
n
,
arg
);
return
0
;
}
if
(
n
->
nlmsg_type
==
15
)
{
char
*
tstr
;
time_t
secs
=
((
__u32
*
)
NLMSG_DATA
(
n
))[
0
];
...
...
ip/iprule.c
View file @
98bde989
...
...
@@ -46,8 +46,7 @@ static void usage(void)
exit
(
-
1
);
}
static
int
print_rule
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
)
int
print_rule
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
)
{
FILE
*
fp
=
(
FILE
*
)
arg
;
struct
rtmsg
*
r
=
NLMSG_DATA
(
n
);
...
...
@@ -58,7 +57,7 @@ static int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n,
char
abuf
[
256
];
SPRINT_BUF
(
b1
);
if
(
n
->
nlmsg_type
!=
RTM_NEWRULE
)
if
(
n
->
nlmsg_type
!=
RTM_NEWRULE
&&
n
->
nlmsg_type
!=
RTM_DELRULE
)
return
0
;
len
-=
NLMSG_LENGTH
(
sizeof
(
*
r
));
...
...
@@ -76,6 +75,9 @@ static int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n,
else
if
(
r
->
rtm_family
==
AF_IPX
)
host_len
=
80
;
if
(
n
->
nlmsg_type
==
RTM_DELRULE
)
fprintf
(
fp
,
"Deleted "
);
if
(
tb
[
RTA_PRIORITY
])
fprintf
(
fp
,
"%u:
\t
"
,
*
(
unsigned
*
)
RTA_DATA
(
tb
[
RTA_PRIORITY
]));
else
...
...
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