Changeset 26b58b7e in rtems for cpukit


Ignore:
Timestamp:
Oct 10, 2018, 11:12:50 AM (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ca056e3
Parents:
0dc303f
git-author:
Sebastian Huber <sebastian.huber@…> (10/10/18 11:12:50)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/11/18 07:08:10)
Message:

telnetd: Add server port to configuration

Close #3543.

Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/telnetd.h

    r0dc303f r26b58b7e  
    9393   */
    9494  uint16_t client_maximum;
     95
     96  /**
     97   * @brief Server port number in host byte order.
     98   *
     99   * Use 0 for the default value.
     100   */
     101  uint16_t port;
    95102} rtems_telnetd_config_table;
    96103
     
    101108 * @retval RTEMS_INVALID_ADDRESS The command function in the configuration is
    102109 *   @c NULL.
    103  * @retval RTEMS_RESOURCE_IN_USE The Telnet server was already started.
     110 * @retval RTEMS_RESOURCE_IN_USE The server port is already in use.
    104111 * @retval RTEMS_NOT_IMPLEMENTED The keep stdio configuration option is true.
    105112 * @retval RTEMS_UNSATISFIED Not enough resources to start the Telnet server or
  • cpukit/telnetd/telnetd.c

    r0dc303f r26b58b7e  
    4545#include <netinet/in.h>
    4646#include <arpa/inet.h>
     47#include <inttypes.h>
    4748#include <unistd.h>
    4849#include <stdlib.h>
     
    5253
    5354#include <rtems.h>
    54 #include <rtems/error.h>
    5555#include <rtems/pty.h>
    5656#include <rtems/shell.h>
     
    296296  memset(&srv, 0, sizeof(srv));
    297297  srv.sin.sin_family = AF_INET;
    298   srv.sin.sin_port = htons(23);
     298  srv.sin.sin_port = htons(ctx->config.port);
    299299  address_len = sizeof(srv.sin);
    300300
     
    416416  }
    417417
     418  if (ctx->config.port == 0) {
     419    ctx->config.port = 23;
     420  }
     421
    418422  sc = telnetd_create_server_socket(ctx);
    419423  if (sc != RTEMS_SUCCESSFUL) {
     
    448452  );
    449453
    450   syslog(LOG_DAEMON | LOG_INFO, "telnetd: started successfully");
     454  syslog(
     455    LOG_DAEMON | LOG_INFO,
     456    "telnetd: started successfully on port %" PRIu16, ctx->config.port
     457  );
    451458  return RTEMS_SUCCESSFUL;
    452459}
Note: See TracChangeset for help on using the changeset viewer.