Exemplo n.º 1
0
static int xfrm_mapping_print(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);

	fprintf(fp, ":%d -> ", ntohs(map->old_sport));
	xfrm_print_addr(fp, map->id.family, &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;
}
Exemplo n.º 2
0
static int xfrm_ae_print(struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE *)arg;
	struct xfrm_aevent_id *id = NLMSG_DATA(n);

	fprintf(fp, "Async event ");
	xfrm_ae_flags_print(id->flags, arg);
	fprintf(fp, "\n\t");
	fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family,
					   sizeof(id->saddr), &id->saddr));

	xfrm_usersa_print(&id->sa_id, id->reqid, fp);

	fprintf(fp, "\n");
	fflush(fp);

	return 0;
}
Exemplo n.º 3
0
static int xfrm_ae_print(const struct sockaddr_nl *who,
			     struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE*)arg;
	struct xfrm_aevent_id *id = NLMSG_DATA(n);
	char abuf[256];

	fprintf(fp, "Async event ");
	xfrm_ae_flags_print(id->flags, arg);
	fprintf(fp,"\n\t");
	memset(abuf, '\0', sizeof(abuf));
	fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family,
					   sizeof(id->saddr), &id->saddr,
					   abuf, sizeof(abuf)));

	xfrm_usersa_print(&id->sa_id, id->reqid, fp);

	fprintf(fp, "\n");
	fflush(fp);

	return 0;
}