bgpd: trivial format / warning fixes

* bgp_aspath.c: (assegments_parse) just bail early if length doesn't match
  and fix the formatting.
* bgp_network.c: add include needed for set_nonblocking
* bgp_packet.c: formatting
This commit is contained in:
Paul Jakma 2011-04-11 16:31:43 +01:00
parent 072990e22e
commit fdbc8e77c8
3 changed files with 30 additions and 27 deletions

View File

@ -698,8 +698,12 @@ assegments_parse (struct stream *s, size_t length, int use32bit, int as4_path)
size_t seg_size;
/* softly softly, get the header first on its own */
if (length >= AS_HEADER_SIZE)
if (length < AS_HEADER_SIZE)
{
assegment_free_all (head);
return NULL;
}
segh.type = stream_getc (s);
segh.length = stream_getc (s);
@ -725,10 +729,7 @@ assegments_parse (struct stream *s, size_t length, int use32bit, int as4_path)
default: /* reject unknown or invalid AS_PATH segment types */
seg_size = 0 ;
} ;
}
else
seg_size = 0 ;
/* Stop now if segment is not valid (discarding anything collected to date)
*

View File

@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "command.h"
#include "privs.h"
#include "linklist.h"
#include "network.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_fsm.h"

View File

@ -2021,7 +2021,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
break;
}
ok = ((p_end - p_pnt) >= sizeof(u_int32_t)) ;
if (ok)
if (!ok)
{
memcpy (&seq, p_pnt, sizeof (u_int32_t));
p_pnt += sizeof (u_int32_t);
@ -2072,7 +2072,8 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
if (!ok || (ret != CMD_SUCCESS))
{
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("%s Received misformatted prefixlist ORF. Remove All pfxlist", peer->host);
zlog_debug ("%s Received misformatted prefixlist ORF."
" Remove All pfxlist", peer->host);
prefix_bgp_orf_remove_all (name);
break;
}