Ejemplo n.º 1
0
static void
aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat, u_int length)
{
	u_int i;
	const struct aodv_rrep6_draft_01 *ap = (const struct aodv_rrep6_draft_01 *)dat;

	ND_TCHECK(*ap);
	if (length < sizeof(*ap))
		goto trunc;
	ND_PRINT((ndo, " rrep %u %s%sprefix %u hops %u\n"
	   "\tdst %s dseq %lu src %s %lu ms", length,
	    ap->rrep_type & RREP_REPAIR ? "[R]" : "",
	    ap->rrep_type & RREP_ACK ? "[A] " : " ",
	    ap->rrep_ps & RREP_PREFIX_MASK,
	    ap->rrep_hops,
	    ip6addr_string(ndo, &ap->rrep_da),
	    (unsigned long)EXTRACT_32BITS(&ap->rrep_ds),
	    ip6addr_string(ndo, &ap->rrep_oa),
	    (unsigned long)EXTRACT_32BITS(&ap->rrep_life)));
	i = length - sizeof(*ap);
	if (i >= sizeof(struct aodv_ext))
		aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
	return;

trunc:
	ND_PRINT((ndo, " [|rreq"));
}
Ejemplo n.º 2
0
static void
aodv_rreq(const union aodv *ap, const u_char *dat, u_int length)
{
	u_int i;

	if (snapend < dat) {
		printf(" [|aodv]");
		return;
	}
	i = min(length, (u_int)(snapend - dat));
	if (i < sizeof(ap->rreq)) {
		printf(" [|rreq]");
		return;
	}
	i -= sizeof(ap->rreq);
	printf(" rreq %u %s%s%s%s%shops %u id 0x%08lx\n"
	    "\tdst %s seq %lu src %s seq %lu", length,
	    ap->rreq.rreq_type & RREQ_JOIN ? "[J]" : "",
	    ap->rreq.rreq_type & RREQ_REPAIR ? "[R]" : "",
	    ap->rreq.rreq_type & RREQ_GRAT ? "[G]" : "",
	    ap->rreq.rreq_type & RREQ_DEST ? "[D]" : "",
	    ap->rreq.rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
	    ap->rreq.rreq_hops,
	    (unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_id),
	    ipaddr_string(&ap->rreq.rreq_da),
	    (unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_ds),
	    ipaddr_string(&ap->rreq.rreq_oa),
	    (unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_os));
	if (i >= sizeof(struct aodv_ext))
		aodv_extension((void *)(&ap->rreq + 1), i);
}
Ejemplo n.º 3
0
static void
aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat, u_int length)
{
	u_int i;
	const struct aodv_rreq6_draft_01 *ap = (const struct aodv_rreq6_draft_01 *)dat;

	ND_TCHECK(*ap);
	if (length < sizeof(*ap))
		goto trunc;
	ND_PRINT((ndo, " rreq %u %s%s%s%s%shops %u id 0x%08lx\n"
	    "\tdst %s seq %lu src %s seq %lu", length,
	    ap->rreq_type & RREQ_JOIN ? "[J]" : "",
	    ap->rreq_type & RREQ_REPAIR ? "[R]" : "",
	    ap->rreq_type & RREQ_GRAT ? "[G]" : "",
	    ap->rreq_type & RREQ_DEST ? "[D]" : "",
	    ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
	    ap->rreq_hops,
	    (unsigned long)EXTRACT_32BITS(&ap->rreq_id),
	    ip6addr_string(ndo, &ap->rreq_da),
	    (unsigned long)EXTRACT_32BITS(&ap->rreq_ds),
	    ip6addr_string(ndo, &ap->rreq_oa),
	    (unsigned long)EXTRACT_32BITS(&ap->rreq_os)));
	i = length - sizeof(*ap);
	if (i >= sizeof(struct aodv_ext))
		aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
	return;

trunc:
	ND_PRINT((ndo, " [|rreq"));
}
Ejemplo n.º 4
0
static void
aodv_rrep(const union aodv *ap, const u_char *dat, u_int length)
{
	u_int i;

	if (snapend < dat) {
		printf(" [|aodv]");
		return;
	}
	i = min(length, (u_int)(snapend - dat));
	if (i < sizeof(ap->rrep)) {
		printf(" [|rrep]");
		return;
	}
	i -= sizeof(ap->rrep);
	printf(" rrep %u %s%sprefix %u hops %u\n"
	    "\tdst %s dseq %lu src %s %lu ms", length,
	    ap->rrep.rrep_type & RREP_REPAIR ? "[R]" : "",
	    ap->rrep.rrep_type & RREP_ACK ? "[A] " : " ",
	    ap->rrep.rrep_ps & RREP_PREFIX_MASK,
	    ap->rrep.rrep_hops,
	    ipaddr_string(&ap->rrep.rrep_da),
	    (unsigned long)EXTRACT_32BITS(&ap->rrep.rrep_ds),
	    ipaddr_string(&ap->rrep.rrep_oa),
	    (unsigned long)EXTRACT_32BITS(&ap->rrep.rrep_life));
	if (i >= sizeof(struct aodv_ext))
		aodv_extension((void *)(&ap->rrep + 1), i);
}