Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/yellowman/nsh
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowman committed Jun 5, 2016
2 parents 5718a22 + 63b02f3 commit f7f0b37
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions commands.c
Expand Up @@ -165,6 +165,7 @@ Menu showlist[] = {
{ "bgp", "BGP information", CMPL(ta) (char **)bgcs, sizeof(struct prot1), 0, 4, pr_prot1 },
{ "ospf", "OSPF information", CMPL(ta) (char **)oscs, sizeof(struct prot1), 0, 3, pr_prot1 },
{ "ospf6", "OSPF6 information", CMPL(ta) (char **)os6cs, sizeof(struct prot1), 0, 3, pr_prot1 },
{ "eigrp", "EIGRP information", CMPL(ta) (char **)eics, sizeof(struct prot1), 0, 3, pr_prot1 },
{ "rip", "RIP information", CMPL(ta) (char **)rics, sizeof(struct prot1), 0, 3, pr_prot1 },
{ "ldp", "LDP information", CMPL(ta) (char **)lics, sizeof(struct prot1), 0, 3, pr_prot1 },
{ "ike", "IKE information", CMPL(ta) (char **)ikcs, sizeof(struct prot1), 0, 3, pr_prot1 },
Expand Down Expand Up @@ -819,6 +820,7 @@ static char
pfhelp[] = "Packet filter control",
ospfhelp[] = "OSPF control",
ospf6help[] = "OSPF6 control",
eigrphelp[] = "EIGRP control",
bgphelp[] = "BGP control",
riphelp[] = "RIP control",
ldphelp[] = "LDP control",
Expand Down Expand Up @@ -897,6 +899,7 @@ Command cmdtab[] = {
{ "pf", pfhelp, CMPL(t) (char **)ctl_pf, ssctl, ctlhandler, 1, 0, 1 },
{ "ospf", ospfhelp, CMPL(t) (char **)ctl_ospf, ssctl, ctlhandler, 1, 0, 1 },
{ "ospf6", ospf6help, CMPL(t) (char **)ctl_ospf6, ssctl, ctlhandler, 1, 0, 1 },
{ "eigrp", eigrphelp, CMPL(t) (char **)ctl_eigrp, ssctl, ctlhandler, 1, 0, 1 },
{ "bgp", bgphelp, CMPL(t) (char **)ctl_bgp, ssctl, ctlhandler, 1, 0, 1 },
{ "rip", riphelp, CMPL(t) (char **)ctl_rip, ssctl, ctlhandler, 1, 0, 1 },
{ "ldp", ldphelp, CMPL(t) (char **)ctl_ldp, ssctl, ctlhandler, 1, 0, 1 },
Expand Down
12 changes: 12 additions & 0 deletions commands.h
Expand Up @@ -111,6 +111,18 @@ struct prot1 os6cs[] = {
{ 0, 0, { 0 } }
};

struct prot1 eics[] = {
{ "interfaces", "Interface",
{ EIGRPCTL, "show", "interfaces", OPT, OPT, NULL } },
{ "neighbor", "Neighbor",
{ EIGRPCTL, "show", "neighbor", OPT, OPT, NULL } },
{ "topology", "Topology",
{ EIGRPCTL, "show", "topology", OPT, OPT, NULL } },
{ "traffic", "Traffic",
{ EIGRPCTL, "show", "traffic", OPT, OPT, NULL } },
{ 0, 0, { 0 } }
};

struct prot1 rics[] = {
{ "fib", "Forward Information Base",
{ RIPCTL, "show", "fib", OPT, NULL } },
Expand Down
21 changes: 21 additions & 0 deletions ctl.c
Expand Up @@ -30,6 +30,7 @@
/* service daemons */
#define OSPFD "/usr/sbin/ospfd"
#define OSPF6D "/usr/sbin/ospf6d"
#define EIGRPD "/usr/sbin/eigrpd"
#define BGPD "/usr/sbin/bgpd"
#define RIPD "/usr/sbin/ripd"
#define ISAKMPD "/sbin/isakmpd"
Expand Down Expand Up @@ -71,6 +72,7 @@ struct daemons ctl_daemons[] = {
{ "pf", "PF", ctl_pf, PFCONF_TEMP, 0600, 1, 0 },
{ "ospf", "OSPF", ctl_ospf, OSPFCONF_TEMP, 0600, 0, RT_TABLEID_MAX },
{ "ospf6", "OSPF6",ctl_ospf6, OSPF6CONF_TEMP, 0600, 0, RT_TABLEID_MAX },
{ "eigrp", "EIGRP",ctl_eigrp, EIGRPCONF_TEMP, 0600, 0, RT_TABLEID_MAX },
{ "bgp", "BGP", ctl_bgp, BGPCONF_TEMP, 0600, 0, 0 },
{ "rip", "RIP", ctl_rip, RIPCONF_TEMP, 0600, 0, RT_TABLEID_MAX },
{ "ldp", "LDP", ctl_ldp, LDPCONF_TEMP, 0600, 0, 0 },
Expand Down Expand Up @@ -160,6 +162,25 @@ struct ctl ctl_ospf6[] = {
{ 0, 0, { 0 }, 0, 0, 0 }
};

/* eigrpd, eigrpctl */
char *ctl_eigrp_test[] = { EIGRPD, "-nf", REQTEMP, '\0' };
struct ctl ctl_eigrp[] = {
{ "enable", "enable service",
{ EIGRPD, "-f", REQTEMP, NULL }, NULL, DB_X_ENABLE, T_EXEC },
{ "disable", "disable service",
{ PKILL, table, "eigrpd", NULL }, NULL, DB_X_DISABLE, T_EXEC },
{ "edit", "edit configuration",
{ "eigrp", (char *)ctl_eigrp_test, NULL }, call_editor, 0,
T_HANDLER_FILL1 },
{ "reload", "reload service",
{ EIGRPCTL, "reload", NULL }, NULL, 0, T_EXEC },
{ "fib", "fib couple/decouple",
{ EIGRPCTL, "fib", REQ, NULL }, NULL, 0, T_EXEC },
{ "log", "log brief/verbose",
{ EIGRPCTL, "lob", REQ, NULL }, NULL, 0, T_EXEC },
{ 0, 0, { 0 }, 0, 0, 0 }
};

/* bgpd, bgpctl */
char *ctl_bgp_test[] = { BGPD, "-nf", REQTEMP, NULL, '\0' };
struct ctl ctl_bgp[] = {
Expand Down
3 changes: 3 additions & 0 deletions externs.h
Expand Up @@ -127,6 +127,7 @@ extern char metricnames[];
#define PFCONF_TEMP "/var/run/pf.conf"
#define OSPFCONF_TEMP "/var/run/ospfd.conf"
#define OSPF6CONF_TEMP "/var/run/ospf6d.conf"
#define EIGRPCONF_TEMP "/var/run/eigrpd.conf"
#define BGPCONF_TEMP "/var/run/bgpd.conf"
#define RIPCONF_TEMP "/var/run/ripd.conf"
#define LDPCONF_TEMP "/var/run/ldpd.conf"
Expand Down Expand Up @@ -166,6 +167,7 @@ void rmtemp(char *);
#define PFCTL "/sbin/pfctl"
#define OSPFCTL "/usr/sbin/ospfctl"
#define OSPF6CTL "/usr/sbin/ospf6ctl"
#define EIGRPCTL "/usr/sbin/eigrpctl"
#define BGPCTL "/usr/sbin/bgpctl"
#define RIPCTL "/usr/sbin/ripctl"
#define LDPCTL "/usr/sbin/ldpctl"
Expand Down Expand Up @@ -200,6 +202,7 @@ extern struct daemons ctl_daemons[];
extern struct ctl ctl_pf[];
extern struct ctl ctl_ospf[];
extern struct ctl ctl_ospf6[];
extern struct ctl ctl_eigrp[];
extern struct ctl ctl_relay[];
extern struct ctl ctl_bgp[];
extern struct ctl ctl_rip[];
Expand Down
2 changes: 1 addition & 1 deletion ppp.c
Expand Up @@ -395,7 +395,7 @@ conf_sppp_mh(FILE *output, struct sauthreq *spa, char *ifname, char *pfx)
char type[TYPESZ];
StringList *req;

if (!(spa->proto | spa->name[0] | spa->secret[0] | (spa->flags &
if (!(spa->proto | spa->name[0] | (spa->flags &
AUTHFLAG_NOCALLOUT) | (spa->flags & AUTHFLAG_NORECHALLENGE)))
return;
fprintf(output, " %s", pfx);
Expand Down

0 comments on commit f7f0b37

Please sign in to comment.