summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2021-03-20 17:12:15 +0500
committerVladislav Grishenko <themiron@mail.ru>2021-03-20 17:12:15 +0500
commit21830c460aaccef7fee6fbfb1795bb34b53bb01d (patch)
tree9161df4d069e0e1be89b4dc40c55a51ccd9267ec
parent79270852a48e2aecb15fddd70373f7012cce98b6 (diff)
downloadaccel-ppp-21830c460aaccef7fee6fbfb1795bb34b53bb01d.tar.gz
accel-ppp-21830c460aaccef7fee6fbfb1795bb34b53bb01d.zip
ipoe: fix NULL check
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 0649e9c..70c5710 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -2045,8 +2045,17 @@ static void ipoe_recv_dhcpv4_relay(struct dhcpv4_packet *pack)
static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struct ethhdr *eth, struct iphdr *iph, struct _arphdr *arph)
{
struct ipoe_session *ses;
- uint8_t *hwaddr = arph ? arph->ar_sha : eth->h_source;
- in_addr_t saddr = arph ? arph->ar_spa : iph->saddr;
+ uint8_t *hwaddr;
+ in_addr_t saddr;
+
+ if (arph) {
+ hwaddr = arph->ar_sha;
+ saddr = arph->ar_spa;
+ } else if (eth && iph) {
+ hwaddr = eth->h_source;
+ saddr = iph->saddr;
+ } else
+ return NULL;
if (ap_shutdown)
return NULL;