ntk-console-server: Show basic current interfaces

This commit is contained in:
Alexander von Gluck IV 2014-09-15 18:43:14 -05:00
parent cea41ed409
commit 8264979309

View File

@ -97,6 +97,8 @@ request_processing(int session_fd, cmd_packet_t packet)
char buffer[CONSOLE_BUFFER_LENGTH]; char buffer[CONSOLE_BUFFER_LENGTH];
int maxBuffer = CONSOLE_BUFFER_LENGTH - 1; int maxBuffer = CONSOLE_BUFFER_LENGTH - 1;
memset(buffer, 0, sizeof(buffer));
switch (packet.command) { switch (packet.command) {
case COMMAND_UPTIME: case COMMAND_UPTIME:
{ {
@ -108,8 +110,15 @@ request_processing(int session_fd, cmd_packet_t packet)
snprintf(buffer, maxBuffer, "ntkd version: %s", VERSION_STR); snprintf(buffer, maxBuffer, "ntkd version: %s", VERSION_STR);
break; break;
case COMMAND_CURIFS: case COMMAND_CURIFS:
//send_response(session_fd, (char)me.cur_ifs); {
strcat(buffer, "current interfaces: ");
int i;
for(i = 0; i < me.cur_ifs_n; i++) {
strcat(buffer, me.cur_ifs[i].dev_name);
strcat(buffer, " ");
}
break; break;
}
case COMMAND_CURIFSCT: case COMMAND_CURIFSCT:
snprintf(buffer, maxBuffer, "current interface count: %d", me.cur_ifs_n); snprintf(buffer, maxBuffer, "current interface count: %d", me.cur_ifs_n);
break; break;