mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-18 01:41:24 +00:00
94 lines
2.9 KiB
Diff
94 lines
2.9 KiB
Diff
From f924ce7ec9e25fcb2fc1fe0ddd49bda0850b9758 Mon Sep 17 00:00:00 2001
|
|
From: ratheesh kannoth <rkannoth@codeaurora.org>
|
|
Date: Wed, 8 Jul 2015 11:13:57 +0530
|
|
Subject: [PATCH] net: l2tp: set skb->iif for pkt thru l2tp interface
|
|
|
|
Change-Id: I20eed270083ba9ac167d9672928483396e488133
|
|
Signed-off-by: ratheesh kannoth <rkannoth@codeaurora.org>
|
|
---
|
|
drivers/net/ppp/ppp_generic.c | 15 +++++++++++++++
|
|
include/linux/ppp_channel.h | 4 ++++
|
|
net/l2tp/l2tp_ppp.c | 4 ++++
|
|
3 files changed, 23 insertions(+)
|
|
|
|
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
|
|
index 3df2a412445b..c6e3466933cd 100644
|
|
--- a/drivers/net/ppp/ppp_generic.c
|
|
+++ b/drivers/net/ppp/ppp_generic.c
|
|
@@ -2971,6 +2971,20 @@ char *ppp_dev_name(struct ppp_channel *chan)
|
|
return name;
|
|
}
|
|
|
|
+/* Return the PPP net device index */
|
|
+int ppp_dev_index(struct ppp_channel *chan)
|
|
+{
|
|
+ struct channel *pch = chan->ppp;
|
|
+ int ifindex = 0;
|
|
+
|
|
+ if (pch) {
|
|
+ read_lock_bh(&pch->upl);
|
|
+ if (pch->ppp && pch->ppp->dev)
|
|
+ ifindex = pch->ppp->dev->ifindex;
|
|
+ read_unlock_bh(&pch->upl);
|
|
+ }
|
|
+ return ifindex;
|
|
+}
|
|
|
|
/*
|
|
* Disconnect a channel from the generic layer.
|
|
@@ -3839,6 +3853,7 @@ EXPORT_SYMBOL(ppp_unregister_channel);
|
|
EXPORT_SYMBOL(ppp_channel_index);
|
|
EXPORT_SYMBOL(ppp_unit_number);
|
|
EXPORT_SYMBOL(ppp_dev_name);
|
|
+EXPORT_SYMBOL(ppp_dev_index);
|
|
EXPORT_SYMBOL(ppp_input);
|
|
EXPORT_SYMBOL(ppp_input_error);
|
|
EXPORT_SYMBOL(ppp_output_wakeup);
|
|
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
|
|
index 1347b8fcd1c7..956acbedffa9 100644
|
|
--- a/include/linux/ppp_channel.h
|
|
+++ b/include/linux/ppp_channel.h
|
|
@@ -19,6 +19,7 @@
|
|
#include <linux/skbuff.h>
|
|
#include <linux/poll.h>
|
|
#include <net/net_namespace.h>
|
|
+#include <linux/ppp_defs.h>
|
|
#include <linux/notifier.h>
|
|
|
|
/* PPP channel connection event types */
|
|
@@ -118,6 +119,9 @@ extern void ppp_unregister_channel(struct ppp_channel *);
|
|
/* Get the channel number for a channel */
|
|
extern int ppp_channel_index(struct ppp_channel *);
|
|
|
|
+/* Get the device index associated with a channel, or 0, if none */
|
|
+extern int ppp_dev_index(struct ppp_channel *);
|
|
+
|
|
/* Get the unit number associated with a channel, or -1 if none */
|
|
extern int ppp_unit_number(struct ppp_channel *);
|
|
|
|
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
|
|
index 9e07102787ff..e1ad649eb96d 100644
|
|
--- a/net/l2tp/l2tp_ppp.c
|
|
+++ b/net/l2tp/l2tp_ppp.c
|
|
@@ -243,6 +243,7 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
|
|
struct pppox_sock *po;
|
|
|
|
po = pppox_sk(sk);
|
|
+ skb->skb_iif = ppp_dev_index(&po->chan);
|
|
ppp_input(&po->chan, skb);
|
|
} else {
|
|
if (sock_queue_rcv_skb(sk, skb) < 0) {
|
|
@@ -402,6 +403,9 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
|
|
__skb_push(skb, 2);
|
|
skb->data[0] = PPP_ALLSTATIONS;
|
|
skb->data[1] = PPP_UI;
|
|
+ /* set incoming interface as the ppp interface */
|
|
+ if (skb->skb_iif)
|
|
+ skb->skb_iif = ppp_dev_index(chan);
|
|
|
|
local_bh_disable();
|
|
l2tp_xmit_skb(session, skb);
|
|
--
|
|
2.34.1
|
|
|