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
bcf32819
Commit
bcf32819
authored
Jan 18, 2005
by
12!tgraf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use tb[type] access to TLVs
(Logical change 1.129)
parent
2534613e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
46 deletions
+42
-46
ip/ipxfrm.c
ip/ipxfrm.c
+42
-46
No files found.
ip/ipxfrm.c
View file @
bcf32819
...
...
@@ -565,61 +565,57 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len,
}
}
void
xfrm_xfrma_print
(
struct
rtattr
*
tb
[],
int
ntb
,
__u16
family
,
void
xfrm_xfrma_print
(
struct
rtattr
*
tb
[],
__u16
family
,
FILE
*
fp
,
const
char
*
prefix
)
{
int
i
;
if
(
tb
[
XFRMA_ALG_AUTH
])
{
struct
rtattr
*
rta
=
tb
[
XFRMA_ALG_AUTH
];
xfrm_algo_print
((
struct
xfrm_algo
*
)
RTA_DATA
(
rta
),
XFRMA_ALG_AUTH
,
RTA_PAYLOAD
(
rta
),
fp
,
prefix
);
}
for
(
i
=
0
;
i
<
ntb
;
i
++
)
{
__u16
type
=
tb
[
i
]
->
rta_type
;
int
len
=
RTA_PAYLOAD
(
tb
[
i
]);
void
*
data
=
RTA_DATA
(
tb
[
i
]);
switch
(
type
)
{
case
XFRMA_ALG_CRYPT
:
case
XFRMA_ALG_AUTH
:
case
XFRMA_ALG_COMP
:
xfrm_algo_print
((
struct
xfrm_algo
*
)
data
,
type
,
len
,
fp
,
prefix
);
break
;
case
XFRMA_ENCAP
:
{
struct
xfrm_encap_tmpl
*
e
;
char
abuf
[
256
];
if
(
tb
[
XFRMA_ALG_CRYPT
])
{
struct
rtattr
*
rta
=
tb
[
XFRMA_ALG_CRYPT
];
xfrm_algo_print
((
struct
xfrm_algo
*
)
RTA_DATA
(
rta
),
XFRMA_ALG_CRYPT
,
RTA_PAYLOAD
(
rta
),
fp
,
prefix
);
}
if
(
prefix
)
fprintf
(
fp
,
prefix
);
fprintf
(
fp
,
"encap "
);
if
(
tb
[
XFRMA_ALG_COMP
])
{
struct
rtattr
*
rta
=
tb
[
XFRMA_ALG_COMP
];
xfrm_algo_print
((
struct
xfrm_algo
*
)
RTA_DATA
(
rta
),
XFRMA_ALG_COMP
,
RTA_PAYLOAD
(
rta
),
fp
,
prefix
);
}
if
(
len
<
sizeof
(
*
e
))
{
fprintf
(
fp
,
"(ERROR truncated)"
);
fprintf
(
fp
,
"%s"
,
_SL_
);
break
;
}
e
=
(
struct
xfrm_encap_tmpl
*
)
data
;
if
(
tb
[
XFRMA_ENCAP
])
{
struct
xfrm_encap_tmpl
*
e
;
char
abuf
[
256
];
fprintf
(
fp
,
"type %u "
,
e
->
encap_type
);
fprintf
(
fp
,
"sport %u "
,
ntohs
(
e
->
encap_sport
)
);
fprintf
(
fp
,
"dport %u "
,
ntohs
(
e
->
encap_dport
)
);
if
(
prefix
)
fprintf
(
fp
,
prefix
);
fprintf
(
fp
,
"encap "
);
memset
(
abuf
,
'\0'
,
sizeof
(
abuf
));
fprintf
(
fp
,
"addr %s"
,
rt_addr_n2a
(
family
,
sizeof
(
e
->
encap_oa
),
&
e
->
encap_oa
,
abuf
,
sizeof
(
abuf
)));
fprintf
(
fp
,
"%s"
,
_SL_
);
break
;
}
case
XFRMA_TMPL
:
xfrm_tmpl_print
((
struct
xfrm_user_tmpl
*
)
data
,
len
,
family
,
fp
,
prefix
);
break
;
default:
if
(
prefix
)
fprintf
(
fp
,
prefix
);
fprintf
(
fp
,
"%u (unknown rta_type)"
,
type
);
if
(
RTA_PAYLOAD
(
tb
[
XFRMA_ENCAP
])
<
sizeof
(
*
e
))
{
fprintf
(
fp
,
"(ERROR truncated)"
);
fprintf
(
fp
,
"%s"
,
_SL_
);
break
;
return
;
}
e
=
(
struct
xfrm_encap_tmpl
*
)
RTA_DATA
(
tb
[
XFRMA_ENCAP
]);
fprintf
(
fp
,
"type %u "
,
e
->
encap_type
);
fprintf
(
fp
,
"sport %u "
,
ntohs
(
e
->
encap_sport
));
fprintf
(
fp
,
"dport %u "
,
ntohs
(
e
->
encap_dport
));
memset
(
abuf
,
'\0'
,
sizeof
(
abuf
));
fprintf
(
fp
,
"addr %s"
,
rt_addr_n2a
(
family
,
sizeof
(
e
->
encap_oa
),
&
e
->
encap_oa
,
abuf
,
sizeof
(
abuf
)));
fprintf
(
fp
,
"%s"
,
_SL_
);
}
if
(
tb
[
XFRMA_TMPL
])
{
struct
rtattr
*
rta
=
tb
[
XFRMA_TMPL
];
xfrm_tmpl_print
((
struct
xfrm_user_tmpl
*
)
RTA_DATA
(
rta
),
RTA_PAYLOAD
(
rta
),
family
,
fp
,
prefix
);
}
}
...
...
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