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
598a42c0
Commit
598a42c0
authored
Mar 13, 2012
by
Florian Westphal
Committed by
Stephen Hemminger
Mar 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ip: xfrm: report nat-t/encapsulation portmapping updates
Signed-off-by:
Florian Westphal
<
fw@strlen.de
>
parent
c23abafb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
7 deletions
+49
-7
ip/xfrm_monitor.c
ip/xfrm_monitor.c
+49
-7
No files found.
ip/xfrm_monitor.c
View file @
598a42c0
...
@@ -221,6 +221,20 @@ void xfrm_ae_flags_print(__u32 flags, void *arg)
...
@@ -221,6 +221,20 @@ void xfrm_ae_flags_print(__u32 flags, void *arg)
}
}
static
void
xfrm_usersa_print
(
const
struct
xfrm_usersa_id
*
sa_id
,
__u32
reqid
,
FILE
*
fp
)
{
char
buf
[
256
];
buf
[
0
]
=
0
;
fprintf
(
fp
,
"dst %s "
,
rt_addr_n2a
(
sa_id
->
family
,
sizeof
(
sa_id
->
daddr
),
&
sa_id
->
daddr
,
buf
,
sizeof
(
buf
)));
fprintf
(
fp
,
" reqid 0x%x"
,
reqid
);
fprintf
(
fp
,
" protocol %s "
,
strxf_proto
(
sa_id
->
proto
));
fprintf
(
fp
,
" SPI 0x%x"
,
ntohl
(
sa_id
->
spi
));
}
static
int
xfrm_ae_print
(
const
struct
sockaddr_nl
*
who
,
static
int
xfrm_ae_print
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
)
struct
nlmsghdr
*
n
,
void
*
arg
)
{
{
...
@@ -235,13 +249,8 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
...
@@ -235,13 +249,8 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
fprintf
(
fp
,
"src %s "
,
rt_addr_n2a
(
id
->
sa_id
.
family
,
fprintf
(
fp
,
"src %s "
,
rt_addr_n2a
(
id
->
sa_id
.
family
,
sizeof
(
id
->
saddr
),
&
id
->
saddr
,
sizeof
(
id
->
saddr
),
&
id
->
saddr
,
abuf
,
sizeof
(
abuf
)));
abuf
,
sizeof
(
abuf
)));
memset
(
abuf
,
'\0'
,
sizeof
(
abuf
));
fprintf
(
fp
,
"dst %s "
,
rt_addr_n2a
(
id
->
sa_id
.
family
,
xfrm_usersa_print
(
&
id
->
sa_id
,
id
->
reqid
,
fp
);
sizeof
(
id
->
sa_id
.
daddr
),
&
id
->
sa_id
.
daddr
,
abuf
,
sizeof
(
abuf
)));
fprintf
(
fp
,
" reqid 0x%x"
,
id
->
reqid
);
fprintf
(
fp
,
" protocol %s "
,
strxf_proto
(
id
->
sa_id
.
proto
));
fprintf
(
fp
,
" SPI 0x%x"
,
ntohl
(
id
->
sa_id
.
spi
));
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"
\n
"
);
fflush
(
fp
);
fflush
(
fp
);
...
@@ -249,6 +258,36 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
...
@@ -249,6 +258,36 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
return
0
;
return
0
;
}
}
static
void
xfrm_print_addr
(
FILE
*
fp
,
int
family
,
xfrm_address_t
*
a
,
size_t
s
)
{
char
buf
[
256
];
buf
[
0
]
=
0
;
fprintf
(
fp
,
"%s"
,
rt_addr_n2a
(
family
,
s
,
a
,
buf
,
sizeof
(
buf
)));
}
static
int
xfrm_mapping_print
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
)
{
FILE
*
fp
=
(
FILE
*
)
arg
;
struct
xfrm_user_mapping
*
map
=
NLMSG_DATA
(
n
);
fprintf
(
fp
,
"Mapping change "
);
xfrm_print_addr
(
fp
,
map
->
id
.
family
,
&
map
->
old_saddr
,
sizeof
(
map
->
old_saddr
));
fprintf
(
fp
,
":%d -> "
,
ntohs
(
map
->
old_sport
));
xfrm_print_addr
(
fp
,
map
->
id
.
family
,
&
map
->
new_saddr
,
sizeof
(
map
->
new_saddr
));
fprintf
(
fp
,
":%d
\n\t
"
,
ntohs
(
map
->
new_sport
));
xfrm_usersa_print
(
&
map
->
id
,
map
->
reqid
,
fp
);
fprintf
(
fp
,
"
\n
"
);
fflush
(
fp
);
return
0
;
}
static
int
xfrm_accept_msg
(
const
struct
sockaddr_nl
*
who
,
static
int
xfrm_accept_msg
(
const
struct
sockaddr_nl
*
who
,
struct
nlmsghdr
*
n
,
void
*
arg
)
struct
nlmsghdr
*
n
,
void
*
arg
)
{
{
...
@@ -285,6 +324,9 @@ static int xfrm_accept_msg(const struct sockaddr_nl *who,
...
@@ -285,6 +324,9 @@ static int xfrm_accept_msg(const struct sockaddr_nl *who,
case
XFRM_MSG_NEWAE
:
case
XFRM_MSG_NEWAE
:
xfrm_ae_print
(
who
,
n
,
arg
);
xfrm_ae_print
(
who
,
n
,
arg
);
return
0
;
return
0
;
case
XFRM_MSG_MAPPING
:
xfrm_mapping_print
(
who
,
n
,
arg
);
return
0
;
default:
default:
break
;
break
;
}
}
...
...
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