summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_neighbor.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-11-11 18:22:38 +0100
committerMark Stapp <mjs@voltanet.io>2019-11-11 18:22:38 +0100
commit9e030550627248c948e39d00ead09322593eefeb (patch)
tree6bd3270ec9204786bfea6a61eff1e397d5410629 /ospfd/ospf_neighbor.c
parentMerge pull request #5278 from slankdev/slankdev-bgpd-fix-prefix-sid-fetch-error (diff)
downloadfrr-9e030550627248c948e39d00ead09322593eefeb.tar.xz
frr-9e030550627248c948e39d00ead09322593eefeb.zip
ospfd,eigrpd: don't take address of packed struct member
Use a local variable to avoid trying to take the address of a packed struct member - an address from the ip header in these cases. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'ospfd/ospf_neighbor.c')
-rw-r--r--ospfd/ospf_neighbor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index a58bd93b6..a9247dd0e 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -402,12 +402,14 @@ void ospf_renegotiate_optional_capabilities(struct ospf *top)
struct ospf_neighbor *ospf_nbr_lookup(struct ospf_interface *oi, struct ip *iph,
struct ospf_header *ospfh)
{
+ struct in_addr srcaddr = iph->ip_src;
+
if (oi->type == OSPF_IFTYPE_VIRTUALLINK
|| oi->type == OSPF_IFTYPE_POINTOPOINT)
return (ospf_nbr_lookup_by_routerid(oi->nbrs,
&ospfh->router_id));
else
- return (ospf_nbr_lookup_by_addr(oi->nbrs, &iph->ip_src));
+ return (ospf_nbr_lookup_by_addr(oi->nbrs, &srcaddr));
}
static struct ospf_neighbor *ospf_nbr_add(struct ospf_interface *oi,