Changed BDT create to correct host/network order of bytes.
This commit is contained in:
@@ -541,13 +541,17 @@ static bool bvlc_create_bdt(
|
|||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
uint16_t pdu_offset = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
|
for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
|
||||||
if (npdu_length >= 10) {
|
if (npdu_length >= 10) {
|
||||||
BBMD_Table[i].valid = true;
|
BBMD_Table[i].valid = true;
|
||||||
BBMD_Table[i].dest_address.s_addr = ntohl(&npdu[0]);
|
BBMD_Table[i].dest_address.s_addr = ntohl(*(long *)&npdu[pdu_offset]);
|
||||||
BBMD_Table[i].dest_port = ntohs(&npdu[4]);
|
pdu_offset += 4;
|
||||||
BBMD_Table[i].broadcast_mask.s_addr = ntohl(&npdu[6]);
|
BBMD_Table[i].dest_port = ntohs(*(short *)&npdu[pdu_offset]);
|
||||||
|
pdu_offset += 2;
|
||||||
|
BBMD_Table[i].broadcast_mask.s_addr = ntohl(*(long *)&npdu[pdu_offset]);
|
||||||
|
pdu_offset += 4;
|
||||||
npdu_length -= 10;
|
npdu_length -= 10;
|
||||||
} else {
|
} else {
|
||||||
BBMD_Table[i].valid = false;
|
BBMD_Table[i].valid = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user