Skip to content

Commit

Permalink
Fix ospf length endianness conversion, suggested by @yangsong21
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 21, 2023
1 parent f685b44 commit 2c86898
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Homework/ospf/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ int main(int argc, char *argv[]) {
// neighbor state transitions to ExStart."
if (neighbor_found && neighbor->state == NeighborInit) {
int num_neighbors =
(ntohl(ospf_hdr->length) - sizeof(struct ospf_hello)) /
(ntohs(ospf_hdr->length) - sizeof(struct ospf_hello)) /
sizeof(uint32_t);
// TODO(8 行)
// 修改这个检查,完成 Hello 的协商判断:当发现对方发送的 OSPF Hello
Expand Down

0 comments on commit 2c86898

Please sign in to comment.