Skip to contentSkip to conversation

pppoe: Add PPP interface name to /proc/net/pppoe output

PATCH New Pavan Kumar 1 participant 1 message Jul 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pppoe: Add PPP interface name to /proc/net/pppoe output

The pppoe_seq_show() function displays session ID, remote MAC address, and the underlying Ethernet device, but omits the associated PPP interface name. This makes it difficult to correlate PPPoE sessions with their respective pppX interfaces.

Retrieve the interface name using ppp_dev_name() and append it as a new "PPP-Device" column in the /proc/net/pppoe output.

---
 drivers/net/ppp/pppoe.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ppp/pppoe.c +5 -3
index 6874a1a8edaf..cb31f5db43e8 100644
@@ -963,17 +963,19 @@ static int pppoe_seq_show(struct seq_file *seq, void *v)
 {
 	struct pppox_sock *po;
 	char *dev_name;
+	char *ppp_name;
 
 	if (v == SEQ_START_TOKEN) {
-		seq_puts(seq, "Id       Address              Device\n");
+		seq_puts(seq, "Id       Address              Device   PPP-Device\n");
 		goto out;
 	}
 
 	po = v;
 	dev_name = po->pppoe_pa.dev;
+	ppp_name = ppp_dev_name(&po->chan);
 
-	seq_printf(seq, "%08X %pM %8s\n",
-		po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name);
+	seq_printf(seq, "%08X %pM %8s %10s\n",
+		   po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name, ppp_name ? ppp_name : "");
 out:
 	return 0;
 }