1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

struct kif is gone so adapt to the situation. show interface is gone for

now. OK norby@
This commit is contained in:
claudio 2007-12-13 08:57:32 +00:00
parent 6c9e7a5b96
commit ab5e4d0310
3 changed files with 13 additions and 79 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ospf6ctl.c,v 1.11 2007/11/27 12:24:55 claudio Exp $ */
/* $OpenBSD: ospf6ctl.c,v 1.12 2007/12/13 08:57:32 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@ -64,11 +64,9 @@ const char *print_ospf_rtr_flags(u_int8_t);
int show_rib_detail_msg(struct imsg *);
void show_fib_head(void);
int show_fib_msg(struct imsg *);
void show_interface_head(void);
const char * get_media_descr(int);
const char * get_linkstate(int, int);
void print_baudrate(u_int64_t);
int show_fib_interface_msg(struct imsg *);
struct imsgbuf *ibuf;
@ -189,14 +187,6 @@ main(int argc, char *argv[])
&res->addr, sizeof(res->addr));
show_fib_head();
break;
case SHOW_FIB_IFACE:
if (*res->ifname)
imsg_compose(ibuf, IMSG_CTL_IFINFO, 0, 0,
res->ifname, sizeof(res->ifname));
else
imsg_compose(ibuf, IMSG_CTL_IFINFO, 0, 0, NULL, 0);
show_interface_head();
break;
case FIB:
errx(1, "fib couple|decouple");
break;
@ -270,9 +260,6 @@ main(int argc, char *argv[])
case SHOW_FIB:
done = show_fib_msg(&imsg);
break;
case SHOW_FIB_IFACE:
done = show_fib_interface_msg(&imsg);
break;
case NONE:
case FIB:
case FIB_COUPLE:
@ -385,12 +372,18 @@ show_interface_detail_msg(struct imsg *imsg)
printf("\n");
printf("Interface %s, line protocol is %s\n",
iface->name, print_link(iface->flags));
printf(" Internet address %s ",
log_in6addr(&iface->addr));
printf("Area %s\n", inet_ntoa(iface->area));
printf(" Linkstate %s\n",
printf(" Internet address %s Area %s\n",
log_in6addr(&iface->addr), inet_ntoa(iface->area));
printf(" Link type %s, state %s",
get_media_descr(get_ifms_type(iface->mediatype)),
get_linkstate(get_ifms_type(iface->mediatype),
iface->linkstate));
if (iface->linkstate != LINK_STATE_DOWN &&
iface->baudrate > 0) {
printf(", ");
print_baudrate(iface->baudrate);
}
printf("\n");
printf(" Router ID %s, network type %s, cost: %d\n",
inet_ntoa(iface->rtr_id),
if_type_name(iface->type), iface->metric);
@ -1176,13 +1169,6 @@ show_fib_msg(struct imsg *imsg)
return (0);
}
void
show_interface_head(void)
{
printf("%-15s%-15s%s\n", "Interface", "Flags",
"Link state");
}
const int ifm_status_valid_list[] = IFM_STATUS_VALID_LIST;
const struct ifmedia_status_description
ifm_status_descriptions[] = IFM_STATUS_DESCRIPTIONS;
@ -1235,53 +1221,3 @@ print_baudrate(u_int64_t baudrate)
else
printf("%llu Bit/s", baudrate);
}
int
show_fib_interface_msg(struct imsg *imsg)
{
struct kif *k;
int ifms_type;
switch (imsg->hdr.type) {
case IMSG_CTL_IFINFO:
k = imsg->data;
printf("%-15s", k->ifname);
printf("%-15s", k->flags & IFF_UP ? "UP" : "");
switch (k->media_type) {
case IFT_ETHER:
ifms_type = IFM_ETHER;
break;
case IFT_FDDI:
ifms_type = IFM_FDDI;
break;
case IFT_CARP:
ifms_type = IFM_CARP;
break;
default:
ifms_type = 0;
break;
}
if (ifms_type)
printf("%s, %s", get_media_descr(ifms_type),
get_linkstate(ifms_type, k->link_state));
else if (k->link_state == LINK_STATE_UNKNOWN)
printf("unknown");
else
printf("link state %u", k->link_state);
if (k->link_state != LINK_STATE_DOWN && k->baudrate > 0) {
printf(", ");
print_baudrate(k->baudrate);
}
printf("\n");
break;
case IMSG_CTL_END:
printf("\n");
return (1);
default:
break;
}
return (0);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: parser.c,v 1.3 2007/10/16 08:43:44 claudio Exp $ */
/* $OpenBSD: parser.c,v 1.4 2007/12/13 08:57:32 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@ -122,7 +122,6 @@ static const struct token t_show_rib[] = {
static const struct token t_show_fib[] = {
{NOTOKEN, "", NONE, NULL},
{KEYWORD, "interface", SHOW_FIB_IFACE, t_show_iface},
{FLAG, "connected", F_CONNECTED, t_show_fib},
{FLAG, "static", F_STATIC, t_show_fib},
{FLAG, "ospf", F_OSPFD_INSERTED, t_show_fib},

View File

@ -1,4 +1,4 @@
/* $OpenBSD: parser.h,v 1.2 2007/10/16 08:43:44 claudio Exp $ */
/* $OpenBSD: parser.h,v 1.3 2007/12/13 08:57:32 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@ -46,7 +46,6 @@ enum actions {
SHOW_RIB,
SHOW_RIB_DTAIL,
SHOW_FIB,
SHOW_FIB_IFACE,
RELOAD
};