// Special characters used by Telnet - must be interpretted here
#define TELNET_IAC 0xFF // Interpret as command (escape)
#define TELNET_IP 0xF4 // Interrupt process
-#define TELNET_WONT 0xFC // I Won't do it
+#define TELNET_WILL 0xFB // I Will do XXX
+#define TELNET_WONT 0xFC // I Won't do XXX
#define TELNET_DO 0xFD // Will you XXX
+#define TELNET_DONT 0xFE // Don't you XXX
#define TELNET_TM 0x06 // Time marker (special DO/WONT after IP)
static cyg_bool
net_io_putc(__ch_data, TELNET_WONT);
net_io_putc(__ch_data, esc);
return false; // Ignore this whole thing!
+ case TELNET_WILL:
+ // Telnet WILL option
+ while (!_net_io_getc_nonblock(__ch_data, &esc)) ;
+ // Respond with DONT option
+ net_io_putc(__ch_data, TELNET_IAC);
+ net_io_putc(__ch_data, TELNET_DONT);
+ net_io_putc(__ch_data, esc);
+ return false; // Ignore this whole thing!
default:
return false;
}
CYG_HAL_TABLE_BEGIN( __NETDEVTAB__, netdev );
CYG_HAL_TABLE_END( __NETDEVTAB_END__, netdev );
-RedBoot_init(net_init, RedBoot_INIT_LAST);
+RedBoot_init(net_init, RedBoot_INIT_NET);
static void
show_addrs(void)
unsigned index;
struct eth_drv_sc *primary_net = (struct eth_drv_sc *)0;
#if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
- char *default_devname;
+ char *default_devname = CYGDAT_REDBOOT_DEFAULT_NETWORK_DEVICE;
int default_index;
#endif
#ifdef CYGDAT_REDBOOT_DEFAULT_BOOTP_SERVER_IP_ADDR
primary_net = __local_enet_sc;
} else
#endif
-#endif
+#endif // (CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
for (index = 0; (t = net_devtab_entry(index)) != NULL; index++) {
#ifdef CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE
if (index == default_index)
primary_net = __local_enet_sc;
}
#if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
+# ifdef CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE
+ break;
+# else
if (index == default_index) {
primary_net = __local_enet_sc;
}
+# endif // CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE
#endif
}
}
have_net = true; // Assume values in FLASH were OK
// Tell the world that we are using this fixed IP address
if (__arp_request((ip_addr_t *)__local_ip_addr, &enet_addr, 1) >= 0) {
- diag_printf("Warning: IP address %s in use\n", inet_ntoa((in_addr_t *)&__local_ip_addr));
+ diag_printf("Warning: IP address %s in use\n",
+ inet_ntoa((in_addr_t *)&__local_ip_addr));
}
}
}
static char usage[] = "[-b] [-l <local_ip_address>[/<mask_len>]] [-h <server_address>]"
#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
- " [-d <dns_server_address]"
+ " [-d <dns_server_address>]"
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS_FCONFIG_DOMAIN
+ " [-D <dns_domain_name>]"
+#endif
#endif
;
void
do_ip_addr(int argc, char *argv[])
{
- struct option_info opts[4];
+ struct option_info opts[5];
char *ip_addr, *host_addr;
bool ip_addr_set, host_addr_set;
bool do_bootp = false;
#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
char *dns_addr;
bool dns_addr_set;
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS_FCONFIG_DOMAIN
+ char *dns_domain;
+ bool dns_domain_set;
+#endif
#endif
int num_opts;
+
+ if (!have_net) {
+ net_init();
+ }
+ if (!have_net) {
+ diag_printf("Sorry, networking is not available.\n");
+ return;
+ }
init_opts(&opts[0], 'l', true, OPTION_ARG_TYPE_STR,
- (void *)&ip_addr, (bool *)&ip_addr_set, "local IP address");
+ &ip_addr, &ip_addr_set, "local IP address");
init_opts(&opts[1], 'h', true, OPTION_ARG_TYPE_STR,
- (void *)&host_addr, (bool *)&host_addr_set, "default server address");
+ &host_addr, &host_addr_set, "default server address");
init_opts(&opts[2], 'b', false, OPTION_ARG_TYPE_FLG,
&do_bootp, 0, "use BOOTP");
num_opts = 3;
init_opts(&opts[num_opts], 'd', true, OPTION_ARG_TYPE_STR,
(void *)&dns_addr, (bool *)&dns_addr_set, "DNS server address");
num_opts++;
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS_FCONFIG_DOMAIN
+ init_opts(&opts[num_opts], 'D', true, OPTION_ARG_TYPE_STR,
+ (void *)&dns_domain, (bool *)&dns_domain_set, "DNS domain");
+ num_opts++;
+#endif
#endif
-
CYG_ASSERT(num_opts <= NUM_ELEMS(opts), "Too many options");
if (!scan_opts(argc, argv, 1, opts, num_opts, 0, 0, "")) {
char *slash_pos;
/* see if the (optional) mask length was given */
if( (slash_pos = strchr(ip_addr, '/')) ) {
- unsigned long mask_len;
+ unsigned long mask_len;
unsigned long mask;
*slash_pos = '\0';
slash_pos++;
- if (!parse_num(slash_pos, &mask_len, 0, 0) ||
+ if( !parse_num(slash_pos, &mask_len, 0, 0) ||
mask_len <= 0 || mask_len > 32 ) {
diag_printf("Invalid mask length: %s\n", slash_pos);
return;
if (dns_addr_set) {
set_dns(dns_addr);
}
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS_FCONFIG_DOMAIN
+ if (dns_domain_set) {
+ setdomainname(dns_domain, strlen(dns_domain));
+ }
+#endif
#endif
show_addrs();
if (!have_net) {