From ac014ddac69778ceed12e4b2c82774ead13b4036 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Mon, 23 Feb 2004 16:46:25 +0000 Subject: While searching a different bug found those two gems. The ntohs is obvious the plen adjusting is needed to jump over the value that we ignore. yaya henning@ --- usr.sbin/bgpd/rde_attr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c index 98279164539..f07f32d01e6 100644 --- a/usr.sbin/bgpd/rde_attr.c +++ b/usr.sbin/bgpd/rde_attr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_attr.c,v 1.12 2004/02/19 23:07:00 claudio Exp $ */ +/* $OpenBSD: rde_attr.c,v 1.13 2004/02/23 16:46:24 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker @@ -78,6 +78,7 @@ attr_parse(u_char *p, u_int16_t len, struct attr_flags *a, int ebgp) if (len - plen < 2) return (-1); UPD_READ(&attr_len, p, plen, 2); + attr_len = ntohs(attr_len); } else { UPD_READ(&tmp8, p, plen, 1); attr_len = tmp8; @@ -135,7 +136,8 @@ attr_parse(u_char *p, u_int16_t len, struct attr_flags *a, int ebgp) return (-1); if (ebgp) { /* ignore local-pref attr for non ibgp peers */ - a->lpref = 0; /* set a default value */ + a->lpref = 0; /* set a default value ... */ + plen += 4; /* and ignore the real value */ break; } WFLAG(a->wflags, F_ATTR_LOCALPREF); -- cgit v1.2.3