From 4faec4307043d4c9f17808813ef594ef88c1904d Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Sat, 15 May 1999 02:24:18 +0000 Subject: [PATCH] Add ``show layers'' to see the protocol layering for a link. --- usr.sbin/ppp/command.c | 6 ++++-- usr.sbin/ppp/link.c | 18 +++++++++++++++++- usr.sbin/ppp/link.h | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 159b148ad3e..c6b8d20168e 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.192 1999/05/08 11:06:21 brian Exp $ + * $Id: command.c,v 1.193 1999/05/12 09:48:44 brian Exp $ * */ #include @@ -143,7 +143,7 @@ #define NEG_DNS 52 const char Version[] = "2.21"; -const char VersionDate[] = "$Date: 1999/05/08 11:06:21 $"; +const char VersionDate[] = "$Date: 1999/05/12 09:48:44 $"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); @@ -757,6 +757,8 @@ static struct cmdtab const ShowCommands[] = { "Interface status", "show iface"}, {"ipcp", NULL, ipcp_Show, LOCAL_AUTH, "IPCP status", "show ipcp"}, + {"layers", NULL, link_ShowLayers, LOCAL_AUTH | LOCAL_CX_OPT, + "Protocol layers", "show layers"}, {"lcp", NULL, lcp_ReportStatus, LOCAL_AUTH | LOCAL_CX, "LCP status", "show lcp"}, {"link", "datalink", datalink_Show, LOCAL_AUTH | LOCAL_CX, diff --git a/usr.sbin/ppp/link.c b/usr.sbin/ppp/link.c index 42c5e0cdd6b..9cc1d51dc40 100644 --- a/usr.sbin/ppp/link.c +++ b/usr.sbin/ppp/link.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link.c,v 1.9 1999/05/08 11:06:58 brian Exp $ + * $Id: link.c,v 1.10 1999/05/12 09:48:51 brian Exp $ * */ @@ -64,6 +64,7 @@ #include "pap.h" #include "chap.h" #include "cbcp.h" +#include "command.h" static void Despatch(struct bundle *, struct link *, struct mbuf *, u_short); @@ -339,3 +340,18 @@ Despatch(struct bundle *bundle, struct link *l, struct mbuf *bp, u_short proto) mbuf_Free(bp); } } + +int +link_ShowLayers(struct cmdargs const *arg) +{ + struct link *l = command_ChooseLink(arg); + int layer; + + for (layer = l->nlayers; layer; layer--) + prompt_Printf(arg->prompt, "%s%s", layer == l->nlayers ? "" : ", ", + l->layer[layer - 1]->name); + if (l->nlayers) + prompt_Printf(arg->prompt, "\n"); + + return 0; +} diff --git a/usr.sbin/ppp/link.h b/usr.sbin/ppp/link.h index 62250141aba..7c040830a0b 100644 --- a/usr.sbin/ppp/link.h +++ b/usr.sbin/ppp/link.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link.h,v 1.4 1998/08/25 17:48:42 brian Exp $ + * $Id: link.h,v 1.5 1999/05/08 11:07:00 brian Exp $ * */ @@ -36,6 +36,7 @@ struct bundle; struct prompt; +struct cmdargs; struct link { int type; /* _LINK type */ @@ -73,3 +74,4 @@ extern void link_EmptyStack(struct link *); #define PROTO_OUT 2 extern void link_ProtocolRecord(struct link *, u_short, int); extern void link_ReportProtocolStatus(struct link *, struct prompt *); +extern int link_ShowLayers(struct cmdargs const *);