Skip to content

Commit

Permalink
Fixed issue with JunOS BMP feed of an Alcatel peer with an empty capa…
Browse files Browse the repository at this point in the history
…bilities

list in received open message for PEER UP.
  • Loading branch information
TimEvens committed Nov 17, 2015
1 parent f1f9d87 commit aaa1b71
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Server/src/bgp/OpenMsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ size_t OpenMsg::parseOpenMsg(u_char *data, size_t size,
open_hdr.ver, open_hdr.hold, open_hdr.asn, bgp_id.c_str(), open_hdr.param_len);

/*
* Make sure the buffer contains the rest of the open message
* Make sure the buffer contains the rest of the open message, but allow a zero length in case the
* data is missing on purpose (router implementation)
*/
if (open_hdr.param_len > (size - read_size)) {
if (open_hdr.param_len == 0) {
LOG_WARN("%s: Capabilities in open message is ZERO/empty, this is abnormal and likely a router implementation issue.", peer_addr.c_str());
return read_size;
}

else if (open_hdr.param_len > (size - read_size)) {
LOG_WARN("%s: Could not read capabilities in open message due to buffer not containing the full param length", peer_addr.c_str());
return 0;
}
Expand Down
7 changes: 6 additions & 1 deletion Server/src/openbmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ bool ReadCmdArgs(int argc, char **argv, Cfg_Options &cfg) {
exit(0);
}

else if (argc > 1 and !strcmp(argv[1], "-h")) {
Usage(argv[0]);
exit(0);
}

else if (argc < 3) {
cout << "ERROR: Missing required args." << endl;
return true;
Expand All @@ -208,7 +213,7 @@ bool ReadCmdArgs(int argc, char **argv, Cfg_Options &cfg) {

if (!strcmp(argv[i], "-h")) { // Help message
Usage(argv[0]);
return true;
exit(0);

} else if (!strcmp(argv[i], "-p")) {
// We expect the next arg to be a port
Expand Down

0 comments on commit aaa1b71

Please sign in to comment.