XFRM: sub policy support.
Subsystems (2)
PATCH 4/7 XFRM: sub policy support.
Signed-off-by Masahide NAKAMURA <[email protected]>
--- ip/ipxfrm.c | 27 ++++++++++ ip/xfrm.h | 4 + ip/xfrm_policy.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 164 insertions(+), 17 deletions(-)
ip/ipxfrm.c +27 -0
@@ -709,6 +709,7 @@ void xfrm_policy_info_print(struct xfrm_ const char *title) {char buf[STRBUF_SIZE ]; +__u8 ptype =XFRM_POLICY_TYPE_MAIN ;memset (buf,'\0' ,sizeof (buf));
@@ -752,6 +753,32 @@ void xfrm_policy_info_print(struct xfrm_if (show_stats)fprintf (fp,"index %u " , xpinfo->index);fprintf (fp,"priority %u " , xpinfo->priority); + +fprintf (fp,"ptype " ); + +if (tb[XFRMA_POLICY_TYPE ]) { +struct xfrm_userpolicy_type *upt; + +if (RTA_PAYLOAD (tb[XFRMA_POLICY_TYPE ]) <sizeof (*upt)) +fprintf (fp,"(ERROR truncated)" ); + + upt = (struct xfrm_userpolicy_type *)RTA_DATA (tb[XFRMA_POLICY_TYPE ]); + ptype = upt->type; + } + +switch (ptype) { +case XFRM_POLICY_TYPE_MAIN : +fprintf (fp,"main" ); +break ; +case XFRM_POLICY_TYPE_SUB : +fprintf (fp,"sub" ); +break ; +default : +fprintf (fp,"%u" , ptype); +break ; + } +fprintf (fp," " ); +if (show_stats >0 ) {fprintf (fp,"share %s " ,strxf_share (xpinfo->share));fprintf (fp,"flag 0x%s" ,strxf_mask8 (xpinfo->flags));
ip/xfrm.h +4 -0
@@ -92,6 +92,10 @@ struct xfrm_filter {__u32 index_mask;__u8 action_mask;__u32 priority_mask; + +__u8 ptype; +__u8 ptype_mask; + };#define XFRM_FILTER_MASK_FULL (~0)
ip/xfrm_policy.c +133 -17
283 lines not on this page · raw message
Signature · 1 line
1.4.2