summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2013-04-19 15:04:23 +0400
committerKozlov Dmitry <xeb@mail.ru>2013-04-19 15:04:23 +0400
commit2a2012bec51d58b05f508f0c79819d48392824ea (patch)
treeed554eb6e6cc8d4020addaad05cb0aa245479300
parent65159a74bd8e234f24bff44c267c251a080e1f14 (diff)
downloadaccel-ppp-2a2012bec51d58b05f508f0c79819d48392824ea.tar.gz
accel-ppp-2a2012bec51d58b05f508f0c79819d48392824ea.zip
ipoe: fixed start=dhcpv4,shared=1 mode
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c15
-rw-r--r--drivers/ipoe/ipoe.c49
2 files changed, 33 insertions, 31 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 09bd887..46c5372 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -582,12 +582,6 @@ static void __ipoe_session_activate(struct ipoe_session *ses)
if (ses->terminating)
return;
- if (!ses->ses.ipv4) {
- ses->ses.ipv4 = &ses->ipv4;
- ses->ipv4.owner = NULL;
- ses->ipv4.peer_addr = ses->yiaddr;
- }
-
if (ses->ifindex != -1) {
addr = 0;
if (!ses->ses.ipv4)
@@ -601,7 +595,14 @@ static void __ipoe_session_activate(struct ipoe_session *ses)
}
}
- if (ses->serv->opt_ifcfg || (ses->serv->opt_mode == MODE_L2))
+ if (!ses->ses.ipv4) {
+ ses->ses.ipv4 = &ses->ipv4;
+ ses->ipv4.owner = NULL;
+ ses->ipv4.peer_addr = ses->yiaddr;
+ ses->ipv4.addr = ses->siaddr;
+ }
+
+ if (ses->ifindex == -1 && (ses->serv->opt_ifcfg || (ses->serv->opt_mode == MODE_L2)))
ipoe_ifcfg_add(ses);
if (ses->l4_redirect)
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c
index bf86e8c..3ab44e0 100644
--- a/drivers/ipoe/ipoe.c
+++ b/drivers/ipoe/ipoe.c
@@ -415,35 +415,35 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev)
if (ipoe_do_nat(skb, ses->peer_addr, 1))
goto drop;
+ }
- if (!ses->link_dev) {
- iph = ip_hdr(skb);
-
- ip_send_check(iph);
-
- if (ipoe_route4(skb))
- goto drop;
+ if (!ses->link_dev) {
+ iph = ip_hdr(skb);
+
+ ip_send_check(iph);
+
+ if (ipoe_route4(skb))
+ goto drop;
- pskb_pull(skb, ETH_HLEN);
- skb_reset_network_header(skb);
+ pskb_pull(skb, ETH_HLEN);
+ skb_reset_network_header(skb);
- cb_ptr = skb->cb + sizeof(skb->cb) - 2;
- *(__u16 *)cb_ptr = IPOE_MAGIC;
+ cb_ptr = skb->cb + sizeof(skb->cb) - 2;
+ *(__u16 *)cb_ptr = IPOE_MAGIC;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
- skb->skb_iif = dev->ifindex;
+ skb->skb_iif = dev->ifindex;
#else
- skb->iif = dev->ifindex;
+ skb->iif = dev->ifindex;
#endif
- ip_local_out(skb);
-
- return NETDEV_TX_OK;
- } else {
- eth = (struct ethhdr *)skb->data;
+ ip_local_out(skb);
- memcpy(eth->h_dest, ses->hwaddr, ETH_ALEN);
- memcpy(eth->h_source, ses->link_dev->dev_addr, ETH_ALEN);
- }
+ return NETDEV_TX_OK;
+ } else {
+ eth = (struct ethhdr *)skb->data;
+
+ memcpy(eth->h_dest, ses->hwaddr, ETH_ALEN);
+ memcpy(eth->h_source, ses->link_dev->dev_addr, ETH_ALEN);
}
} /*else if (skb->protocol == htons(ETH_P_ARP)) {
if (!pskb_may_pull(skb, arp_hdr_len(dev) + noff))
@@ -706,16 +706,17 @@ static unsigned int ipt_in_hook(unsigned int hook, struct sk_buff *skb, const st
if (!iph->saddr)
return NF_ACCEPT;
- if (!ipoe_check_network(iph->saddr))
- return NF_ACCEPT;
-
//pr_info("ipoe: recv %08x %08x\n", iph->saddr, iph->daddr);
ses = ipoe_lookup(iph->saddr);
if (!ses) {
+ if (!ipoe_check_network(iph->saddr))
+ return NF_ACCEPT;
+
if (!ipoe_check_interface(in->ifindex))
return NF_ACCEPT;
+
ipoe_queue_u(skb, iph->saddr);
return NF_DROP;
}