l2tp_ppp.c (5d1365940a68dd57b031b6e3c07d7d451cd69daf) l2tp_ppp.c (0e0c3fee3a59a387aeecc4fca6f3a2e9615a5443)
1/*****************************************************************************
2 * Linux PPP over L2TP (PPPoX/PPPoL2TP) Sockets
3 *
4 * PPPoX --- Generic PPP encapsulation socket family
5 * PPPoL2TP --- PPP over L2TP (RFC 2661)
6 *
7 * Version: 2.0.0
8 *

--- 1537 unchanged lines hidden (view full) ---

1546 int tunnel_idx; /* current tunnel */
1547 int session_idx; /* index of session within current tunnel */
1548 struct l2tp_tunnel *tunnel;
1549 struct l2tp_session *session; /* NULL means get next tunnel */
1550};
1551
1552static void pppol2tp_next_tunnel(struct net *net, struct pppol2tp_seq_data *pd)
1553{
1/*****************************************************************************
2 * Linux PPP over L2TP (PPPoX/PPPoL2TP) Sockets
3 *
4 * PPPoX --- Generic PPP encapsulation socket family
5 * PPPoL2TP --- PPP over L2TP (RFC 2661)
6 *
7 * Version: 2.0.0
8 *

--- 1537 unchanged lines hidden (view full) ---

1546 int tunnel_idx; /* current tunnel */
1547 int session_idx; /* index of session within current tunnel */
1548 struct l2tp_tunnel *tunnel;
1549 struct l2tp_session *session; /* NULL means get next tunnel */
1550};
1551
1552static void pppol2tp_next_tunnel(struct net *net, struct pppol2tp_seq_data *pd)
1553{
1554 /* Drop reference taken during previous invocation */
1555 if (pd->tunnel)
1556 l2tp_tunnel_dec_refcount(pd->tunnel);
1557
1554 for (;;) {
1558 for (;;) {
1555 pd->tunnel = l2tp_tunnel_find_nth(net, pd->tunnel_idx);
1559 pd->tunnel = l2tp_tunnel_get_nth(net, pd->tunnel_idx);
1556 pd->tunnel_idx++;
1557
1560 pd->tunnel_idx++;
1561
1558 if (pd->tunnel == NULL)
1559 break;
1562 /* Only accept L2TPv2 tunnels */
1563 if (!pd->tunnel || pd->tunnel->version == 2)
1564 return;
1560
1565
1561 /* Ignore L2TPv3 tunnels */
1562 if (pd->tunnel->version < 3)
1563 break;
1566 l2tp_tunnel_dec_refcount(pd->tunnel);
1564 }
1565}
1566
1567static void pppol2tp_next_session(struct net *net, struct pppol2tp_seq_data *pd)
1568{
1569 pd->session = l2tp_session_get_nth(pd->tunnel, pd->session_idx);
1570 pd->session_idx++;
1571

--- 32 unchanged lines hidden (view full) ---

1604static void *pppol2tp_seq_next(struct seq_file *m, void *v, loff_t *pos)
1605{
1606 (*pos)++;
1607 return NULL;
1608}
1609
1610static void pppol2tp_seq_stop(struct seq_file *p, void *v)
1611{
1567 }
1568}
1569
1570static void pppol2tp_next_session(struct net *net, struct pppol2tp_seq_data *pd)
1571{
1572 pd->session = l2tp_session_get_nth(pd->tunnel, pd->session_idx);
1573 pd->session_idx++;
1574

--- 32 unchanged lines hidden (view full) ---

1607static void *pppol2tp_seq_next(struct seq_file *m, void *v, loff_t *pos)
1608{
1609 (*pos)++;
1610 return NULL;
1611}
1612
1613static void pppol2tp_seq_stop(struct seq_file *p, void *v)
1614{
1612 /* nothing to do */
1615 struct pppol2tp_seq_data *pd = v;
1616
1617 if (!pd || pd == SEQ_START_TOKEN)
1618 return;
1619
1620 /* Drop reference taken by last invocation of pppol2tp_next_tunnel() */
1621 if (pd->tunnel)
1622 l2tp_tunnel_dec_refcount(pd->tunnel);
1613}
1614
1615static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v)
1616{
1617 struct l2tp_tunnel *tunnel = v;
1618
1619 seq_printf(m, "\nTUNNEL '%s', %c %d\n",
1620 tunnel->name,

--- 251 unchanged lines hidden ---
1623}
1624
1625static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v)
1626{
1627 struct l2tp_tunnel *tunnel = v;
1628
1629 seq_printf(m, "\nTUNNEL '%s', %c %d\n",
1630 tunnel->name,

--- 251 unchanged lines hidden ---