diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-03-18 23:15:20 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-03-18 23:15:20 +0300 |
commit | aa4ed7b9c637b70dc42a180b918fb4adb3e32d74 (patch) | |
tree | 4e8454f4c751db0619faa2e6333d6b90aa841158 /accel-pppd/ctrl/ipoe/ipoe_netlink.c | |
parent | 53eaf7555a5f3f0b60854acf7933484c98ada917 (diff) | |
download | accel-ppp-aa4ed7b9c637b70dc42a180b918fb4adb3e32d74.tar.gz accel-ppp-aa4ed7b9c637b70dc42a180b918fb4adb3e32d74.zip |
ipoe: implemented starting UP session by arp request
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe_netlink.c')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe_netlink.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe_netlink.c b/accel-pppd/ctrl/ipoe/ipoe_netlink.c index 9372a94..8ed4d91 100644 --- a/accel-pppd/ctrl/ipoe/ipoe_netlink.c +++ b/accel-pppd/ctrl/ipoe/ipoe_netlink.c @@ -467,6 +467,7 @@ static void ipoe_up_handler(const struct sockaddr_nl *addr, struct nlmsghdr *h) int ifindex; struct iphdr *iph; struct ethhdr *eth; + struct _arphdr *arph; len -= NLMSG_LENGTH(GENL_HDRLEN); @@ -484,14 +485,23 @@ static void ipoe_up_handler(const struct sockaddr_nl *addr, struct nlmsghdr *h) parse_rtattr_nested(tb2, IPOE_ATTR_MAX, tb[i]); - if (!tb2[IPOE_ATTR_ETH_HDR] || !tb2[IPOE_ATTR_IP_HDR] || !tb2[IPOE_ATTR_IFINDEX]) + if (!tb2[IPOE_ATTR_IFINDEX]) continue; ifindex = *(uint32_t *)(RTA_DATA(tb2[IPOE_ATTR_IFINDEX])); - iph = (struct iphdr *)(RTA_DATA(tb2[IPOE_ATTR_IP_HDR])); - eth = (struct ethhdr *)(RTA_DATA(tb2[IPOE_ATTR_ETH_HDR])); - ipoe_recv_up(ifindex, eth, iph); + if (tb2[IPOE_ATTR_ARP_HDR]) { + arph = (struct _arphdr *)(RTA_DATA(tb2[IPOE_ATTR_ARP_HDR])); + iph = NULL; + eth = NULL; + } else if (tb2[IPOE_ATTR_ETH_HDR] && !tb2[IPOE_ATTR_IP_HDR]) { + iph = (struct iphdr *)(RTA_DATA(tb2[IPOE_ATTR_IP_HDR])); + eth = (struct ethhdr *)(RTA_DATA(tb2[IPOE_ATTR_ETH_HDR])); + arph = NULL; + } else + continue; + + ipoe_recv_up(ifindex, eth, iph, arph); } } |