parent
2534613eeb
commit
bcf3281961
88
ip/ipxfrm.c
88
ip/ipxfrm.c
|
|
@ -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)
|
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++) {
|
if (tb[XFRMA_ALG_CRYPT]) {
|
||||||
__u16 type = tb[i]->rta_type;
|
struct rtattr *rta = tb[XFRMA_ALG_CRYPT];
|
||||||
int len = RTA_PAYLOAD(tb[i]);
|
xfrm_algo_print((struct xfrm_algo *) RTA_DATA(rta),
|
||||||
void *data = RTA_DATA(tb[i]);
|
XFRMA_ALG_CRYPT, RTA_PAYLOAD(rta), fp, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
if (tb[XFRMA_ALG_COMP]) {
|
||||||
case XFRMA_ALG_CRYPT:
|
struct rtattr *rta = tb[XFRMA_ALG_COMP];
|
||||||
case XFRMA_ALG_AUTH:
|
xfrm_algo_print((struct xfrm_algo *) RTA_DATA(rta),
|
||||||
case XFRMA_ALG_COMP:
|
XFRMA_ALG_COMP, RTA_PAYLOAD(rta), fp, prefix);
|
||||||
xfrm_algo_print((struct xfrm_algo *)data, type, len,
|
}
|
||||||
fp, prefix);
|
|
||||||
break;
|
|
||||||
case XFRMA_ENCAP:
|
|
||||||
{
|
|
||||||
struct xfrm_encap_tmpl *e;
|
|
||||||
char abuf[256];
|
|
||||||
|
|
||||||
if (prefix)
|
if (tb[XFRMA_ENCAP]) {
|
||||||
fprintf(fp, prefix);
|
struct xfrm_encap_tmpl *e;
|
||||||
fprintf(fp, "encap ");
|
char abuf[256];
|
||||||
|
|
||||||
if (len < sizeof(*e)) {
|
if (prefix)
|
||||||
fprintf(fp, "(ERROR truncated)");
|
fprintf(fp, prefix);
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "encap ");
|
||||||
break;
|
|
||||||
}
|
|
||||||
e = (struct xfrm_encap_tmpl *)data;
|
|
||||||
|
|
||||||
fprintf(fp, "type %u ", e->encap_type);
|
if (RTA_PAYLOAD(tb[XFRMA_ENCAP]) < sizeof(*e)) {
|
||||||
fprintf(fp, "sport %u ", ntohs(e->encap_sport));
|
fprintf(fp, "(ERROR truncated)");
|
||||||
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_);
|
fprintf(fp, "%s", _SL_);
|
||||||
break;
|
return;
|
||||||
}
|
|
||||||
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);
|
|
||||||
fprintf(fp, "%s", _SL_);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue