summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2011-06-09 13:52:54 -0700
committerSam Roberts <vieuxtech@gmail.com>2011-06-09 13:52:54 -0700
commit2018d42aade95aa321b04902cc2b8db098753425 (patch)
tree3c7dff70165c025132ee6175906acace67f8d7ab
parent8b9e21ed096d67e8ce974e126f9c886c14edaa72 (diff)
downloadlibnet-2018d42aade95aa321b04902cc2b8db098753425.tar.gz
Length n should include the value_hdr.
-rw-r--r--libnet/src/libnet_build_cdp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libnet/src/libnet_build_cdp.c b/libnet/src/libnet_build_cdp.c
index 5681d5e..249b246 100644
--- a/libnet/src/libnet_build_cdp.c
+++ b/libnet/src/libnet_build_cdp.c
@@ -53,8 +53,8 @@ libnet_t *l, libnet_ptag_t ptag)
return (-1);
}
- n = LIBNET_CDP_H + len + payload_s;
- h = LIBNET_CDP_H + len + payload_s;
+ n = LIBNET_CDP_H + LIBNET_CDP_H + len + payload_s;
+ h = LIBNET_CDP_H + LIBNET_CDP_H + len + payload_s;
/*
* Find the existing protocol block if a ptag is specified, or create
@@ -135,9 +135,9 @@ libnet_build_cdp_value(uint16_t type, uint16_t len, uint8_t *value, libnet_t *l,
return (-1);
}
- memset(&cdp_value_hdr, 0, sizeof(cdp_value_hdr));
- cdp_value_hdr.cdp_type = htons(type);
- cdp_value_hdr.cdp_len = htons(len + 4); /* 4 bytes for len and type */
+ memset(&cdp_value_hdr, 0, sizeof(cdp_value_hdr));
+ cdp_value_hdr.cdp_type = htons(type);
+ cdp_value_hdr.cdp_len = htons(len + LIBNET_CDP_VALUE_H); /* 4 bytes for len and type */
switch (type)
{