mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 10:32:00 +00:00
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>
This commit is contained in:
parent
306c4dab55
commit
9e03055062
@ -485,7 +485,7 @@ int eigrp_read(struct thread *thread)
|
|||||||
struct eigrp_header *eigrph;
|
struct eigrp_header *eigrph;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct eigrp_neighbor *nbr;
|
struct eigrp_neighbor *nbr;
|
||||||
|
struct in_addr srcaddr;
|
||||||
uint16_t opcode = 0;
|
uint16_t opcode = 0;
|
||||||
uint16_t length = 0;
|
uint16_t length = 0;
|
||||||
|
|
||||||
@ -511,6 +511,7 @@ int eigrp_read(struct thread *thread)
|
|||||||
if (iph->ip_v == 4)
|
if (iph->ip_v == 4)
|
||||||
length = (iph->ip_len) - 20U;
|
length = (iph->ip_len) - 20U;
|
||||||
|
|
||||||
|
srcaddr = iph->ip_src;
|
||||||
|
|
||||||
/* IP Header dump. */
|
/* IP Header dump. */
|
||||||
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)
|
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)
|
||||||
@ -526,7 +527,7 @@ int eigrp_read(struct thread *thread)
|
|||||||
and also platforms (such as Solaris 8) that claim to support
|
and also platforms (such as Solaris 8) that claim to support
|
||||||
ifindex
|
ifindex
|
||||||
retrieval but do not. */
|
retrieval but do not. */
|
||||||
c = if_lookup_address((void *)&iph->ip_src, AF_INET,
|
c = if_lookup_address((void *)&srcaddr, AF_INET,
|
||||||
eigrp->vrf_id);
|
eigrp->vrf_id);
|
||||||
|
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
@ -549,11 +550,11 @@ int eigrp_read(struct thread *thread)
|
|||||||
|
|
||||||
/* Self-originated packet should be discarded silently. */
|
/* Self-originated packet should be discarded silently. */
|
||||||
if (eigrp_if_lookup_by_local_addr(eigrp, NULL, iph->ip_src)
|
if (eigrp_if_lookup_by_local_addr(eigrp, NULL, iph->ip_src)
|
||||||
|| (IPV4_ADDR_SAME(&iph->ip_src, &ei->address.u.prefix4))) {
|
|| (IPV4_ADDR_SAME(&srcaddr, &ei->address.u.prefix4))) {
|
||||||
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
|
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"eigrp_read[%s]: Dropping self-originated packet",
|
"eigrp_read[%s]: Dropping self-originated packet",
|
||||||
inet_ntoa(iph->ip_src));
|
inet_ntoa(srcaddr));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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_neighbor *ospf_nbr_lookup(struct ospf_interface *oi, struct ip *iph,
|
||||||
struct ospf_header *ospfh)
|
struct ospf_header *ospfh)
|
||||||
{
|
{
|
||||||
|
struct in_addr srcaddr = iph->ip_src;
|
||||||
|
|
||||||
if (oi->type == OSPF_IFTYPE_VIRTUALLINK
|
if (oi->type == OSPF_IFTYPE_VIRTUALLINK
|
||||||
|| oi->type == OSPF_IFTYPE_POINTOPOINT)
|
|| oi->type == OSPF_IFTYPE_POINTOPOINT)
|
||||||
return (ospf_nbr_lookup_by_routerid(oi->nbrs,
|
return (ospf_nbr_lookup_by_routerid(oi->nbrs,
|
||||||
&ospfh->router_id));
|
&ospfh->router_id));
|
||||||
else
|
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,
|
static struct ospf_neighbor *ospf_nbr_add(struct ospf_interface *oi,
|
||||||
|
Loading…
Reference in New Issue
Block a user