int slirp_redir(int is_udp, int host_port,
struct in_addr guest_addr, int guest_port);
+int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
+ int guest_port);
extern const char *tftp_prefix;
#endif
-#if 0
+#ifdef _WIN32
+
+int
+fork_exec(so, ex, do_pty)
+ struct socket *so;
+ char *ex;
+ int do_pty;
+{
+ /* not implemented */
+ return 0;
+}
+
+#else
+
int
openpty(amaster, aslave)
int *amaster, *aslave;
int opt;
int master;
char *argv[256];
+#if 0
char buff[256];
+#endif
/* don't want to clobber the original */
char *bptr;
char *curarg;
connect(s, (struct sockaddr *)&addr, addrlen);
}
+#if 0
if (x_port >= 0) {
#ifdef HAVE_SETENV
sprintf(buff, "%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen);
putenv(buff);
#endif
}
-
+#endif
dup2(s, 0);
dup2(s, 1);
dup2(s, 2);
int link_up;
struct timeval tt;
FILE *lfd;
+struct ex_list *exec_list;
/* XXX: suppress those select globals */
fd_set *global_readfds, *global_writefds, *global_xfds;
struct ethhdr *reh = (struct ethhdr *)arp_reply;
struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
int ar_op;
+ struct ex_list *ex_ptr;
ar_op = ntohs(ah->ar_op);
switch(ar_op) {
case ARPOP_REQUEST:
- if (!memcmp(ah->ar_tip, &special_addr, 3) &&
- (ah->ar_tip[3] == CTL_DNS || ah->ar_tip[3] == CTL_ALIAS)) {
-
+ if (!memcmp(ah->ar_tip, &special_addr, 3)) {
+ if (ah->ar_tip[3] == CTL_DNS || ah->ar_tip[3] == CTL_ALIAS)
+ goto arp_ok;
+ for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
+ if (ex_ptr->ex_addr == ah->ar_tip[3])
+ goto arp_ok;
+ }
+ return;
+ arp_ok:
/* XXX: make an ARP request to have the client address */
memcpy(client_ethaddr, eh->h_source, ETH_ALEN);
memcpy(eh->h_dest, client_ethaddr, ETH_ALEN);
memcpy(eh->h_source, special_ethaddr, ETH_ALEN - 1);
+ /* XXX: not correct */
eh->h_source[5] = CTL_ALIAS;
eh->h_proto = htons(ETH_P_IP);
memcpy(buf + sizeof(struct ethhdr), ip_data, ip_data_len);
}
return 0;
}
+
+int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
+ int guest_port)
+{
+ return add_exec(&exec_list, do_pty, (char *)args,
+ addr_low_byte, htons(guest_port));
+}
if(lastbyte==CTL_CMD || lastbyte==CTL_EXEC) {
/* Command or exec adress */
so->so_state |= SS_CTL;
- } else {
+ } else
+#endif
+ {
/* May be an add exec */
struct ex_list *ex_ptr;
-
for(ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
if(ex_ptr->ex_fport == so->so_fport &&
lastbyte == ex_ptr->ex_addr) {
}
}
if(so->so_state & SS_CTL) goto cont_input;
-#endif
}
/* CTL_ALIAS: Do nothing, tcp_fconnect will be called on it */
}
tcp_ctl(so)
struct socket *so;
{
-#if 0
struct sbuf *sb = &so->so_snd;
int command;
struct ex_list *ex_ptr;
DEBUG_CALL("tcp_ctl");
DEBUG_ARG("so = %lx", (long )so);
+#if 0
/*
* Check if they're authorised
*/
sb->sb_wptr += sb->sb_cc;
return 0;
}
-
+#endif
command = (ntohl(so->so_faddr.s_addr) & 0xff);
switch(command) {
DEBUG_MISC((dfd, " executing %s \n",ex_ptr->ex_exec));
return(fork_exec(so, ex_ptr->ex_exec, do_pty));
+#if 0
case CTL_CMD:
for (tmpso = tcb.so_next; tmpso != &tcb; tmpso = tmpso->so_next) {
if (tmpso->so_emu == EMU_CTL &&
sb->sb_wptr += sb->sb_cc;
do_echo=-1;
return(2);
- }
-#else
- return 0;
#endif
+ }
}