Commit 0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a
Committed by
Anthony Liguori
1 parent
6dbe553f
slirp: Drop dead code
After all its years inside the qemu tree, there is no point in keeping the dead code paths of slirp. This patch is a first round of removing usually commented out code parts. More cleanups need to follow (and maybe finally a proper reindention). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
26 changed files
with
22 additions
and
1650 deletions
slirp/debug.c
... | ... | @@ -9,127 +9,9 @@ |
9 | 9 | #include <slirp.h> |
10 | 10 | |
11 | 11 | FILE *dfd = NULL; |
12 | -#ifdef DEBUG | |
13 | -int dostats = 1; | |
14 | -#else | |
15 | -int dostats = 0; | |
16 | -#endif | |
17 | 12 | int slirp_debug = 0; |
18 | 13 | |
19 | -/* Carry over one item from main.c so that the tty's restored. | |
20 | - * Only done when the tty being used is /dev/tty --RedWolf */ | |
21 | -#ifndef CONFIG_QEMU | |
22 | -extern struct termios slirp_tty_settings; | |
23 | -extern int slirp_tty_restore; | |
24 | - | |
25 | - | |
26 | -void | |
27 | -debug_init(file, dbg) | |
28 | - char *file; | |
29 | - int dbg; | |
30 | -{ | |
31 | - /* Close the old debugging file */ | |
32 | - if (dfd) | |
33 | - fclose(dfd); | |
34 | - | |
35 | - dfd = fopen(file,"w"); | |
36 | - if (dfd != NULL) { | |
37 | -#if 0 | |
38 | - fprintf(dfd,"Slirp %s - Debugging Started.\n", SLIRP_VERSION); | |
39 | -#endif | |
40 | - fprintf(dfd,"Debugging Started level %i.\r\n",dbg); | |
41 | - fflush(dfd); | |
42 | - slirp_debug = dbg; | |
43 | - } else { | |
44 | - lprint("Error: Debugging file \"%s\" could not be opened: %s\r\n", | |
45 | - file, strerror(errno)); | |
46 | - } | |
47 | -} | |
48 | - | |
49 | -/* | |
50 | - * Dump a packet in the same format as tcpdump -x | |
51 | - */ | |
52 | -#ifdef DEBUG | |
53 | -void | |
54 | -dump_packet(dat, n) | |
55 | - void *dat; | |
56 | - int n; | |
57 | -{ | |
58 | - u_char *pptr = (u_char *)dat; | |
59 | - int j,k; | |
60 | - | |
61 | - n /= 16; | |
62 | - n++; | |
63 | - DEBUG_MISC((dfd, "PACKET DUMPED: \n")); | |
64 | - for(j = 0; j < n; j++) { | |
65 | - for(k = 0; k < 6; k++) | |
66 | - DEBUG_MISC((dfd, "%02x ", *pptr++)); | |
67 | - DEBUG_MISC((dfd, "\n")); | |
68 | - fflush(dfd); | |
69 | - } | |
70 | -} | |
71 | -#endif | |
72 | -#endif | |
73 | - | |
74 | 14 | #ifdef LOG_ENABLED |
75 | -#if 0 | |
76 | -/* | |
77 | - * Statistic routines | |
78 | - * | |
79 | - * These will print statistics to the screen, the debug file (dfd), or | |
80 | - * a buffer, depending on "type", so that the stats can be sent over | |
81 | - * the link as well. | |
82 | - */ | |
83 | - | |
84 | -static void | |
85 | -ttystats(ttyp) | |
86 | - struct ttys *ttyp; | |
87 | -{ | |
88 | - struct slirp_ifstats *is = &ttyp->ifstats; | |
89 | - char buff[512]; | |
90 | - | |
91 | - lprint(" \r\n"); | |
92 | - | |
93 | - if (IF_COMP & IF_COMPRESS) | |
94 | - strcpy(buff, "on"); | |
95 | - else if (IF_COMP & IF_NOCOMPRESS) | |
96 | - strcpy(buff, "off"); | |
97 | - else | |
98 | - strcpy(buff, "off (for now)"); | |
99 | - lprint("Unit %d:\r\n", ttyp->unit); | |
100 | - lprint(" using %s encapsulation (VJ compression is %s)\r\n", ( | |
101 | -#ifdef USE_PPP | |
102 | - ttyp->proto==PROTO_PPP?"PPP": | |
103 | -#endif | |
104 | - "SLIP"), buff); | |
105 | - lprint(" %d baudrate\r\n", ttyp->baud); | |
106 | - lprint(" interface is %s\r\n", ttyp->up?"up":"down"); | |
107 | - lprint(" using fd %d, guardian pid is %d\r\n", ttyp->fd, ttyp->pid); | |
108 | -#ifndef FULL_BOLT | |
109 | - lprint(" towrite is %d bytes\r\n", ttyp->towrite); | |
110 | -#endif | |
111 | - if (ttyp->zeros) | |
112 | - lprint(" %d zeros have been typed\r\n", ttyp->zeros); | |
113 | - else if (ttyp->ones) | |
114 | - lprint(" %d ones have been typed\r\n", ttyp->ones); | |
115 | - lprint("Interface stats:\r\n"); | |
116 | - lprint(" %6d output packets sent (%d bytes)\r\n", is->out_pkts, is->out_bytes); | |
117 | - lprint(" %6d output packets dropped (%d bytes)\r\n", is->out_errpkts, is->out_errbytes); | |
118 | - lprint(" %6d input packets received (%d bytes)\r\n", is->in_pkts, is->in_bytes); | |
119 | - lprint(" %6d input packets dropped (%d bytes)\r\n", is->in_errpkts, is->in_errbytes); | |
120 | - lprint(" %6d bad input packets\r\n", is->in_mbad); | |
121 | -} | |
122 | - | |
123 | -static void | |
124 | -allttystats(void) | |
125 | -{ | |
126 | - struct ttys *ttyp; | |
127 | - | |
128 | - for (ttyp = ttys; ttyp; ttyp = ttyp->next) | |
129 | - ttystats(ttyp); | |
130 | -} | |
131 | -#endif | |
132 | - | |
133 | 15 | static void |
134 | 16 | ipstats(void) |
135 | 17 | { |
... | ... | @@ -154,25 +36,6 @@ ipstats(void) |
154 | 36 | lprint(" %6d total packets delivered\r\n", ipstat.ips_delivered); |
155 | 37 | } |
156 | 38 | |
157 | -#ifndef CONFIG_QEMU | |
158 | -static void | |
159 | -vjstats(void) | |
160 | -{ | |
161 | - lprint(" \r\n"); | |
162 | - | |
163 | - lprint("VJ compression stats:\r\n"); | |
164 | - | |
165 | - lprint(" %6d outbound packets (%d compressed)\r\n", | |
166 | - comp_s.sls_packets, comp_s.sls_compressed); | |
167 | - lprint(" %6d searches for connection stats (%d misses)\r\n", | |
168 | - comp_s.sls_searches, comp_s.sls_misses); | |
169 | - lprint(" %6d inbound uncompressed packets\r\n", comp_s.sls_uncompressedin); | |
170 | - lprint(" %6d inbound compressed packets\r\n", comp_s.sls_compressedin); | |
171 | - lprint(" %6d inbound unknown type packets\r\n", comp_s.sls_errorin); | |
172 | - lprint(" %6d inbound packets tossed due to error\r\n", comp_s.sls_tossed); | |
173 | -} | |
174 | -#endif | |
175 | - | |
176 | 39 | static void |
177 | 40 | tcpstats(void) |
178 | 41 | { |
... | ... | @@ -234,11 +97,6 @@ tcpstats(void) |
234 | 97 | lprint(" %6d correct ACK header predictions\r\n", tcpstat.tcps_predack); |
235 | 98 | lprint(" %6d correct data packet header predictions\n", tcpstat.tcps_preddat); |
236 | 99 | lprint(" %6d TCP cache misses\r\n", tcpstat.tcps_socachemiss); |
237 | - | |
238 | - | |
239 | -/* lprint(" Packets received too short: %d\r\n", tcpstat.tcps_rcvshort); */ | |
240 | -/* lprint(" Segments dropped due to PAWS: %d\r\n", tcpstat.tcps_pawsdrop); */ | |
241 | - | |
242 | 100 | } |
243 | 101 | |
244 | 102 | static void |
... | ... | @@ -293,49 +151,6 @@ mbufstats(void) |
293 | 151 | } |
294 | 152 | #endif |
295 | 153 | |
296 | -#ifndef CONFIG_QEMU | |
297 | -void | |
298 | -slirp_exit(exit_status) | |
299 | - int exit_status; | |
300 | -{ | |
301 | - struct ttys *ttyp; | |
302 | - | |
303 | - DEBUG_CALL("slirp_exit"); | |
304 | - DEBUG_ARG("exit_status = %d", exit_status); | |
305 | - | |
306 | - if (dostats) { | |
307 | - lprint_print = (int (*) _P((void *, const char *, va_list)))vfprintf; | |
308 | - if (!dfd) | |
309 | - debug_init("slirp_stats", 0xf); | |
310 | - lprint_arg = (char **)&dfd; | |
311 | - | |
312 | - ipstats(); | |
313 | - tcpstats(); | |
314 | - udpstats(); | |
315 | - icmpstats(); | |
316 | - mbufstats(); | |
317 | - sockstats(); | |
318 | - allttystats(); | |
319 | - vjstats(); | |
320 | - } | |
321 | - | |
322 | - for (ttyp = ttys; ttyp; ttyp = ttyp->next) | |
323 | - tty_detached(ttyp, 1); | |
324 | - | |
325 | - if (slirp_forked) { | |
326 | - /* Menendez time */ | |
327 | - if (kill(getppid(), SIGQUIT) < 0) | |
328 | - lprint("Couldn't kill parent process %ld!\n", | |
329 | - (long) getppid()); | |
330 | - } | |
331 | - | |
332 | - /* Restore the terminal if we gotta */ | |
333 | - if(slirp_tty_restore) | |
334 | - tcsetattr(0,TCSANOW, &slirp_tty_settings); /* NOW DAMMIT! */ | |
335 | - exit(exit_status); | |
336 | -} | |
337 | -#endif | |
338 | - | |
339 | 154 | void |
340 | 155 | slirp_stats(void) |
341 | 156 | { | ... | ... |
slirp/debug.h
slirp/if.c
... | ... | @@ -36,89 +36,9 @@ if_init(void) |
36 | 36 | { |
37 | 37 | if_fastq.ifq_next = if_fastq.ifq_prev = &if_fastq; |
38 | 38 | if_batchq.ifq_next = if_batchq.ifq_prev = &if_batchq; |
39 | - // sl_compress_init(&comp_s); | |
40 | 39 | next_m = &if_batchq; |
41 | 40 | } |
42 | 41 | |
43 | -#if 0 | |
44 | -/* | |
45 | - * This shouldn't be needed since the modem is blocking and | |
46 | - * we don't expect any signals, but what the hell.. | |
47 | - */ | |
48 | -inline int | |
49 | -writen(fd, bptr, n) | |
50 | - int fd; | |
51 | - char *bptr; | |
52 | - int n; | |
53 | -{ | |
54 | - int ret; | |
55 | - int total; | |
56 | - | |
57 | - /* This should succeed most of the time */ | |
58 | - ret = send(fd, bptr, n,0); | |
59 | - if (ret == n || ret <= 0) | |
60 | - return ret; | |
61 | - | |
62 | - /* Didn't write everything, go into the loop */ | |
63 | - total = ret; | |
64 | - while (n > total) { | |
65 | - ret = send(fd, bptr+total, n-total,0); | |
66 | - if (ret <= 0) | |
67 | - return ret; | |
68 | - total += ret; | |
69 | - } | |
70 | - return total; | |
71 | -} | |
72 | - | |
73 | -/* | |
74 | - * if_input - read() the tty, do "top level" processing (ie: check for any escapes), | |
75 | - * and pass onto (*ttyp->if_input) | |
76 | - * | |
77 | - * XXXXX Any zeros arriving by themselves are NOT placed into the arriving packet. | |
78 | - */ | |
79 | -#define INBUFF_SIZE 2048 /* XXX */ | |
80 | -void | |
81 | -if_input(ttyp) | |
82 | - struct ttys *ttyp; | |
83 | -{ | |
84 | - u_char if_inbuff[INBUFF_SIZE]; | |
85 | - int if_n; | |
86 | - | |
87 | - DEBUG_CALL("if_input"); | |
88 | - DEBUG_ARG("ttyp = %lx", (long)ttyp); | |
89 | - | |
90 | - if_n = recv(ttyp->fd, (char *)if_inbuff, INBUFF_SIZE,0); | |
91 | - | |
92 | - DEBUG_MISC((dfd, " read %d bytes\n", if_n)); | |
93 | - | |
94 | - if (if_n <= 0) { | |
95 | - if (if_n == 0 || (errno != EINTR && errno != EAGAIN)) { | |
96 | - if (ttyp->up) | |
97 | - link_up--; | |
98 | - tty_detached(ttyp, 0); | |
99 | - } | |
100 | - return; | |
101 | - } | |
102 | - if (if_n == 1) { | |
103 | - if (*if_inbuff == '0') { | |
104 | - ttyp->ones = 0; | |
105 | - if (++ttyp->zeros >= 5) | |
106 | - slirp_exit(0); | |
107 | - return; | |
108 | - } | |
109 | - if (*if_inbuff == '1') { | |
110 | - ttyp->zeros = 0; | |
111 | - if (++ttyp->ones >= 5) | |
112 | - tty_detached(ttyp, 0); | |
113 | - return; | |
114 | - } | |
115 | - } | |
116 | - ttyp->ones = ttyp->zeros = 0; | |
117 | - | |
118 | - (*ttyp->if_input)(ttyp, if_inbuff, if_n); | |
119 | -} | |
120 | -#endif | |
121 | - | |
122 | 42 | /* |
123 | 43 | * if_output: Queue packet into an output queue. |
124 | 44 | * There are 2 output queue's, if_fastq and if_batchq. | ... | ... |
slirp/if.h
... | ... | @@ -17,20 +17,8 @@ |
17 | 17 | #define IF_MRU 1500 |
18 | 18 | #define IF_COMP IF_AUTOCOMP /* Flags for compression */ |
19 | 19 | |
20 | -#if 0 | |
21 | -/* | |
22 | - * Set if_maxlinkhdr to 48 because it's 40 bytes for TCP/IP, | |
23 | - * and 8 bytes for PPP, but need to have it on an 8byte boundary | |
24 | - */ | |
25 | -#ifdef USE_PPP | |
26 | -#define IF_MAXLINKHDR 48 | |
27 | -#else | |
28 | -#define IF_MAXLINKHDR 40 | |
29 | -#endif | |
30 | -#else | |
31 | - /* 2 for alignment, 14 for ethernet, 40 for TCP/IP */ | |
20 | +/* 2 for alignment, 14 for ethernet, 40 for TCP/IP */ | |
32 | 21 | #define IF_MAXLINKHDR (2 + 14 + 40) |
33 | -#endif | |
34 | 22 | |
35 | 23 | extern int if_queued; /* Number of packets queued so far */ |
36 | 24 | ... | ... |
slirp/ip_icmp.c
... | ... | @@ -73,7 +73,6 @@ icmp_input(struct mbuf *m, int hlen) |
73 | 73 | register struct icmp *icp; |
74 | 74 | register struct ip *ip=mtod(m, struct ip *); |
75 | 75 | int icmplen=ip->ip_len; |
76 | - /* int code; */ | |
77 | 76 | |
78 | 77 | DEBUG_CALL("icmp_input"); |
79 | 78 | DEBUG_ARG("m = %lx", (long )m); |
... | ... | @@ -102,9 +101,6 @@ icmp_input(struct mbuf *m, int hlen) |
102 | 101 | m->m_len += hlen; |
103 | 102 | m->m_data -= hlen; |
104 | 103 | |
105 | - /* icmpstat.icps_inhist[icp->icmp_type]++; */ | |
106 | - /* code = icp->icmp_code; */ | |
107 | - | |
108 | 104 | DEBUG_ARG("icmp_type = %d", icp->icmp_type); |
109 | 105 | switch (icp->icmp_type) { |
110 | 106 | case ICMP_ECHO: | ... | ... |
slirp/ip_input.c
... | ... | @@ -165,16 +165,6 @@ ip_input(struct mbuf *m) |
165 | 165 | } |
166 | 166 | |
167 | 167 | /* |
168 | - * Process options and, if not destined for us, | |
169 | - * ship it on. ip_dooptions returns 1 when an | |
170 | - * error was detected (causing an icmp message | |
171 | - * to be sent and the original packet to be freed). | |
172 | - */ | |
173 | -/* We do no IP options */ | |
174 | -/* if (hlen > sizeof (struct ip) && ip_dooptions(m)) | |
175 | - * goto next; | |
176 | - */ | |
177 | - /* | |
178 | 168 | * If offset or IP_MF are set, must reassemble. |
179 | 169 | * Otherwise, nothing need be done. |
180 | 170 | * (We could look in the reassembly queue to see |
... | ... | @@ -396,9 +386,6 @@ insert: |
396 | 386 | q = (struct ipasfrag *)(m->m_ext + delta); |
397 | 387 | } |
398 | 388 | |
399 | - /* DEBUG_ARG("ip = %lx", (long)ip); | |
400 | - * ip=(struct ipasfrag *)m->m_data; */ | |
401 | - | |
402 | 389 | ip = fragtoip(q); |
403 | 390 | ip->ip_len = next; |
404 | 391 | ip->ip_tos &= ~1; |
... | ... | @@ -505,7 +492,6 @@ ip_dooptions(m) |
505 | 492 | register u_char *cp; |
506 | 493 | register struct ip_timestamp *ipt; |
507 | 494 | register struct in_ifaddr *ia; |
508 | -/* int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; */ | |
509 | 495 | int opt, optlen, cnt, off, code, type, forward = 0; |
510 | 496 | struct in_addr *sin, dst; |
511 | 497 | typedef u_int32_t n_time; |
... | ... | @@ -683,9 +669,6 @@ typedef u_int32_t n_time; |
683 | 669 | } |
684 | 670 | return (0); |
685 | 671 | bad: |
686 | - /* ip->ip_len -= ip->ip_hl << 2; XXX icmp_error adds in hdr length */ | |
687 | - | |
688 | -/* Not yet */ | |
689 | 672 | icmp_error(m, type, code, 0, 0); |
690 | 673 | |
691 | 674 | STAT(ipstat.ips_badoptions++); | ... | ... |
slirp/ip_output.c
... | ... | @@ -64,12 +64,6 @@ ip_output(struct socket *so, struct mbuf *m0) |
64 | 64 | DEBUG_ARG("so = %lx", (long)so); |
65 | 65 | DEBUG_ARG("m0 = %lx", (long)m0); |
66 | 66 | |
67 | - /* We do no options */ | |
68 | -/* if (opt) { | |
69 | - * m = ip_insertoptions(m, opt, &len); | |
70 | - * hlen = len; | |
71 | - * } | |
72 | - */ | |
73 | 67 | ip = mtod(m, struct ip *); |
74 | 68 | /* |
75 | 69 | * Fill in IP header. |
... | ... | @@ -81,17 +75,6 @@ ip_output(struct socket *so, struct mbuf *m0) |
81 | 75 | STAT(ipstat.ips_localout++); |
82 | 76 | |
83 | 77 | /* |
84 | - * Verify that we have any chance at all of being able to queue | |
85 | - * the packet or packet fragments | |
86 | - */ | |
87 | - /* XXX Hmmm... */ | |
88 | -/* if (if_queued > IF_THRESH && towrite <= 0) { | |
89 | - * error = ENOBUFS; | |
90 | - * goto bad; | |
91 | - * } | |
92 | - */ | |
93 | - | |
94 | - /* | |
95 | 78 | * If small enough for interface, can just send directly. |
96 | 79 | */ |
97 | 80 | if ((u_int16_t)ip->ip_len <= IF_MTU) { |
... | ... | @@ -142,12 +125,6 @@ ip_output(struct socket *so, struct mbuf *m0) |
142 | 125 | mhip = mtod(m, struct ip *); |
143 | 126 | *mhip = *ip; |
144 | 127 | |
145 | - /* No options */ | |
146 | -/* if (hlen > sizeof (struct ip)) { | |
147 | - * mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip); | |
148 | - * mhip->ip_hl = mhlen >> 2; | |
149 | - * } | |
150 | - */ | |
151 | 128 | m->m_len = mhlen; |
152 | 129 | mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF); |
153 | 130 | if (ip->ip_off & IP_MF) | ... | ... |
slirp/libslirp.h
1 | 1 | #ifndef _LIBSLIRP_H |
2 | 2 | #define _LIBSLIRP_H |
3 | 3 | |
4 | -#ifdef __cplusplus | |
5 | -extern "C" { | |
6 | -#endif | |
7 | - | |
8 | 4 | #include <qemu-common.h> |
9 | 5 | |
10 | 6 | void slirp_init(int restricted, struct in_addr vnetwork, |
... | ... | @@ -37,8 +33,4 @@ void slirp_socket_recv(struct in_addr guest_addr, int guest_port, |
37 | 33 | const uint8_t *buf, int size); |
38 | 34 | size_t slirp_socket_can_recv(struct in_addr guest_addr, int guest_port); |
39 | 35 | |
40 | -#ifdef __cplusplus | |
41 | -} | |
42 | -#endif | |
43 | - | |
44 | 36 | #endif | ... | ... |
slirp/mbuf.c
... | ... | @@ -141,17 +141,11 @@ m_inc(struct mbuf *m, int size) |
141 | 141 | if (m->m_flags & M_EXT) { |
142 | 142 | datasize = m->m_data - m->m_ext; |
143 | 143 | m->m_ext = (char *)realloc(m->m_ext,size); |
144 | -/* if (m->m_ext == NULL) | |
145 | - * return (struct mbuf *)NULL; | |
146 | - */ | |
147 | 144 | m->m_data = m->m_ext + datasize; |
148 | 145 | } else { |
149 | 146 | char *dat; |
150 | 147 | datasize = m->m_data - m->m_dat; |
151 | 148 | dat = (char *)malloc(size); |
152 | -/* if (dat == NULL) | |
153 | - * return (struct mbuf *)NULL; | |
154 | - */ | |
155 | 149 | memcpy(dat, m->m_dat, m->m_size); |
156 | 150 | |
157 | 151 | m->m_ext = dat; | ... | ... |
slirp/mbuf.h
... | ... | @@ -41,10 +41,8 @@ |
41 | 41 | /* |
42 | 42 | * Macros for type conversion |
43 | 43 | * mtod(m,t) - convert mbuf pointer to data pointer of correct type |
44 | - * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX) | |
45 | 44 | */ |
46 | 45 | #define mtod(m,t) ((t)(m)->m_data) |
47 | -/* #define dtom(x) ((struct mbuf *)((int)(x) & ~(M_SIZE-1))) */ | |
48 | 46 | |
49 | 47 | /* XXX About mbufs for slirp: |
50 | 48 | * Only one mbuf is ever used in a chain, for each "cell" of data. | ... | ... |
slirp/misc.c
... | ... | @@ -12,62 +12,6 @@ |
12 | 12 | |
13 | 13 | u_int curtime, time_fasttimo, last_slowtimo; |
14 | 14 | |
15 | -#if 0 | |
16 | -int x_port = -1; | |
17 | -int x_display = 0; | |
18 | -int x_screen = 0; | |
19 | - | |
20 | -int | |
21 | -show_x(buff, inso) | |
22 | - char *buff; | |
23 | - struct socket *inso; | |
24 | -{ | |
25 | - if (x_port < 0) { | |
26 | - lprint("X Redir: X not being redirected.\r\n"); | |
27 | - } else { | |
28 | - lprint("X Redir: In sh/bash/zsh/etc. type: DISPLAY=%s:%d.%d; export DISPLAY\r\n", | |
29 | - inet_ntoa(our_addr), x_port, x_screen); | |
30 | - lprint("X Redir: In csh/tcsh/etc. type: setenv DISPLAY %s:%d.%d\r\n", | |
31 | - inet_ntoa(our_addr), x_port, x_screen); | |
32 | - if (x_display) | |
33 | - lprint("X Redir: Redirecting to display %d\r\n", x_display); | |
34 | - } | |
35 | - | |
36 | - return CFG_OK; | |
37 | -} | |
38 | - | |
39 | - | |
40 | -/* | |
41 | - * XXX Allow more than one X redirection? | |
42 | - */ | |
43 | -void | |
44 | -redir_x(inaddr, start_port, display, screen) | |
45 | - u_int32_t inaddr; | |
46 | - int start_port; | |
47 | - int display; | |
48 | - int screen; | |
49 | -{ | |
50 | - int i; | |
51 | - | |
52 | - if (x_port >= 0) { | |
53 | - lprint("X Redir: X already being redirected.\r\n"); | |
54 | - show_x(0, 0); | |
55 | - } else { | |
56 | - for (i = 6001 + (start_port-1); i <= 6100; i++) { | |
57 | - if (solisten(htons(i), inaddr, htons(6000 + display), 0)) { | |
58 | - /* Success */ | |
59 | - x_port = i - 6000; | |
60 | - x_display = display; | |
61 | - x_screen = screen; | |
62 | - show_x(0, 0); | |
63 | - return; | |
64 | - } | |
65 | - } | |
66 | - lprint("X Redir: Error: Couldn't redirect a port for X. Weird.\r\n"); | |
67 | - } | |
68 | -} | |
69 | -#endif | |
70 | - | |
71 | 15 | /* |
72 | 16 | * Get our IP address and put it in our_addr |
73 | 17 | */ |
... | ... | @@ -109,12 +53,8 @@ remque(void *a) |
109 | 53 | ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; |
110 | 54 | ((struct quehead *)(element->qh_rlink))->qh_link = element->qh_link; |
111 | 55 | element->qh_rlink = NULL; |
112 | - /* element->qh_link = NULL; TCP FIN1 crashes if you do this. Why ? */ | |
113 | 56 | } |
114 | 57 | |
115 | -/* #endif */ | |
116 | - | |
117 | - | |
118 | 58 | int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, |
119 | 59 | struct in_addr addr, int port) |
120 | 60 | { |
... | ... | @@ -170,73 +110,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
170 | 110 | |
171 | 111 | #else |
172 | 112 | |
173 | -#ifndef CONFIG_QEMU | |
174 | -int | |
175 | -slirp_openpty(amaster, aslave) | |
176 | - int *amaster, *aslave; | |
177 | -{ | |
178 | - register int master, slave; | |
179 | - | |
180 | -#ifdef HAVE_GRANTPT | |
181 | - char *ptr; | |
182 | - | |
183 | - if ((master = open("/dev/ptmx", O_RDWR)) < 0 || | |
184 | - grantpt(master) < 0 || | |
185 | - unlockpt(master) < 0 || | |
186 | - (ptr = ptsname(master)) == NULL) { | |
187 | - close(master); | |
188 | - return -1; | |
189 | - } | |
190 | - | |
191 | - if ((slave = open(ptr, O_RDWR)) < 0 || | |
192 | - ioctl(slave, I_PUSH, "ptem") < 0 || | |
193 | - ioctl(slave, I_PUSH, "ldterm") < 0 || | |
194 | - ioctl(slave, I_PUSH, "ttcompat") < 0) { | |
195 | - close(master); | |
196 | - close(slave); | |
197 | - return -1; | |
198 | - } | |
199 | - | |
200 | - *amaster = master; | |
201 | - *aslave = slave; | |
202 | - return 0; | |
203 | - | |
204 | -#else | |
205 | - | |
206 | - static char line[] = "/dev/ptyXX"; | |
207 | - register const char *cp1, *cp2; | |
208 | - | |
209 | - for (cp1 = "pqrsPQRS"; *cp1; cp1++) { | |
210 | - line[8] = *cp1; | |
211 | - for (cp2 = "0123456789abcdefghijklmnopqrstuv"; *cp2; cp2++) { | |
212 | - line[9] = *cp2; | |
213 | - if ((master = open(line, O_RDWR, 0)) == -1) { | |
214 | - if (errno == ENOENT) | |
215 | - return (-1); /* out of ptys */ | |
216 | - } else { | |
217 | - line[5] = 't'; | |
218 | - /* These will fail */ | |
219 | - (void) chown(line, getuid(), 0); | |
220 | - (void) chmod(line, S_IRUSR|S_IWUSR|S_IWGRP); | |
221 | -#ifdef HAVE_REVOKE | |
222 | - (void) revoke(line); | |
223 | -#endif | |
224 | - if ((slave = open(line, O_RDWR, 0)) != -1) { | |
225 | - *amaster = master; | |
226 | - *aslave = slave; | |
227 | - return 0; | |
228 | - } | |
229 | - (void) close(master); | |
230 | - line[5] = 'p'; | |
231 | - } | |
232 | - } | |
233 | - } | |
234 | - errno = ENOENT; /* out of ptys */ | |
235 | - return (-1); | |
236 | -#endif | |
237 | -} | |
238 | -#endif | |
239 | - | |
240 | 113 | /* |
241 | 114 | * XXX This is ugly |
242 | 115 | * We create and bind a socket, then fork off to another |
... | ... | @@ -257,9 +130,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
257 | 130 | int opt; |
258 | 131 | int master = -1; |
259 | 132 | const char *argv[256]; |
260 | -#if 0 | |
261 | - char buff[256]; | |
262 | -#endif | |
263 | 133 | /* don't want to clobber the original */ |
264 | 134 | char *bptr; |
265 | 135 | const char *curarg; |
... | ... | @@ -271,14 +141,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
271 | 141 | DEBUG_ARG("do_pty = %lx", (long)do_pty); |
272 | 142 | |
273 | 143 | if (do_pty == 2) { |
274 | -#if 0 | |
275 | - if (slirp_openpty(&master, &s) == -1) { | |
276 | - lprint("Error: openpty failed: %s\n", strerror(errno)); | |
277 | - return 0; | |
278 | - } | |
279 | -#else | |
280 | 144 | return 0; |
281 | -#endif | |
282 | 145 | } else { |
283 | 146 | addr.sin_family = AF_INET; |
284 | 147 | addr.sin_port = 0; |
... | ... | @@ -324,17 +187,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
324 | 187 | } while (ret < 0 && errno == EINTR); |
325 | 188 | } |
326 | 189 | |
327 | -#if 0 | |
328 | - if (x_port >= 0) { | |
329 | -#ifdef HAVE_SETENV | |
330 | - sprintf(buff, "%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); | |
331 | - setenv("DISPLAY", buff, 1); | |
332 | -#else | |
333 | - sprintf(buff, "DISPLAY=%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); | |
334 | - putenv(buff); | |
335 | -#endif | |
336 | - } | |
337 | -#endif | |
338 | 190 | dup2(s, 0); |
339 | 191 | dup2(s, 1); |
340 | 192 | dup2(s, 2); |
... | ... | @@ -422,137 +274,6 @@ strdup(str) |
422 | 274 | } |
423 | 275 | #endif |
424 | 276 | |
425 | -#if 0 | |
426 | -void | |
427 | -snooze_hup(num) | |
428 | - int num; | |
429 | -{ | |
430 | - int s, ret; | |
431 | -#ifndef NO_UNIX_SOCKETS | |
432 | - struct sockaddr_un sock_un; | |
433 | -#endif | |
434 | - struct sockaddr_in sock_in; | |
435 | - char buff[256]; | |
436 | - | |
437 | - ret = -1; | |
438 | - if (slirp_socket_passwd) { | |
439 | - s = socket(AF_INET, SOCK_STREAM, 0); | |
440 | - if (s < 0) | |
441 | - slirp_exit(1); | |
442 | - sock_in.sin_family = AF_INET; | |
443 | - sock_in.sin_addr.s_addr = slirp_socket_addr; | |
444 | - sock_in.sin_port = htons(slirp_socket_port); | |
445 | - if (connect(s, (struct sockaddr *)&sock_in, sizeof(sock_in)) != 0) | |
446 | - slirp_exit(1); /* just exit...*/ | |
447 | - sprintf(buff, "kill %s:%d", slirp_socket_passwd, slirp_socket_unit); | |
448 | - write(s, buff, strlen(buff)+1); | |
449 | - } | |
450 | -#ifndef NO_UNIX_SOCKETS | |
451 | - else { | |
452 | - s = socket(AF_UNIX, SOCK_STREAM, 0); | |
453 | - if (s < 0) | |
454 | - slirp_exit(1); | |
455 | - sock_un.sun_family = AF_UNIX; | |
456 | - strcpy(sock_un.sun_path, socket_path); | |
457 | - if (connect(s, (struct sockaddr *)&sock_un, | |
458 | - sizeof(sock_un.sun_family) + sizeof(sock_un.sun_path)) != 0) | |
459 | - slirp_exit(1); | |
460 | - sprintf(buff, "kill none:%d", slirp_socket_unit); | |
461 | - write(s, buff, strlen(buff)+1); | |
462 | - } | |
463 | -#endif | |
464 | - slirp_exit(0); | |
465 | -} | |
466 | - | |
467 | - | |
468 | -void | |
469 | -snooze() | |
470 | -{ | |
471 | - sigset_t s; | |
472 | - int i; | |
473 | - | |
474 | - /* Don't need our data anymore */ | |
475 | - /* XXX This makes SunOS barf */ | |
476 | -/* brk(0); */ | |
477 | - | |
478 | - /* Close all fd's */ | |
479 | - for (i = 255; i >= 0; i--) | |
480 | - close(i); | |
481 | - | |
482 | - signal(SIGQUIT, slirp_exit); | |
483 | - signal(SIGHUP, snooze_hup); | |
484 | - sigemptyset(&s); | |
485 | - | |
486 | - /* Wait for any signal */ | |
487 | - sigsuspend(&s); | |
488 | - | |
489 | - /* Just in case ... */ | |
490 | - exit(255); | |
491 | -} | |
492 | - | |
493 | -void | |
494 | -relay(s) | |
495 | - int s; | |
496 | -{ | |
497 | - char buf[8192]; | |
498 | - int n; | |
499 | - fd_set readfds; | |
500 | - struct ttys *ttyp; | |
501 | - | |
502 | - /* Don't need our data anymore */ | |
503 | - /* XXX This makes SunOS barf */ | |
504 | -/* brk(0); */ | |
505 | - | |
506 | - signal(SIGQUIT, slirp_exit); | |
507 | - signal(SIGHUP, slirp_exit); | |
508 | - signal(SIGINT, slirp_exit); | |
509 | - signal(SIGTERM, slirp_exit); | |
510 | - | |
511 | - /* Fudge to get term_raw and term_restore to work */ | |
512 | - if (NULL == (ttyp = tty_attach (0, slirp_tty))) { | |
513 | - lprint ("Error: tty_attach failed in misc.c:relay()\r\n"); | |
514 | - slirp_exit (1); | |
515 | - } | |
516 | - ttyp->fd = 0; | |
517 | - ttyp->flags |= TTY_CTTY; | |
518 | - term_raw(ttyp); | |
519 | - | |
520 | - while (1) { | |
521 | - FD_ZERO(&readfds); | |
522 | - | |
523 | - FD_SET(0, &readfds); | |
524 | - FD_SET(s, &readfds); | |
525 | - | |
526 | - n = select(s+1, &readfds, (fd_set *)0, (fd_set *)0, (struct timeval *)0); | |
527 | - | |
528 | - if (n <= 0) | |
529 | - slirp_exit(0); | |
530 | - | |
531 | - if (FD_ISSET(0, &readfds)) { | |
532 | - n = read(0, buf, 8192); | |
533 | - if (n <= 0) | |
534 | - slirp_exit(0); | |
535 | - n = writen(s, buf, n); | |
536 | - if (n <= 0) | |
537 | - slirp_exit(0); | |
538 | - } | |
539 | - | |
540 | - if (FD_ISSET(s, &readfds)) { | |
541 | - n = read(s, buf, 8192); | |
542 | - if (n <= 0) | |
543 | - slirp_exit(0); | |
544 | - n = writen(0, buf, n); | |
545 | - if (n <= 0) | |
546 | - slirp_exit(0); | |
547 | - } | |
548 | - } | |
549 | - | |
550 | - /* Just in case.... */ | |
551 | - exit(1); | |
552 | -} | |
553 | -#endif | |
554 | - | |
555 | -#ifdef CONFIG_QEMU | |
556 | 277 | #include "monitor.h" |
557 | 278 | |
558 | 279 | void lprint(const char *format, ...) |
... | ... | @@ -563,159 +284,6 @@ void lprint(const char *format, ...) |
563 | 284 | monitor_vprintf(cur_mon, format, args); |
564 | 285 | va_end(args); |
565 | 286 | } |
566 | -#else | |
567 | -int (*lprint_print) _P((void *, const char *, va_list)); | |
568 | -char *lprint_ptr, *lprint_ptr2, **lprint_arg; | |
569 | - | |
570 | -void | |
571 | -#ifdef __STDC__ | |
572 | -lprint(const char *format, ...) | |
573 | -#else | |
574 | -lprint(va_alist) va_dcl | |
575 | -#endif | |
576 | -{ | |
577 | - va_list args; | |
578 | - | |
579 | -#ifdef __STDC__ | |
580 | - va_start(args, format); | |
581 | -#else | |
582 | - char *format; | |
583 | - va_start(args); | |
584 | - format = va_arg(args, char *); | |
585 | -#endif | |
586 | -#if 0 | |
587 | - /* If we're printing to an sbuf, make sure there's enough room */ | |
588 | - /* XXX +100? */ | |
589 | - if (lprint_sb) { | |
590 | - if ((lprint_ptr - lprint_sb->sb_wptr) >= | |
591 | - (lprint_sb->sb_datalen - (strlen(format) + 100))) { | |
592 | - int deltaw = lprint_sb->sb_wptr - lprint_sb->sb_data; | |
593 | - int deltar = lprint_sb->sb_rptr - lprint_sb->sb_data; | |
594 | - int deltap = lprint_ptr - lprint_sb->sb_data; | |
595 | - | |
596 | - lprint_sb->sb_data = (char *)realloc(lprint_sb->sb_data, | |
597 | - lprint_sb->sb_datalen + TCP_SNDSPACE); | |
598 | - | |
599 | - /* Adjust all values */ | |
600 | - lprint_sb->sb_wptr = lprint_sb->sb_data + deltaw; | |
601 | - lprint_sb->sb_rptr = lprint_sb->sb_data + deltar; | |
602 | - lprint_ptr = lprint_sb->sb_data + deltap; | |
603 | - | |
604 | - lprint_sb->sb_datalen += TCP_SNDSPACE; | |
605 | - } | |
606 | - } | |
607 | -#endif | |
608 | - if (lprint_print) | |
609 | - lprint_ptr += (*lprint_print)(*lprint_arg, format, args); | |
610 | - | |
611 | - /* Check if they want output to be logged to file as well */ | |
612 | - if (lfd) { | |
613 | - /* | |
614 | - * Remove \r's | |
615 | - * otherwise you'll get ^M all over the file | |
616 | - */ | |
617 | - int len = strlen(format); | |
618 | - char *bptr1, *bptr2; | |
619 | - | |
620 | - bptr1 = bptr2 = strdup(format); | |
621 | - | |
622 | - while (len--) { | |
623 | - if (*bptr1 == '\r') | |
624 | - memcpy(bptr1, bptr1+1, len+1); | |
625 | - else | |
626 | - bptr1++; | |
627 | - } | |
628 | - vfprintf(lfd, bptr2, args); | |
629 | - free(bptr2); | |
630 | - } | |
631 | - va_end(args); | |
632 | -} | |
633 | - | |
634 | -void | |
635 | -add_emu(buff) | |
636 | - char *buff; | |
637 | -{ | |
638 | - u_int lport, fport; | |
639 | - u_int8_t tos = 0, emu = 0; | |
640 | - char buff1[256], buff2[256], buff4[128]; | |
641 | - char *buff3 = buff4; | |
642 | - struct emu_t *emup; | |
643 | - struct socket *so; | |
644 | - | |
645 | - if (sscanf(buff, "%256s %256s", buff2, buff1) != 2) { | |
646 | - lprint("Error: Bad arguments\r\n"); | |
647 | - return; | |
648 | - } | |
649 | - | |
650 | - if (sscanf(buff1, "%d:%d", &lport, &fport) != 2) { | |
651 | - lport = 0; | |
652 | - if (sscanf(buff1, "%d", &fport) != 1) { | |
653 | - lprint("Error: Bad first argument\r\n"); | |
654 | - return; | |
655 | - } | |
656 | - } | |
657 | - | |
658 | - if (sscanf(buff2, "%128[^:]:%128s", buff1, buff3) != 2) { | |
659 | - buff3 = 0; | |
660 | - if (sscanf(buff2, "%256s", buff1) != 1) { | |
661 | - lprint("Error: Bad second argument\r\n"); | |
662 | - return; | |
663 | - } | |
664 | - } | |
665 | - | |
666 | - if (buff3) { | |
667 | - if (strcmp(buff3, "lowdelay") == 0) | |
668 | - tos = IPTOS_LOWDELAY; | |
669 | - else if (strcmp(buff3, "throughput") == 0) | |
670 | - tos = IPTOS_THROUGHPUT; | |
671 | - else { | |
672 | - lprint("Error: Expecting \"lowdelay\"/\"throughput\"\r\n"); | |
673 | - return; | |
674 | - } | |
675 | - } | |
676 | - | |
677 | - if (strcmp(buff1, "ftp") == 0) | |
678 | - emu = EMU_FTP; | |
679 | - else if (strcmp(buff1, "irc") == 0) | |
680 | - emu = EMU_IRC; | |
681 | - else if (strcmp(buff1, "none") == 0) | |
682 | - emu = EMU_NONE; /* ie: no emulation */ | |
683 | - else { | |
684 | - lprint("Error: Unknown service\r\n"); | |
685 | - return; | |
686 | - } | |
687 | - | |
688 | - /* First, check that it isn't already emulated */ | |
689 | - for (emup = tcpemu; emup; emup = emup->next) { | |
690 | - if (emup->lport == lport && emup->fport == fport) { | |
691 | - lprint("Error: port already emulated\r\n"); | |
692 | - return; | |
693 | - } | |
694 | - } | |
695 | - | |
696 | - /* link it */ | |
697 | - emup = (struct emu_t *)malloc(sizeof (struct emu_t)); | |
698 | - emup->lport = (u_int16_t)lport; | |
699 | - emup->fport = (u_int16_t)fport; | |
700 | - emup->tos = tos; | |
701 | - emup->emu = emu; | |
702 | - emup->next = tcpemu; | |
703 | - tcpemu = emup; | |
704 | - | |
705 | - /* And finally, mark all current sessions, if any, as being emulated */ | |
706 | - for (so = tcb.so_next; so != &tcb; so = so->so_next) { | |
707 | - if ((lport && lport == ntohs(so->so_lport)) || | |
708 | - (fport && fport == ntohs(so->so_fport))) { | |
709 | - if (emu) | |
710 | - so->so_emu = emu; | |
711 | - if (tos) | |
712 | - so->so_iptos = tos; | |
713 | - } | |
714 | - } | |
715 | - | |
716 | - lprint("Adding emulation for %s to port %d/%d\r\n", buff1, emup->lport, emup->fport); | |
717 | -} | |
718 | -#endif | |
719 | 287 | |
720 | 288 | #ifdef BAD_SPRINTF |
721 | 289 | |
... | ... | @@ -817,99 +385,6 @@ fd_block(int fd) |
817 | 385 | #endif |
818 | 386 | } |
819 | 387 | |
820 | - | |
821 | -#if 0 | |
822 | -/* | |
823 | - * invoke RSH | |
824 | - */ | |
825 | -int | |
826 | -rsh_exec(so,ns, user, host, args) | |
827 | - struct socket *so; | |
828 | - struct socket *ns; | |
829 | - char *user; | |
830 | - char *host; | |
831 | - char *args; | |
832 | -{ | |
833 | - int fd[2]; | |
834 | - int fd0[2]; | |
835 | - int s; | |
836 | - char buff[256]; | |
837 | - | |
838 | - DEBUG_CALL("rsh_exec"); | |
839 | - DEBUG_ARG("so = %lx", (long)so); | |
840 | - | |
841 | - if (pipe(fd)<0) { | |
842 | - lprint("Error: pipe failed: %s\n", strerror(errno)); | |
843 | - return 0; | |
844 | - } | |
845 | -/* #ifdef HAVE_SOCKETPAIR */ | |
846 | -#if 1 | |
847 | - if (socketpair(PF_UNIX,SOCK_STREAM,0, fd0) == -1) { | |
848 | - close(fd[0]); | |
849 | - close(fd[1]); | |
850 | - lprint("Error: openpty failed: %s\n", strerror(errno)); | |
851 | - return 0; | |
852 | - } | |
853 | -#else | |
854 | - if (slirp_openpty(&fd0[0], &fd0[1]) == -1) { | |
855 | - close(fd[0]); | |
856 | - close(fd[1]); | |
857 | - lprint("Error: openpty failed: %s\n", strerror(errno)); | |
858 | - return 0; | |
859 | - } | |
860 | -#endif | |
861 | - | |
862 | - switch(fork()) { | |
863 | - case -1: | |
864 | - lprint("Error: fork failed: %s\n", strerror(errno)); | |
865 | - close(fd[0]); | |
866 | - close(fd[1]); | |
867 | - close(fd0[0]); | |
868 | - close(fd0[1]); | |
869 | - return 0; | |
870 | - | |
871 | - case 0: | |
872 | - close(fd[0]); | |
873 | - close(fd0[0]); | |
874 | - | |
875 | - /* Set the DISPLAY */ | |
876 | - if (x_port >= 0) { | |
877 | -#ifdef HAVE_SETENV | |
878 | - sprintf(buff, "%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); | |
879 | - setenv("DISPLAY", buff, 1); | |
880 | -#else | |
881 | - sprintf(buff, "DISPLAY=%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); | |
882 | - putenv(buff); | |
883 | -#endif | |
884 | - } | |
885 | - | |
886 | - dup2(fd0[1], 0); | |
887 | - dup2(fd0[1], 1); | |
888 | - dup2(fd[1], 2); | |
889 | - for (s = 3; s <= 255; s++) | |
890 | - close(s); | |
891 | - | |
892 | - execlp("rsh","rsh","-l", user, host, args, NULL); | |
893 | - | |
894 | - /* Ooops, failed, let's tell the user why */ | |
895 | - | |
896 | - sprintf(buff, "Error: execlp of %s failed: %s\n", | |
897 | - "rsh", strerror(errno)); | |
898 | - write(2, buff, strlen(buff)+1); | |
899 | - close(0); close(1); close(2); /* XXX */ | |
900 | - exit(1); | |
901 | - | |
902 | - default: | |
903 | - close(fd[1]); | |
904 | - close(fd0[1]); | |
905 | - ns->s=fd[0]; | |
906 | - so->s=fd0[0]; | |
907 | - | |
908 | - return 1; | |
909 | - } | |
910 | -} | |
911 | -#endif | |
912 | - | |
913 | 388 | void slirp_connection_info(Monitor *mon) |
914 | 389 | { |
915 | 390 | const char * const tcpstates[] = { | ... | ... |
slirp/misc.h
... | ... | @@ -19,10 +19,6 @@ struct ex_list { |
19 | 19 | extern struct ex_list *exec_list; |
20 | 20 | extern u_int time_fasttimo, last_slowtimo; |
21 | 21 | |
22 | -extern int (*lprint_print) _P((void *, const char *, va_list)); | |
23 | -extern char *lprint_ptr, *lprint_ptr2, **lprint_arg; | |
24 | -extern struct sbuf *lprint_sb; | |
25 | - | |
26 | 22 | #ifndef HAVE_STRDUP |
27 | 23 | char *strdup _P((const char *)); |
28 | 24 | #endif |
... | ... | @@ -63,10 +59,6 @@ struct emu_t { |
63 | 59 | struct emu_t *next; |
64 | 60 | }; |
65 | 61 | |
66 | -#ifndef CONFIG_QEMU | |
67 | -extern struct emu_t *tcpemu; | |
68 | -#endif | |
69 | - | |
70 | 62 | extern int x_port, x_server, x_display; |
71 | 63 | |
72 | 64 | int show_x _P((char *, struct socket *)); | ... | ... |
slirp/sbuf.c
... | ... | @@ -9,14 +9,6 @@ |
9 | 9 | |
10 | 10 | static void sbappendsb(struct sbuf *sb, struct mbuf *m); |
11 | 11 | |
12 | -/* Done as a macro in socket.h */ | |
13 | -/* int | |
14 | - * sbspace(struct sockbuff *sb) | |
15 | - * { | |
16 | - * return SB_DATALEN - sb->sb_cc; | |
17 | - * } | |
18 | - */ | |
19 | - | |
20 | 12 | void |
21 | 13 | sbfree(struct sbuf *sb) |
22 | 14 | { | ... | ... |
slirp/slirp.c
... | ... | @@ -55,7 +55,6 @@ int slirp_restrict; |
55 | 55 | static int do_slowtimo; |
56 | 56 | int link_up; |
57 | 57 | struct timeval tt; |
58 | -FILE *lfd; | |
59 | 58 | struct ex_list *exec_list; |
60 | 59 | |
61 | 60 | /* XXX: suppress those select globals */ |
... | ... | @@ -96,16 +95,6 @@ static int get_dns_addr(struct in_addr *pdns_addr) |
96 | 95 | pIPAddr = &(FixedInfo->DnsServerList); |
97 | 96 | inet_aton(pIPAddr->IpAddress.String, &tmp_addr); |
98 | 97 | *pdns_addr = tmp_addr; |
99 | -#if 0 | |
100 | - printf( "DNS Servers:\n" ); | |
101 | - printf( "DNS Addr:%s\n", pIPAddr->IpAddress.String ); | |
102 | - | |
103 | - pIPAddr = FixedInfo -> DnsServerList.Next; | |
104 | - while ( pIPAddr ) { | |
105 | - printf( "DNS Addr:%s\n", pIPAddr ->IpAddress.String ); | |
106 | - pIPAddr = pIPAddr ->Next; | |
107 | - } | |
108 | -#endif | |
109 | 98 | if (FixedInfo) { |
110 | 99 | GlobalFree(FixedInfo); |
111 | 100 | FixedInfo = NULL; |
... | ... | @@ -179,8 +168,6 @@ void slirp_init(int restricted, struct in_addr vnetwork, |
179 | 168 | const char *bootfile, struct in_addr vdhcp_start, |
180 | 169 | struct in_addr vnameserver) |
181 | 170 | { |
182 | - // debug_init("/tmp/slirp.log", DEBUG_DEFAULT); | |
183 | - | |
184 | 171 | #ifdef _WIN32 |
185 | 172 | WSADATA Data; |
186 | 173 | ... | ... |
slirp/slirp.h
1 | 1 | #ifndef __COMMON_H__ |
2 | 2 | #define __COMMON_H__ |
3 | 3 | |
4 | -#define CONFIG_QEMU | |
5 | - | |
6 | 4 | //#define DEBUG 1 |
7 | 5 | |
8 | 6 | // Uncomment the following line to enable SLIRP statistics printing in Qemu |
... | ... | @@ -14,9 +12,6 @@ |
14 | 12 | #define STAT(expr) do { } while(0) |
15 | 13 | #endif |
16 | 14 | |
17 | -#ifndef CONFIG_QEMU | |
18 | -#include "version.h" | |
19 | -#endif | |
20 | 15 | #include "config-host.h" |
21 | 16 | #include "slirp_config.h" |
22 | 17 | |
... | ... | @@ -223,8 +218,6 @@ int inet_aton _P((const char *cp, struct in_addr *ia)); |
223 | 218 | #include "tftp.h" |
224 | 219 | #include "libslirp.h" |
225 | 220 | |
226 | -extern struct ttys *ttys_unit[MAX_INTERFACES]; | |
227 | - | |
228 | 221 | #ifndef NULL |
229 | 222 | #define NULL (void *)0 |
230 | 223 | #endif | ... | ... |
slirp/socket.c
... | ... | @@ -15,14 +15,6 @@ |
15 | 15 | static void sofcantrcvmore(struct socket *so); |
16 | 16 | static void sofcantsendmore(struct socket *so); |
17 | 17 | |
18 | -#if 0 | |
19 | -static void | |
20 | -so_init() | |
21 | -{ | |
22 | - /* Nothing yet */ | |
23 | -} | |
24 | -#endif | |
25 | - | |
26 | 18 | struct socket * |
27 | 19 | solookup(struct socket *head, struct in_addr laddr, u_int lport, |
28 | 20 | struct in_addr faddr, u_int fport) |
... | ... | @@ -526,12 +518,6 @@ sorecvfrom(struct socket *so) |
526 | 518 | so->so_expire = curtime + SO_EXPIRE; |
527 | 519 | } |
528 | 520 | |
529 | - /* if (m->m_len == len) { | |
530 | - * m_inc(m, MINCSIZE); | |
531 | - * m->m_len = 0; | |
532 | - * } | |
533 | - */ | |
534 | - | |
535 | 521 | /* |
536 | 522 | * If this packet was destined for CTL_ADDR, |
537 | 523 | * make it look like that's where it came from, done by udp_output |
... | ... | @@ -604,7 +590,6 @@ tcp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, int flags |
604 | 590 | DEBUG_ARG("flags = %x", flags); |
605 | 591 | |
606 | 592 | if ((so = socreate()) == NULL) { |
607 | - /* free(so); Not sofree() ??? free(NULL) == NOP */ | |
608 | 593 | return NULL; |
609 | 594 | } |
610 | 595 | |
... | ... | @@ -659,33 +644,6 @@ tcp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, int flags |
659 | 644 | return so; |
660 | 645 | } |
661 | 646 | |
662 | -#if 0 | |
663 | -/* | |
664 | - * Data is available in so_rcv | |
665 | - * Just write() the data to the socket | |
666 | - * XXX not yet... | |
667 | - */ | |
668 | -static void | |
669 | -sorwakeup(so) | |
670 | - struct socket *so; | |
671 | -{ | |
672 | -/* sowrite(so); */ | |
673 | -/* FD_CLR(so->s,&writefds); */ | |
674 | -} | |
675 | - | |
676 | -/* | |
677 | - * Data has been freed in so_snd | |
678 | - * We have room for a read() if we want to | |
679 | - * For now, don't read, it'll be done in the main loop | |
680 | - */ | |
681 | -static void | |
682 | -sowwakeup(so) | |
683 | - struct socket *so; | |
684 | -{ | |
685 | - /* Nothing, yet */ | |
686 | -} | |
687 | -#endif | |
688 | - | |
689 | 647 | /* |
690 | 648 | * Various session state calls |
691 | 649 | * XXX Should be #define's |
... | ... | @@ -746,17 +704,6 @@ sofcantsendmore(struct socket *so) |
746 | 704 | } |
747 | 705 | } |
748 | 706 | |
749 | -void | |
750 | -soisfdisconnected(struct socket *so) | |
751 | -{ | |
752 | -/* so->so_state &= ~(SS_ISFCONNECTING|SS_ISFCONNECTED); */ | |
753 | -/* close(so->s); */ | |
754 | -/* so->so_state = SS_ISFDISCONNECTED; */ | |
755 | - /* | |
756 | - * XXX Do nothing ... ? | |
757 | - */ | |
758 | -} | |
759 | - | |
760 | 707 | /* |
761 | 708 | * Set write drain mode |
762 | 709 | * Set CANTSENDMORE once all data has been write()n | ... | ... |
slirp/socket.h
... | ... | @@ -5,8 +5,6 @@ |
5 | 5 | * terms and conditions of the copyright. |
6 | 6 | */ |
7 | 7 | |
8 | -/* MINE */ | |
9 | - | |
10 | 8 | #ifndef _SLIRP_SOCKET_H_ |
11 | 9 | #define _SLIRP_SOCKET_H_ |
12 | 10 | |
... | ... | @@ -64,7 +62,6 @@ struct socket { |
64 | 62 | #define SS_ISFCONNECTED 0x004 /* Socket is connected to peer */ |
65 | 63 | #define SS_FCANTRCVMORE 0x008 /* Socket can't receive more from peer (for half-closes) */ |
66 | 64 | #define SS_FCANTSENDMORE 0x010 /* Socket can't send more to peer (for half-closes) */ |
67 | -/* #define SS_ISFDISCONNECTED 0x020*/ /* Socket has disconnected from peer, in 2MSL state */ | |
68 | 65 | #define SS_FWDRAIN 0x040 /* We received a FIN, drain data and set SS_FCANTSENDMORE */ |
69 | 66 | |
70 | 67 | #define SS_CTL 0x080 |
... | ... | @@ -89,7 +86,6 @@ int sosendto _P((struct socket *, struct mbuf *)); |
89 | 86 | struct socket * tcp_listen _P((u_int32_t, u_int, u_int32_t, u_int, int)); |
90 | 87 | void soisfconnecting _P((register struct socket *)); |
91 | 88 | void soisfconnected _P((register struct socket *)); |
92 | -void soisfdisconnected _P((struct socket *)); | |
93 | 89 | void sofwdrain _P((struct socket *)); |
94 | 90 | struct iovec; /* For win32 */ |
95 | 91 | size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np); | ... | ... |
slirp/tcp.h
... | ... | @@ -113,7 +113,6 @@ struct tcphdr { |
113 | 113 | #undef TCP_NODELAY |
114 | 114 | #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ |
115 | 115 | #undef TCP_MAXSEG |
116 | -/* #define TCP_MAXSEG 0x02 */ /* set maximum segment size */ | |
117 | 116 | |
118 | 117 | /* |
119 | 118 | * TCP FSM state definitions. | ... | ... |
slirp/tcp_input.c
... | ... | @@ -81,7 +81,6 @@ tcp_seq tcp_iss; /* tcp initial send seq # */ |
81 | 81 | if (tcp_emu((so),(m))) sbappend((so), (m)); \ |
82 | 82 | } else \ |
83 | 83 | sbappend((so), (m)); \ |
84 | -/* sorwakeup(so); */ \ | |
85 | 84 | } else {\ |
86 | 85 | (flags) = tcp_reass((tp), (ti), (m)); \ |
87 | 86 | tp->t_flags |= TF_ACKNOW; \ |
... | ... | @@ -101,7 +100,6 @@ tcp_seq tcp_iss; /* tcp initial send seq # */ |
101 | 100 | if (tcp_emu((so),(m))) sbappend(so, (m)); \ |
102 | 101 | } else \ |
103 | 102 | sbappend((so), (m)); \ |
104 | -/* sorwakeup(so); */ \ | |
105 | 103 | } else { \ |
106 | 104 | (flags) = tcp_reass((tp), (ti), (m)); \ |
107 | 105 | tp->t_flags |= TF_ACKNOW; \ |
... | ... | @@ -211,7 +209,6 @@ present: |
211 | 209 | remque(tcpiphdr2qlink(ti)); |
212 | 210 | m = ti->ti_mbuf; |
213 | 211 | ti = tcpiphdr_next(ti); |
214 | -/* if (so->so_state & SS_FCANTRCVMORE) */ | |
215 | 212 | if (so->so_state & SS_FCANTSENDMORE) |
216 | 213 | m_freem(m); |
217 | 214 | else { |
... | ... | @@ -221,7 +218,6 @@ present: |
221 | 218 | sbappend(so, m); |
222 | 219 | } |
223 | 220 | } while (ti != (struct tcpiphdr *)tp && ti->ti_seq == tp->rcv_nxt); |
224 | -/* sorwakeup(so); */ | |
225 | 221 | return (flags); |
226 | 222 | } |
227 | 223 | |
... | ... | @@ -241,11 +237,9 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso) |
241 | 237 | register int tiflags; |
242 | 238 | struct socket *so = NULL; |
243 | 239 | int todrop, acked, ourfinisacked, needoutput = 0; |
244 | -/* int dropsocket = 0; */ | |
245 | 240 | int iss = 0; |
246 | 241 | u_long tiwin; |
247 | 242 | int ret; |
248 | -/* int ts_present = 0; */ | |
249 | 243 | struct ex_list *ex_ptr; |
250 | 244 | |
251 | 245 | DEBUG_CALL("tcp_input"); |
... | ... | @@ -300,9 +294,6 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso) |
300 | 294 | ti->ti_x1 = 0; |
301 | 295 | ti->ti_len = htons((u_int16_t)tlen); |
302 | 296 | len = sizeof(struct ip ) + tlen; |
303 | - /* keep checksum for ICMP reply | |
304 | - * ti->ti_sum = cksum(m, len); | |
305 | - * if (ti->ti_sum) { */ | |
306 | 297 | if(cksum(m, len)) { |
307 | 298 | STAT(tcpstat.tcps_rcvbadsum++); |
308 | 299 | goto drop; |
... | ... | @@ -322,25 +313,6 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso) |
322 | 313 | if (off > sizeof (struct tcphdr)) { |
323 | 314 | optlen = off - sizeof (struct tcphdr); |
324 | 315 | optp = mtod(m, caddr_t) + sizeof (struct tcpiphdr); |
325 | - | |
326 | - /* | |
327 | - * Do quick retrieval of timestamp options ("options | |
328 | - * prediction?"). If timestamp is the only option and it's | |
329 | - * formatted as recommended in RFC 1323 appendix A, we | |
330 | - * quickly get the values now and not bother calling | |
331 | - * tcp_dooptions(), etc. | |
332 | - */ | |
333 | -/* if ((optlen == TCPOLEN_TSTAMP_APPA || | |
334 | - * (optlen > TCPOLEN_TSTAMP_APPA && | |
335 | - * optp[TCPOLEN_TSTAMP_APPA] == TCPOPT_EOL)) && | |
336 | - * *(u_int32_t *)optp == htonl(TCPOPT_TSTAMP_HDR) && | |
337 | - * (ti->ti_flags & TH_SYN) == 0) { | |
338 | - * ts_present = 1; | |
339 | - * ts_val = ntohl(*(u_int32_t *)(optp + 4)); | |
340 | - * ts_ecr = ntohl(*(u_int32_t *)(optp + 8)); | |
341 | - * optp = NULL; / * we've parsed the options * / | |
342 | - * } | |
343 | - */ | |
344 | 316 | } |
345 | 317 | tiflags = ti->ti_flags; |
346 | 318 | |
... | ... | @@ -411,9 +383,6 @@ findso: |
411 | 383 | sbreserve(&so->so_snd, TCP_SNDSPACE); |
412 | 384 | sbreserve(&so->so_rcv, TCP_RCVSPACE); |
413 | 385 | |
414 | - /* tcp_last_so = so; */ /* XXX ? */ | |
415 | - /* tp = sototcpcb(so); */ | |
416 | - | |
417 | 386 | so->so_laddr = ti->ti_src; |
418 | 387 | so->so_lport = ti->ti_sport; |
419 | 388 | so->so_faddr = ti->ti_dst; |
... | ... | @@ -442,12 +411,7 @@ findso: |
442 | 411 | if (tp->t_state == TCPS_CLOSED) |
443 | 412 | goto drop; |
444 | 413 | |
445 | - /* Unscale the window into a 32-bit value. */ | |
446 | -/* if ((tiflags & TH_SYN) == 0) | |
447 | - * tiwin = ti->ti_win << tp->snd_scale; | |
448 | - * else | |
449 | - */ | |
450 | - tiwin = ti->ti_win; | |
414 | + tiwin = ti->ti_win; | |
451 | 415 | |
452 | 416 | /* |
453 | 417 | * Segment received on connection. |
... | ... | @@ -465,8 +429,6 @@ findso: |
465 | 429 | */ |
466 | 430 | if (optp && tp->t_state != TCPS_LISTEN) |
467 | 431 | tcp_dooptions(tp, (u_char *)optp, optlen, ti); |
468 | -/* , */ | |
469 | -/* &ts_present, &ts_val, &ts_ecr); */ | |
470 | 432 | |
471 | 433 | /* |
472 | 434 | * Header prediction: check for the two common cases |
... | ... | @@ -488,20 +450,9 @@ findso: |
488 | 450 | */ |
489 | 451 | if (tp->t_state == TCPS_ESTABLISHED && |
490 | 452 | (tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) == TH_ACK && |
491 | -/* (!ts_present || TSTMP_GEQ(ts_val, tp->ts_recent)) && */ | |
492 | 453 | ti->ti_seq == tp->rcv_nxt && |
493 | 454 | tiwin && tiwin == tp->snd_wnd && |
494 | 455 | tp->snd_nxt == tp->snd_max) { |
495 | - /* | |
496 | - * If last ACK falls within this segment's sequence numbers, | |
497 | - * record the timestamp. | |
498 | - */ | |
499 | -/* if (ts_present && SEQ_LEQ(ti->ti_seq, tp->last_ack_sent) && | |
500 | - * SEQ_LT(tp->last_ack_sent, ti->ti_seq + ti->ti_len)) { | |
501 | - * tp->ts_recent_age = tcp_now; | |
502 | - * tp->ts_recent = ts_val; | |
503 | - * } | |
504 | - */ | |
505 | 456 | if (ti->ti_len == 0) { |
506 | 457 | if (SEQ_GT(ti->ti_ack, tp->snd_una) && |
507 | 458 | SEQ_LEQ(ti->ti_ack, tp->snd_max) && |
... | ... | @@ -510,11 +461,8 @@ findso: |
510 | 461 | * this is a pure ack for outstanding data. |
511 | 462 | */ |
512 | 463 | STAT(tcpstat.tcps_predack++); |
513 | -/* if (ts_present) | |
514 | - * tcp_xmit_timer(tp, tcp_now-ts_ecr+1); | |
515 | - * else | |
516 | - */ if (tp->t_rtt && | |
517 | - SEQ_GT(ti->ti_ack, tp->t_rtseq)) | |
464 | + if (tp->t_rtt && | |
465 | + SEQ_GT(ti->ti_ack, tp->t_rtseq)) | |
518 | 466 | tcp_xmit_timer(tp, tp->t_rtt); |
519 | 467 | acked = ti->ti_ack - tp->snd_una; |
520 | 468 | STAT(tcpstat.tcps_rcvackpack++); |
... | ... | @@ -538,13 +486,6 @@ findso: |
538 | 486 | tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; |
539 | 487 | |
540 | 488 | /* |
541 | - * There's room in so_snd, sowwakup will read() | |
542 | - * from the socket if we can | |
543 | - */ | |
544 | -/* if (so->so_snd.sb_flags & SB_NOTIFY) | |
545 | - * sowwakeup(so); | |
546 | - */ | |
547 | - /* | |
548 | 489 | * This is called because sowwakeup might have |
549 | 490 | * put data into so_snd. Since we don't so sowwakeup, |
550 | 491 | * we don't need this.. XXX??? |
... | ... | @@ -575,13 +516,6 @@ findso: |
575 | 516 | sbappend(so, m); |
576 | 517 | |
577 | 518 | /* |
578 | - * XXX This is called when data arrives. Later, check | |
579 | - * if we can actually write() to the socket | |
580 | - * XXX Need to check? It's be NON_BLOCKING | |
581 | - */ | |
582 | -/* sorwakeup(so); */ | |
583 | - | |
584 | - /* | |
585 | 519 | * If this is a short packet, then ACK now - with Nagel |
586 | 520 | * congestion avoidance sender won't send more until |
587 | 521 | * he gets an ACK. |
... | ... | @@ -644,13 +578,6 @@ findso: |
644 | 578 | vnetwork_addr.s_addr) { |
645 | 579 | if (so->so_faddr.s_addr != vhost_addr.s_addr && |
646 | 580 | so->so_faddr.s_addr != vnameserver_addr.s_addr) { |
647 | -#if 0 | |
648 | - if(lastbyte==CTL_CMD || lastbyte==CTL_EXEC) { | |
649 | - /* Command or exec adress */ | |
650 | - so->so_state |= SS_CTL; | |
651 | - } else | |
652 | -#endif | |
653 | - { | |
654 | 581 | /* May be an add exec */ |
655 | 582 | for(ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { |
656 | 583 | if(ex_ptr->ex_fport == so->so_fport && |
... | ... | @@ -659,8 +586,9 @@ findso: |
659 | 586 | break; |
660 | 587 | } |
661 | 588 | } |
662 | - } | |
663 | - if(so->so_state & SS_CTL) goto cont_input; | |
589 | + if (so->so_state & SS_CTL) { | |
590 | + goto cont_input; | |
591 | + } | |
664 | 592 | } |
665 | 593 | /* CTL_ALIAS: Do nothing, tcp_fconnect will be called on it */ |
666 | 594 | } |
... | ... | @@ -718,8 +646,6 @@ findso: |
718 | 646 | |
719 | 647 | if (optp) |
720 | 648 | tcp_dooptions(tp, (u_char *)optp, optlen, ti); |
721 | - /* , */ | |
722 | - /* &ts_present, &ts_val, &ts_ecr); */ | |
723 | 649 | |
724 | 650 | if (iss) |
725 | 651 | tp->iss = iss; |
... | ... | @@ -777,13 +703,6 @@ findso: |
777 | 703 | soisfconnected(so); |
778 | 704 | tp->t_state = TCPS_ESTABLISHED; |
779 | 705 | |
780 | - /* Do window scaling on this connection? */ | |
781 | -/* if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == | |
782 | - * (TF_RCVD_SCALE|TF_REQ_SCALE)) { | |
783 | - * tp->snd_scale = tp->requested_s_scale; | |
784 | - * tp->rcv_scale = tp->request_r_scale; | |
785 | - * } | |
786 | - */ | |
787 | 706 | (void) tcp_reass(tp, (struct tcpiphdr *)0, |
788 | 707 | (struct mbuf *)0); |
789 | 708 | /* |
... | ... | @@ -816,40 +735,10 @@ trimthenstep6: |
816 | 735 | } /* switch tp->t_state */ |
817 | 736 | /* |
818 | 737 | * States other than LISTEN or SYN_SENT. |
819 | - * First check timestamp, if present. | |
820 | - * Then check that at least some bytes of segment are within | |
738 | + * Check that at least some bytes of segment are within | |
821 | 739 | * receive window. If segment begins before rcv_nxt, |
822 | 740 | * drop leading data (and SYN); if nothing left, just ack. |
823 | - * | |
824 | - * RFC 1323 PAWS: If we have a timestamp reply on this segment | |
825 | - * and it's less than ts_recent, drop it. | |
826 | 741 | */ |
827 | -/* if (ts_present && (tiflags & TH_RST) == 0 && tp->ts_recent && | |
828 | - * TSTMP_LT(ts_val, tp->ts_recent)) { | |
829 | - * | |
830 | - */ /* Check to see if ts_recent is over 24 days old. */ | |
831 | -/* if ((int)(tcp_now - tp->ts_recent_age) > TCP_PAWS_IDLE) { | |
832 | - */ /* | |
833 | - * * Invalidate ts_recent. If this segment updates | |
834 | - * * ts_recent, the age will be reset later and ts_recent | |
835 | - * * will get a valid value. If it does not, setting | |
836 | - * * ts_recent to zero will at least satisfy the | |
837 | - * * requirement that zero be placed in the timestamp | |
838 | - * * echo reply when ts_recent isn't valid. The | |
839 | - * * age isn't reset until we get a valid ts_recent | |
840 | - * * because we don't want out-of-order segments to be | |
841 | - * * dropped when ts_recent is old. | |
842 | - * */ | |
843 | -/* tp->ts_recent = 0; | |
844 | - * } else { | |
845 | - * tcpstat.tcps_rcvduppack++; | |
846 | - * tcpstat.tcps_rcvdupbyte += ti->ti_len; | |
847 | - * tcpstat.tcps_pawsdrop++; | |
848 | - * goto dropafterack; | |
849 | - * } | |
850 | - * } | |
851 | - */ | |
852 | - | |
853 | 742 | todrop = tp->rcv_nxt - ti->ti_seq; |
854 | 743 | if (todrop > 0) { |
855 | 744 | if (tiflags & TH_SYN) { |
... | ... | @@ -948,18 +837,6 @@ trimthenstep6: |
948 | 837 | } |
949 | 838 | |
950 | 839 | /* |
951 | - * If last ACK falls within this segment's sequence numbers, | |
952 | - * record its timestamp. | |
953 | - */ | |
954 | -/* if (ts_present && SEQ_LEQ(ti->ti_seq, tp->last_ack_sent) && | |
955 | - * SEQ_LT(tp->last_ack_sent, ti->ti_seq + ti->ti_len + | |
956 | - * ((tiflags & (TH_SYN|TH_FIN)) != 0))) { | |
957 | - * tp->ts_recent_age = tcp_now; | |
958 | - * tp->ts_recent = ts_val; | |
959 | - * } | |
960 | - */ | |
961 | - | |
962 | - /* | |
963 | 840 | * If the RST bit is set examine the state: |
964 | 841 | * SYN_RECEIVED STATE: |
965 | 842 | * If passive open, return to LISTEN state. |
... | ... | @@ -972,15 +849,10 @@ trimthenstep6: |
972 | 849 | if (tiflags&TH_RST) switch (tp->t_state) { |
973 | 850 | |
974 | 851 | case TCPS_SYN_RECEIVED: |
975 | -/* so->so_error = ECONNREFUSED; */ | |
976 | - goto close; | |
977 | - | |
978 | 852 | case TCPS_ESTABLISHED: |
979 | 853 | case TCPS_FIN_WAIT_1: |
980 | 854 | case TCPS_FIN_WAIT_2: |
981 | 855 | case TCPS_CLOSE_WAIT: |
982 | -/* so->so_error = ECONNRESET; */ | |
983 | - close: | |
984 | 856 | tp->t_state = TCPS_CLOSED; |
985 | 857 | STAT(tcpstat.tcps_drops++); |
986 | 858 | tp = tcp_close(tp); |
... | ... | @@ -1048,13 +920,6 @@ trimthenstep6: |
1048 | 920 | soisfconnected(so); |
1049 | 921 | } |
1050 | 922 | |
1051 | - /* Do window scaling? */ | |
1052 | -/* if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == | |
1053 | - * (TF_RCVD_SCALE|TF_REQ_SCALE)) { | |
1054 | - * tp->snd_scale = tp->requested_s_scale; | |
1055 | - * tp->rcv_scale = tp->request_r_scale; | |
1056 | - * } | |
1057 | - */ | |
1058 | 923 | (void) tcp_reass(tp, (struct tcpiphdr *)0, (struct mbuf *)0); |
1059 | 924 | tp->snd_wl1 = ti->ti_seq - 1; |
1060 | 925 | /* Avoid ack processing; snd_una==ti_ack => dup ack */ |
... | ... | @@ -1155,19 +1020,13 @@ trimthenstep6: |
1155 | 1020 | STAT(tcpstat.tcps_rcvackbyte += acked); |
1156 | 1021 | |
1157 | 1022 | /* |
1158 | - * If we have a timestamp reply, update smoothed | |
1159 | - * round trip time. If no timestamp is present but | |
1160 | - * transmit timer is running and timed sequence | |
1023 | + * If transmit timer is running and timed sequence | |
1161 | 1024 | * number was acked, update smoothed round trip time. |
1162 | 1025 | * Since we now have an rtt measurement, cancel the |
1163 | 1026 | * timer backoff (cf., Phil Karn's retransmit alg.). |
1164 | 1027 | * Recompute the initial retransmit timer. |
1165 | 1028 | */ |
1166 | -/* if (ts_present) | |
1167 | - * tcp_xmit_timer(tp, tcp_now-ts_ecr+1); | |
1168 | - * else | |
1169 | - */ | |
1170 | - if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) | |
1029 | + if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) | |
1171 | 1030 | tcp_xmit_timer(tp,tp->t_rtt); |
1172 | 1031 | |
1173 | 1032 | /* |
... | ... | @@ -1205,13 +1064,6 @@ trimthenstep6: |
1205 | 1064 | tp->snd_wnd -= acked; |
1206 | 1065 | ourfinisacked = 0; |
1207 | 1066 | } |
1208 | - /* | |
1209 | - * XXX sowwakup is called when data is acked and there's room for | |
1210 | - * for more data... it should read() the socket | |
1211 | - */ | |
1212 | -/* if (so->so_snd.sb_flags & SB_NOTIFY) | |
1213 | - * sowwakeup(so); | |
1214 | - */ | |
1215 | 1067 | tp->snd_una = ti->ti_ack; |
1216 | 1068 | if (SEQ_LT(tp->snd_nxt, tp->snd_una)) |
1217 | 1069 | tp->snd_nxt = tp->snd_una; |
... | ... | @@ -1233,7 +1085,6 @@ trimthenstep6: |
1233 | 1085 | * we'll hang forever. |
1234 | 1086 | */ |
1235 | 1087 | if (so->so_state & SS_FCANTRCVMORE) { |
1236 | - soisfdisconnected(so); | |
1237 | 1088 | tp->t_timer[TCPT_2MSL] = TCP_MAXIDLE; |
1238 | 1089 | } |
1239 | 1090 | tp->t_state = TCPS_FIN_WAIT_2; |
... | ... | @@ -1251,7 +1102,6 @@ trimthenstep6: |
1251 | 1102 | tp->t_state = TCPS_TIME_WAIT; |
1252 | 1103 | tcp_canceltimers(tp); |
1253 | 1104 | tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; |
1254 | - soisfdisconnected(so); | |
1255 | 1105 | } |
1256 | 1106 | break; |
1257 | 1107 | |
... | ... | @@ -1384,7 +1234,6 @@ dodata: |
1384 | 1234 | * will got to TCPS_LAST_ACK, and use tcp_output() |
1385 | 1235 | * to send the FIN. |
1386 | 1236 | */ |
1387 | -/* sofcantrcvmore(so); */ | |
1388 | 1237 | sofwdrain(so); |
1389 | 1238 | |
1390 | 1239 | tp->t_flags |= TF_ACKNOW; |
... | ... | @@ -1421,7 +1270,6 @@ dodata: |
1421 | 1270 | tp->t_state = TCPS_TIME_WAIT; |
1422 | 1271 | tcp_canceltimers(tp); |
1423 | 1272 | tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; |
1424 | - soisfdisconnected(so); | |
1425 | 1273 | break; |
1426 | 1274 | |
1427 | 1275 | /* |
... | ... | @@ -1440,13 +1288,6 @@ dodata: |
1440 | 1288 | * |
1441 | 1289 | * See above. |
1442 | 1290 | */ |
1443 | -/* if (ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg) { | |
1444 | - */ | |
1445 | -/* if ((ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg && | |
1446 | - * (so->so_iptos & IPTOS_LOWDELAY) == 0) || | |
1447 | - * ((so->so_iptos & IPTOS_LOWDELAY) && | |
1448 | - * ((struct tcpiphdr_2 *)ti)->first_char == (char)27)) { | |
1449 | - */ | |
1450 | 1291 | if (ti->ti_len && (unsigned)ti->ti_len <= 5 && |
1451 | 1292 | ((struct tcpiphdr_2 *)ti)->first_char == (char)27) { |
1452 | 1293 | tp->t_flags |= TF_ACKNOW; |
... | ... | @@ -1493,10 +1334,6 @@ drop: |
1493 | 1334 | return; |
1494 | 1335 | } |
1495 | 1336 | |
1496 | - /* , ts_present, ts_val, ts_ecr) */ | |
1497 | -/* int *ts_present; | |
1498 | - * u_int32_t *ts_val, *ts_ecr; | |
1499 | - */ | |
1500 | 1337 | static void |
1501 | 1338 | tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) |
1502 | 1339 | { |
... | ... | @@ -1531,35 +1368,6 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) |
1531 | 1368 | NTOHS(mss); |
1532 | 1369 | (void) tcp_mss(tp, mss); /* sets t_maxseg */ |
1533 | 1370 | break; |
1534 | - | |
1535 | -/* case TCPOPT_WINDOW: | |
1536 | - * if (optlen != TCPOLEN_WINDOW) | |
1537 | - * continue; | |
1538 | - * if (!(ti->ti_flags & TH_SYN)) | |
1539 | - * continue; | |
1540 | - * tp->t_flags |= TF_RCVD_SCALE; | |
1541 | - * tp->requested_s_scale = min(cp[2], TCP_MAX_WINSHIFT); | |
1542 | - * break; | |
1543 | - */ | |
1544 | -/* case TCPOPT_TIMESTAMP: | |
1545 | - * if (optlen != TCPOLEN_TIMESTAMP) | |
1546 | - * continue; | |
1547 | - * *ts_present = 1; | |
1548 | - * memcpy((char *) ts_val, (char *)cp + 2, sizeof(*ts_val)); | |
1549 | - * NTOHL(*ts_val); | |
1550 | - * memcpy((char *) ts_ecr, (char *)cp + 6, sizeof(*ts_ecr)); | |
1551 | - * NTOHL(*ts_ecr); | |
1552 | - * | |
1553 | - */ /* | |
1554 | - * * A timestamp received in a SYN makes | |
1555 | - * * it ok to send timestamp requests and replies. | |
1556 | - * */ | |
1557 | -/* if (ti->ti_flags & TH_SYN) { | |
1558 | - * tp->t_flags |= TF_RCVD_TSTMP; | |
1559 | - * tp->ts_recent = *ts_val; | |
1560 | - * tp->ts_recent_age = tcp_now; | |
1561 | - * } | |
1562 | - */ break; | |
1563 | 1371 | } |
1564 | 1372 | } |
1565 | 1373 | } | ... | ... |
slirp/tcp_output.c
... | ... | @@ -272,39 +272,9 @@ send: |
272 | 272 | mss = htons((u_int16_t) tcp_mss(tp, 0)); |
273 | 273 | memcpy((caddr_t)(opt + 2), (caddr_t)&mss, sizeof(mss)); |
274 | 274 | optlen = 4; |
275 | - | |
276 | -/* if ((tp->t_flags & TF_REQ_SCALE) && | |
277 | - * ((flags & TH_ACK) == 0 || | |
278 | - * (tp->t_flags & TF_RCVD_SCALE))) { | |
279 | - * *((u_int32_t *) (opt + optlen)) = htonl( | |
280 | - * TCPOPT_NOP << 24 | | |
281 | - * TCPOPT_WINDOW << 16 | | |
282 | - * TCPOLEN_WINDOW << 8 | | |
283 | - * tp->request_r_scale); | |
284 | - * optlen += 4; | |
285 | - * } | |
286 | - */ | |
287 | 275 | } |
288 | 276 | } |
289 | 277 | |
290 | - /* | |
291 | - * Send a timestamp and echo-reply if this is a SYN and our side | |
292 | - * wants to use timestamps (TF_REQ_TSTMP is set) or both our side | |
293 | - * and our peer have sent timestamps in our SYN's. | |
294 | - */ | |
295 | -/* if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && | |
296 | - * (flags & TH_RST) == 0 && | |
297 | - * ((flags & (TH_SYN|TH_ACK)) == TH_SYN || | |
298 | - * (tp->t_flags & TF_RCVD_TSTMP))) { | |
299 | - * u_int32_t *lp = (u_int32_t *)(opt + optlen); | |
300 | - * | |
301 | - * / * Form timestamp option as shown in appendix A of RFC 1323. * / | |
302 | - * *lp++ = htonl(TCPOPT_TSTAMP_HDR); | |
303 | - * *lp++ = htonl(tcp_now); | |
304 | - * *lp = htonl(tp->ts_recent); | |
305 | - * optlen += TCPOLEN_TSTAMP_APPA; | |
306 | - * } | |
307 | - */ | |
308 | 278 | hdrlen += optlen; |
309 | 279 | |
310 | 280 | /* |
... | ... | @@ -334,28 +304,15 @@ send: |
334 | 304 | |
335 | 305 | m = m_get(); |
336 | 306 | if (m == NULL) { |
337 | -/* error = ENOBUFS; */ | |
338 | 307 | error = 1; |
339 | 308 | goto out; |
340 | 309 | } |
341 | 310 | m->m_data += IF_MAXLINKHDR; |
342 | 311 | m->m_len = hdrlen; |
343 | 312 | |
344 | - /* | |
345 | - * This will always succeed, since we make sure our mbufs | |
346 | - * are big enough to hold one MSS packet + header + ... etc. | |
347 | - */ | |
348 | -/* if (len <= MHLEN - hdrlen - max_linkhdr) { */ | |
349 | - | |
350 | - sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen); | |
351 | - m->m_len += len; | |
313 | + sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen); | |
314 | + m->m_len += len; | |
352 | 315 | |
353 | -/* } else { | |
354 | - * m->m_next = m_copy(so->so_snd.sb_mb, off, (int) len); | |
355 | - * if (m->m_next == 0) | |
356 | - * len = 0; | |
357 | - * } | |
358 | - */ | |
359 | 316 | /* |
360 | 317 | * If we're sending everything we've got, set PUSH. |
361 | 318 | * (This will keep happy those implementations which only |
... | ... | @@ -376,7 +333,6 @@ send: |
376 | 333 | |
377 | 334 | m = m_get(); |
378 | 335 | if (m == NULL) { |
379 | -/* error = ENOBUFS; */ | |
380 | 336 | error = 1; |
381 | 337 | goto out; |
382 | 338 | } |
... | ... | @@ -433,10 +389,6 @@ send: |
433 | 389 | |
434 | 390 | if (SEQ_GT(tp->snd_up, tp->snd_una)) { |
435 | 391 | ti->ti_urp = htons((u_int16_t)(tp->snd_up - ntohl(ti->ti_seq))); |
436 | -#ifdef notdef | |
437 | - if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { | |
438 | - ti->ti_urp = htons((u_int16_t)(tp->snd_up - tp->snd_nxt)); | |
439 | -#endif | |
440 | 392 | ti->ti_flags |= TH_URG; |
441 | 393 | } else |
442 | 394 | /* |
... | ... | @@ -523,32 +475,10 @@ send: |
523 | 475 | ((struct ip *)ti)->ip_ttl = IPDEFTTL; |
524 | 476 | ((struct ip *)ti)->ip_tos = so->so_iptos; |
525 | 477 | |
526 | -/* #if BSD >= 43 */ | |
527 | - /* Don't do IP options... */ | |
528 | -/* error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route, | |
529 | - * so->so_options & SO_DONTROUTE, 0); | |
530 | - */ | |
531 | 478 | error = ip_output(so, m); |
532 | - | |
533 | -/* #else | |
534 | - * error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route, | |
535 | - * so->so_options & SO_DONTROUTE); | |
536 | - * #endif | |
537 | - */ | |
538 | 479 | } |
539 | 480 | if (error) { |
540 | 481 | out: |
541 | -/* if (error == ENOBUFS) { | |
542 | - * tcp_quench(tp->t_inpcb, 0); | |
543 | - * return (0); | |
544 | - * } | |
545 | - */ | |
546 | -/* if ((error == EHOSTUNREACH || error == ENETDOWN) | |
547 | - * && TCPS_HAVERCVDSYN(tp->t_state)) { | |
548 | - * tp->t_softerror = error; | |
549 | - * return (0); | |
550 | - * } | |
551 | - */ | |
552 | 482 | return (error); |
553 | 483 | } |
554 | 484 | STAT(tcpstat.tcps_sndtotal++); |
... | ... | @@ -574,9 +504,6 @@ tcp_setpersist(struct tcpcb *tp) |
574 | 504 | { |
575 | 505 | int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; |
576 | 506 | |
577 | -/* if (tp->t_timer[TCPT_REXMT]) | |
578 | - * panic("tcp_output REXMT"); | |
579 | - */ | |
580 | 507 | /* |
581 | 508 | * Start/restart persistence timer. |
582 | 509 | */ | ... | ... |
slirp/tcp_subr.c
... | ... | @@ -60,7 +60,6 @@ tcp_init(void) |
60 | 60 | * in a skeletal tcp/ip header, minimizing the amount of work |
61 | 61 | * necessary when the connection is used. |
62 | 62 | */ |
63 | -/* struct tcpiphdr * */ | |
64 | 63 | void |
65 | 64 | tcp_template(struct tcpcb *tp) |
66 | 65 | { |
... | ... | @@ -119,11 +118,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, |
119 | 118 | if (m == NULL) { |
120 | 119 | if ((m = m_get()) == NULL) |
121 | 120 | return; |
122 | -#ifdef TCP_COMPAT_42 | |
123 | - tlen = 1; | |
124 | -#else | |
125 | 121 | tlen = 0; |
126 | -#endif | |
127 | 122 | m->m_data += IF_MAXLINKHDR; |
128 | 123 | *mtod(m, struct tcpiphdr *) = *ti; |
129 | 124 | ti = mtod(m, struct tcpiphdr *); |
... | ... | @@ -220,12 +215,6 @@ tcp_newtcpcb(struct socket *so) |
220 | 215 | */ |
221 | 216 | struct tcpcb *tcp_drop(struct tcpcb *tp, int err) |
222 | 217 | { |
223 | -/* tcp_drop(tp, errno) | |
224 | - register struct tcpcb *tp; | |
225 | - int errno; | |
226 | -{ | |
227 | -*/ | |
228 | - | |
229 | 218 | DEBUG_CALL("tcp_drop"); |
230 | 219 | DEBUG_ARG("tp = %lx", (long)tp); |
231 | 220 | DEBUG_ARG("errno = %d", errno); |
... | ... | @@ -236,10 +225,6 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err) |
236 | 225 | STAT(tcpstat.tcps_drops++); |
237 | 226 | } else |
238 | 227 | STAT(tcpstat.tcps_conndrops++); |
239 | -/* if (errno == ETIMEDOUT && tp->t_softerror) | |
240 | - * errno = tp->t_softerror; | |
241 | - */ | |
242 | -/* so->so_error = errno; */ | |
243 | 228 | return (tcp_close(tp)); |
244 | 229 | } |
245 | 230 | |
... | ... | @@ -267,14 +252,8 @@ tcp_close(struct tcpcb *tp) |
267 | 252 | remque(tcpiphdr2qlink(tcpiphdr_prev(t))); |
268 | 253 | m_freem(m); |
269 | 254 | } |
270 | - /* It's static */ | |
271 | -/* if (tp->t_template) | |
272 | - * (void) m_free(dtom(tp->t_template)); | |
273 | - */ | |
274 | -/* free(tp, M_PCB); */ | |
275 | 255 | free(tp); |
276 | 256 | so->so_tcpcb = NULL; |
277 | - soisfdisconnected(so); | |
278 | 257 | /* clobber input socket cache if we're closing the cached connection */ |
279 | 258 | if (so == tcp_last_so) |
280 | 259 | tcp_last_so = &tcb; |
... | ... | @@ -286,30 +265,6 @@ tcp_close(struct tcpcb *tp) |
286 | 265 | return ((struct tcpcb *)0); |
287 | 266 | } |
288 | 267 | |
289 | -#ifdef notdef | |
290 | -void | |
291 | -tcp_drain() | |
292 | -{ | |
293 | - /* XXX */ | |
294 | -} | |
295 | - | |
296 | -/* | |
297 | - * When a source quench is received, close congestion window | |
298 | - * to one segment. We will gradually open it again as we proceed. | |
299 | - */ | |
300 | -void | |
301 | -tcp_quench(i, errno) | |
302 | - | |
303 | - int errno; | |
304 | -{ | |
305 | - struct tcpcb *tp = intotcpcb(inp); | |
306 | - | |
307 | - if (tp) | |
308 | - tp->snd_cwnd = tp->t_maxseg; | |
309 | -} | |
310 | - | |
311 | -#endif /* notdef */ | |
312 | - | |
313 | 268 | /* |
314 | 269 | * TCP protocol interface to socket abstraction. |
315 | 270 | */ |
... | ... | @@ -349,9 +304,6 @@ tcp_sockclosed(struct tcpcb *tp) |
349 | 304 | tp->t_state = TCPS_LAST_ACK; |
350 | 305 | break; |
351 | 306 | } |
352 | -/* soisfdisconnecting(tp->t_socket); */ | |
353 | - if (tp && tp->t_state >= TCPS_FIN_WAIT_2) | |
354 | - soisfdisconnected(tp->t_socket); | |
355 | 307 | if (tp) |
356 | 308 | tcp_output(tp); |
357 | 309 | } |
... | ... | @@ -490,13 +442,6 @@ tcp_connect(struct socket *inso) |
490 | 442 | |
491 | 443 | tcp_template(tp); |
492 | 444 | |
493 | - /* Compute window scaling to request. */ | |
494 | -/* while (tp->request_r_scale < TCP_MAX_WINSHIFT && | |
495 | - * (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) | |
496 | - * tp->request_r_scale++; | |
497 | - */ | |
498 | - | |
499 | -/* soisconnecting(so); */ /* NOFDREF used instead */ | |
500 | 445 | STAT(tcpstat.tcps_connattempt++); |
501 | 446 | |
502 | 447 | tp->t_state = TCPS_SYN_SENT; |
... | ... | @@ -540,10 +485,7 @@ static const struct tos_t tcptos[] = { |
540 | 485 | {0, 0, 0, 0} |
541 | 486 | }; |
542 | 487 | |
543 | -#ifdef CONFIG_QEMU | |
544 | -static | |
545 | -#endif | |
546 | -struct emu_t *tcpemu = NULL; | |
488 | +static struct emu_t *tcpemu = NULL; | |
547 | 489 | |
548 | 490 | /* |
549 | 491 | * Return TOS according to the above table |
... | ... | @@ -575,10 +517,6 @@ tcp_tos(struct socket *so) |
575 | 517 | return 0; |
576 | 518 | } |
577 | 519 | |
578 | -#if 0 | |
579 | -int do_echo = -1; | |
580 | -#endif | |
581 | - | |
582 | 520 | /* |
583 | 521 | * Emulate programs that try and connect to us |
584 | 522 | * This includes ftp (the data connection is |
... | ... | @@ -661,302 +599,6 @@ tcp_emu(struct socket *so, struct mbuf *m) |
661 | 599 | return 0; |
662 | 600 | } |
663 | 601 | |
664 | -#if 0 | |
665 | - case EMU_RLOGIN: | |
666 | - /* | |
667 | - * Rlogin emulation | |
668 | - * First we accumulate all the initial option negotiation, | |
669 | - * then fork_exec() rlogin according to the options | |
670 | - */ | |
671 | - { | |
672 | - int i, i2, n; | |
673 | - char *ptr; | |
674 | - char args[100]; | |
675 | - char term[100]; | |
676 | - struct sbuf *so_snd = &so->so_snd; | |
677 | - struct sbuf *so_rcv = &so->so_rcv; | |
678 | - | |
679 | - /* First check if they have a priveladged port, or too much data has arrived */ | |
680 | - if (ntohs(so->so_lport) > 1023 || ntohs(so->so_lport) < 512 || | |
681 | - (m->m_len + so_rcv->sb_wptr) > (so_rcv->sb_data + so_rcv->sb_datalen)) { | |
682 | - memcpy(so_snd->sb_wptr, "Permission denied\n", 18); | |
683 | - so_snd->sb_wptr += 18; | |
684 | - so_snd->sb_cc += 18; | |
685 | - tcp_sockclosed(sototcpcb(so)); | |
686 | - m_free(m); | |
687 | - return 0; | |
688 | - } | |
689 | - | |
690 | - /* Append the current data */ | |
691 | - memcpy(so_rcv->sb_wptr, m->m_data, m->m_len); | |
692 | - so_rcv->sb_wptr += m->m_len; | |
693 | - so_rcv->sb_rptr += m->m_len; | |
694 | - m_free(m); | |
695 | - | |
696 | - /* | |
697 | - * Check if we have all the initial options, | |
698 | - * and build argument list to rlogin while we're here | |
699 | - */ | |
700 | - n = 0; | |
701 | - ptr = so_rcv->sb_data; | |
702 | - args[0] = 0; | |
703 | - term[0] = 0; | |
704 | - while (ptr < so_rcv->sb_wptr) { | |
705 | - if (*ptr++ == 0) { | |
706 | - n++; | |
707 | - if (n == 2) { | |
708 | - sprintf(args, "rlogin -l %s %s", | |
709 | - ptr, inet_ntoa(so->so_faddr)); | |
710 | - } else if (n == 3) { | |
711 | - i2 = so_rcv->sb_wptr - ptr; | |
712 | - for (i = 0; i < i2; i++) { | |
713 | - if (ptr[i] == '/') { | |
714 | - ptr[i] = 0; | |
715 | -#ifdef HAVE_SETENV | |
716 | - sprintf(term, "%s", ptr); | |
717 | -#else | |
718 | - sprintf(term, "TERM=%s", ptr); | |
719 | -#endif | |
720 | - ptr[i] = '/'; | |
721 | - break; | |
722 | - } | |
723 | - } | |
724 | - } | |
725 | - } | |
726 | - } | |
727 | - | |
728 | - if (n != 4) | |
729 | - return 0; | |
730 | - | |
731 | - /* We have it, set our term variable and fork_exec() */ | |
732 | -#ifdef HAVE_SETENV | |
733 | - setenv("TERM", term, 1); | |
734 | -#else | |
735 | - putenv(term); | |
736 | -#endif | |
737 | - fork_exec(so, args, 2); | |
738 | - term[0] = 0; | |
739 | - so->so_emu = 0; | |
740 | - | |
741 | - /* And finally, send the client a 0 character */ | |
742 | - so_snd->sb_wptr[0] = 0; | |
743 | - so_snd->sb_wptr++; | |
744 | - so_snd->sb_cc++; | |
745 | - | |
746 | - return 0; | |
747 | - } | |
748 | - | |
749 | - case EMU_RSH: | |
750 | - /* | |
751 | - * rsh emulation | |
752 | - * First we accumulate all the initial option negotiation, | |
753 | - * then rsh_exec() rsh according to the options | |
754 | - */ | |
755 | - { | |
756 | - int n; | |
757 | - char *ptr; | |
758 | - char *user; | |
759 | - char *args; | |
760 | - struct sbuf *so_snd = &so->so_snd; | |
761 | - struct sbuf *so_rcv = &so->so_rcv; | |
762 | - | |
763 | - /* First check if they have a priveladged port, or too much data has arrived */ | |
764 | - if (ntohs(so->so_lport) > 1023 || ntohs(so->so_lport) < 512 || | |
765 | - (m->m_len + so_rcv->sb_wptr) > (so_rcv->sb_data + so_rcv->sb_datalen)) { | |
766 | - memcpy(so_snd->sb_wptr, "Permission denied\n", 18); | |
767 | - so_snd->sb_wptr += 18; | |
768 | - so_snd->sb_cc += 18; | |
769 | - tcp_sockclosed(sototcpcb(so)); | |
770 | - m_free(m); | |
771 | - return 0; | |
772 | - } | |
773 | - | |
774 | - /* Append the current data */ | |
775 | - memcpy(so_rcv->sb_wptr, m->m_data, m->m_len); | |
776 | - so_rcv->sb_wptr += m->m_len; | |
777 | - so_rcv->sb_rptr += m->m_len; | |
778 | - m_free(m); | |
779 | - | |
780 | - /* | |
781 | - * Check if we have all the initial options, | |
782 | - * and build argument list to rlogin while we're here | |
783 | - */ | |
784 | - n = 0; | |
785 | - ptr = so_rcv->sb_data; | |
786 | - user=""; | |
787 | - args=""; | |
788 | - if (so->extra==NULL) { | |
789 | - struct socket *ns; | |
790 | - struct tcpcb* tp; | |
791 | - int port=atoi(ptr); | |
792 | - if (port <= 0) return 0; | |
793 | - if (port > 1023 || port < 512) { | |
794 | - memcpy(so_snd->sb_wptr, "Permission denied\n", 18); | |
795 | - so_snd->sb_wptr += 18; | |
796 | - so_snd->sb_cc += 18; | |
797 | - tcp_sockclosed(sototcpcb(so)); | |
798 | - return 0; | |
799 | - } | |
800 | - if ((ns=socreate()) == NULL) | |
801 | - return 0; | |
802 | - if (tcp_attach(ns)<0) { | |
803 | - free(ns); | |
804 | - return 0; | |
805 | - } | |
806 | - | |
807 | - ns->so_laddr=so->so_laddr; | |
808 | - ns->so_lport=htons(port); | |
809 | - | |
810 | - (void) tcp_mss(sototcpcb(ns), 0); | |
811 | - | |
812 | - ns->so_faddr=so->so_faddr; | |
813 | - ns->so_fport=htons(IPPORT_RESERVED-1); /* Use a fake port. */ | |
814 | - | |
815 | - if (ns->so_faddr.s_addr == 0 || | |
816 | - ns->so_faddr.s_addr == loopback_addr.s_addr) | |
817 | - ns->so_faddr = alias_addr; | |
818 | - | |
819 | - ns->so_iptos = tcp_tos(ns); | |
820 | - tp = sototcpcb(ns); | |
821 | - | |
822 | - tcp_template(tp); | |
823 | - | |
824 | - /* Compute window scaling to request. */ | |
825 | - /* while (tp->request_r_scale < TCP_MAX_WINSHIFT && | |
826 | - * (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) | |
827 | - * tp->request_r_scale++; | |
828 | - */ | |
829 | - | |
830 | - /*soisfconnecting(ns);*/ | |
831 | - | |
832 | - STAT(tcpstat.tcps_connattempt++); | |
833 | - | |
834 | - tp->t_state = TCPS_SYN_SENT; | |
835 | - tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; | |
836 | - tp->iss = tcp_iss; | |
837 | - tcp_iss += TCP_ISSINCR/2; | |
838 | - tcp_sendseqinit(tp); | |
839 | - tcp_output(tp); | |
840 | - so->extra=ns; | |
841 | - } | |
842 | - while (ptr < so_rcv->sb_wptr) { | |
843 | - if (*ptr++ == 0) { | |
844 | - n++; | |
845 | - if (n == 2) { | |
846 | - user=ptr; | |
847 | - } else if (n == 3) { | |
848 | - args=ptr; | |
849 | - } | |
850 | - } | |
851 | - } | |
852 | - | |
853 | - if (n != 4) | |
854 | - return 0; | |
855 | - | |
856 | - rsh_exec(so,so->extra, user, inet_ntoa(so->so_faddr), args); | |
857 | - so->so_emu = 0; | |
858 | - so->extra=NULL; | |
859 | - | |
860 | - /* And finally, send the client a 0 character */ | |
861 | - so_snd->sb_wptr[0] = 0; | |
862 | - so_snd->sb_wptr++; | |
863 | - so_snd->sb_cc++; | |
864 | - | |
865 | - return 0; | |
866 | - } | |
867 | - | |
868 | - case EMU_CTL: | |
869 | - { | |
870 | - int num; | |
871 | - struct sbuf *so_snd = &so->so_snd; | |
872 | - struct sbuf *so_rcv = &so->so_rcv; | |
873 | - | |
874 | - /* | |
875 | - * If there is binary data here, we save it in so->so_m | |
876 | - */ | |
877 | - if (!so->so_m) { | |
878 | - int rxlen; | |
879 | - char *rxdata; | |
880 | - rxdata=mtod(m, char *); | |
881 | - for (rxlen=m->m_len; rxlen; rxlen--) { | |
882 | - if (*rxdata++ & 0x80) { | |
883 | - so->so_m = m; | |
884 | - return 0; | |
885 | - } | |
886 | - } | |
887 | - } /* if(so->so_m==NULL) */ | |
888 | - | |
889 | - /* | |
890 | - * Append the line | |
891 | - */ | |
892 | - sbappendsb(so_rcv, m); | |
893 | - | |
894 | - /* To avoid going over the edge of the buffer, we reset it */ | |
895 | - if (so_snd->sb_cc == 0) | |
896 | - so_snd->sb_wptr = so_snd->sb_rptr = so_snd->sb_data; | |
897 | - | |
898 | - /* | |
899 | - * A bit of a hack: | |
900 | - * If the first packet we get here is 1 byte long, then it | |
901 | - * was done in telnet character mode, therefore we must echo | |
902 | - * the characters as they come. Otherwise, we echo nothing, | |
903 | - * because in linemode, the line is already echoed | |
904 | - * XXX two or more control connections won't work | |
905 | - */ | |
906 | - if (do_echo == -1) { | |
907 | - if (m->m_len == 1) do_echo = 1; | |
908 | - else do_echo = 0; | |
909 | - } | |
910 | - if (do_echo) { | |
911 | - sbappendsb(so_snd, m); | |
912 | - m_free(m); | |
913 | - tcp_output(sototcpcb(so)); /* XXX */ | |
914 | - } else | |
915 | - m_free(m); | |
916 | - | |
917 | - num = 0; | |
918 | - while (num < so->so_rcv.sb_cc) { | |
919 | - if (*(so->so_rcv.sb_rptr + num) == '\n' || | |
920 | - *(so->so_rcv.sb_rptr + num) == '\r') { | |
921 | - int n; | |
922 | - | |
923 | - *(so_rcv->sb_rptr + num) = 0; | |
924 | - if (ctl_password && !ctl_password_ok) { | |
925 | - /* Need a password */ | |
926 | - if (sscanf(so_rcv->sb_rptr, "pass %256s", buff) == 1) { | |
927 | - if (strcmp(buff, ctl_password) == 0) { | |
928 | - ctl_password_ok = 1; | |
929 | - n = sprintf(so_snd->sb_wptr, | |
930 | - "Password OK.\r\n"); | |
931 | - goto do_prompt; | |
932 | - } | |
933 | - } | |
934 | - n = sprintf(so_snd->sb_wptr, | |
935 | - "Error: Password required, log on with \"pass PASSWORD\"\r\n"); | |
936 | - goto do_prompt; | |
937 | - } | |
938 | - cfg_quitting = 0; | |
939 | - n = do_config(so_rcv->sb_rptr, so, PRN_SPRINTF); | |
940 | - if (!cfg_quitting) { | |
941 | - /* Register the printed data */ | |
942 | -do_prompt: | |
943 | - so_snd->sb_cc += n; | |
944 | - so_snd->sb_wptr += n; | |
945 | - /* Add prompt */ | |
946 | - n = sprintf(so_snd->sb_wptr, "Slirp> "); | |
947 | - so_snd->sb_cc += n; | |
948 | - so_snd->sb_wptr += n; | |
949 | - } | |
950 | - /* Drop so_rcv data */ | |
951 | - so_rcv->sb_cc = 0; | |
952 | - so_rcv->sb_wptr = so_rcv->sb_rptr = so_rcv->sb_data; | |
953 | - tcp_output(sototcpcb(so)); /* Send the reply */ | |
954 | - } | |
955 | - num++; | |
956 | - } | |
957 | - return 0; | |
958 | - } | |
959 | -#endif | |
960 | 602 | case EMU_FTP: /* ftp */ |
961 | 603 | *(m->m_data+m->m_len) = 0; /* NUL terminate for strstr */ |
962 | 604 | if ((bptr = (char *)strstr(m->m_data, "ORT")) != NULL) { |
... | ... | @@ -1100,7 +742,7 @@ do_prompt: |
1100 | 742 | * A typical packet for player version 1.0 (release version): |
1101 | 743 | * |
1102 | 744 | * 0000:50 4E 41 00 05 |
1103 | - * 0000:00 01 00 02 1B D7 00 00 67 E6 6C DC 63 00 12 50 .....ร..gรฆlรc..P | |
745 | + * 0000:00 01 00 02 1B D7 00 00 67 E6 6C DC 63 00 12 50 ........g.l.c..P | |
1104 | 746 | * 0010:4E 43 4C 49 45 4E 54 20 31 30 31 20 41 4C 50 48 NCLIENT 101 ALPH |
1105 | 747 | * 0020:41 6C 00 00 52 00 17 72 61 66 69 6C 65 73 2F 76 Al..R..rafiles/v |
1106 | 748 | * 0030:6F 61 2F 65 6E 67 6C 69 73 68 5F 2E 72 61 79 42 oa/english_.rayB |
... | ... | @@ -1112,8 +754,8 @@ do_prompt: |
1112 | 754 | * |
1113 | 755 | * A typical packet for player version 2.0 (beta): |
1114 | 756 | * |
1115 | - * 0000:50 4E 41 00 06 00 02 00 00 00 01 00 02 1B C1 00 PNA...........ร. | |
1116 | - * 0010:00 67 75 78 F5 63 00 0A 57 69 6E 32 2E 30 2E 30 .guxรตc..Win2.0.0 | |
757 | + * 0000:50 4E 41 00 06 00 02 00 00 00 01 00 02 1B C1 00 PNA............. | |
758 | + * 0010:00 67 75 78 F5 63 00 0A 57 69 6E 32 2E 30 2E 30 .gux.c..Win2.0.0 | |
1117 | 759 | * 0020:2E 35 6C 00 00 52 00 1C 72 61 66 69 6C 65 73 2F .5l..R..rafiles/ |
1118 | 760 | * 0030:77 65 62 73 69 74 65 2F 32 30 72 65 6C 65 61 73 website/20releas |
1119 | 761 | * 0040:65 2E 72 61 79 53 00 00 06 36 42 e.rayS...6B | ... | ... |
slirp/tcp_timer.c
... | ... | @@ -102,10 +102,6 @@ tpgone: |
102 | 102 | ; |
103 | 103 | } |
104 | 104 | tcp_iss += TCP_ISSINCR/PR_SLOWHZ; /* increment iss */ |
105 | -#ifdef TCP_COMPAT_42 | |
106 | - if ((int)tcp_iss < 0) | |
107 | - tcp_iss = 0; /* XXX */ | |
108 | -#endif | |
109 | 105 | tcp_now++; /* for timestamps */ |
110 | 106 | } |
111 | 107 | |
... | ... | @@ -210,7 +206,6 @@ tcp_timers(register struct tcpcb *tp, int timer) |
210 | 206 | * retransmit times until then. |
211 | 207 | */ |
212 | 208 | if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) { |
213 | -/* in_losing(tp->t_inpcb); */ | |
214 | 209 | tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT); |
215 | 210 | tp->t_srtt = 0; |
216 | 211 | } |
... | ... | @@ -275,7 +270,6 @@ tcp_timers(register struct tcpcb *tp, int timer) |
275 | 270 | if (tp->t_state < TCPS_ESTABLISHED) |
276 | 271 | goto dropit; |
277 | 272 | |
278 | -/* if (tp->t_socket->so_options & SO_KEEPALIVE && */ | |
279 | 273 | if ((SO_OPTIONS) && tp->t_state <= TCPS_CLOSE_WAIT) { |
280 | 274 | if (tp->t_idle >= TCPTV_KEEP_IDLE + TCP_MAXIDLE) |
281 | 275 | goto dropit; |
... | ... | @@ -292,17 +286,8 @@ tcp_timers(register struct tcpcb *tp, int timer) |
292 | 286 | * correspondent TCP to respond. |
293 | 287 | */ |
294 | 288 | STAT(tcpstat.tcps_keepprobe++); |
295 | -#ifdef TCP_COMPAT_42 | |
296 | - /* | |
297 | - * The keepalive packet must have nonzero length | |
298 | - * to get a 4.2 host to respond. | |
299 | - */ | |
300 | - tcp_respond(tp, &tp->t_template, (struct mbuf *)NULL, | |
301 | - tp->rcv_nxt - 1, tp->snd_una - 1, 0); | |
302 | -#else | |
303 | 289 | tcp_respond(tp, &tp->t_template, (struct mbuf *)NULL, |
304 | 290 | tp->rcv_nxt, tp->snd_una - 1, 0); |
305 | -#endif | |
306 | 291 | tp->t_timer[TCPT_KEEP] = TCPTV_KEEPINTVL; |
307 | 292 | } else |
308 | 293 | tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_IDLE; |
... | ... | @@ -310,7 +295,7 @@ tcp_timers(register struct tcpcb *tp, int timer) |
310 | 295 | |
311 | 296 | dropit: |
312 | 297 | STAT(tcpstat.tcps_keepdrops++); |
313 | - tp = tcp_drop(tp, 0); /* ETIMEDOUT); */ | |
298 | + tp = tcp_drop(tp, 0); | |
314 | 299 | break; |
315 | 300 | } |
316 | 301 | ... | ... |
slirp/tcp_timer.h
... | ... | @@ -98,7 +98,6 @@ |
98 | 98 | #define TCPTV_KEEPCNT 8 /* max probes before drop */ |
99 | 99 | |
100 | 100 | #define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ |
101 | -/* #define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) */ /* max allowable REXMT value */ | |
102 | 101 | #define TCPTV_REXMTMAX ( 12*PR_SLOWHZ) /* max allowable REXMT value */ |
103 | 102 | |
104 | 103 | #define TCP_LINGERTIME 120 /* linger at most 2 minutes */ |
... | ... | @@ -106,11 +105,6 @@ |
106 | 105 | #define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ |
107 | 106 | |
108 | 107 | |
109 | -#ifdef TCPTIMERS | |
110 | -char *tcptimers[] = | |
111 | - { "REXMT", "PERSIST", "KEEP", "2MSL" }; | |
112 | -#endif | |
113 | - | |
114 | 108 | /* |
115 | 109 | * Force a time value to be in a certain range. |
116 | 110 | */ | ... | ... |
slirp/tcp_var.h
... | ... | @@ -61,9 +61,7 @@ struct tcpcb { |
61 | 61 | #define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */ |
62 | 62 | #define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */ |
63 | 63 | |
64 | - /* Make it static for now */ | |
65 | -/* struct tcpiphdr *t_template; / * skeletal packet for transmit */ | |
66 | - struct tcpiphdr t_template; | |
64 | + struct tcpiphdr t_template; /* static skeletal packet for xmit */ | |
67 | 65 | |
68 | 66 | struct socket *t_socket; /* back pointer to socket */ |
69 | 67 | /* |
... | ... | @@ -199,7 +197,6 @@ struct tcpstat { |
199 | 197 | u_long tcps_rcvbyte; /* bytes received in sequence */ |
200 | 198 | u_long tcps_rcvbadsum; /* packets received with ccksum errs */ |
201 | 199 | u_long tcps_rcvbadoff; /* packets received with bad offset */ |
202 | -/* u_long tcps_rcvshort; */ /* packets received too short */ | |
203 | 200 | u_long tcps_rcvduppack; /* duplicate-only packets received */ |
204 | 201 | u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ |
205 | 202 | u_long tcps_rcvpartduppack; /* packets with some duplicate data */ |
... | ... | @@ -215,7 +212,6 @@ struct tcpstat { |
215 | 212 | u_long tcps_rcvackpack; /* rcvd ack packets */ |
216 | 213 | u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ |
217 | 214 | u_long tcps_rcvwinupd; /* rcvd window update packets */ |
218 | -/* u_long tcps_pawsdrop; */ /* segments dropped due to PAWS */ | |
219 | 215 | u_long tcps_predack; /* times hdr predict ok for acks */ |
220 | 216 | u_long tcps_preddat; /* times hdr predict ok for data pkts */ |
221 | 217 | u_long tcps_socachemiss; /* tcp_last_so misses */ | ... | ... |
slirp/tftp.c
slirp/udp.c
... | ... | @@ -50,16 +50,6 @@ struct socket udb; |
50 | 50 | static u_int8_t udp_tos(struct socket *so); |
51 | 51 | static void udp_emu(struct socket *so, struct mbuf *m); |
52 | 52 | |
53 | -/* | |
54 | - * UDP protocol implementation. | |
55 | - * Per RFC 768, August, 1980. | |
56 | - */ | |
57 | -#ifndef COMPAT_42 | |
58 | -#define UDPCKSUM 1 | |
59 | -#else | |
60 | -#define UDPCKSUM 0 /* XXX */ | |
61 | -#endif | |
62 | - | |
63 | 53 | struct socket *udp_last_so = &udb; |
64 | 54 | |
65 | 55 | void |
... | ... | @@ -76,7 +66,6 @@ udp_input(register struct mbuf *m, int iphlen) |
76 | 66 | { |
77 | 67 | register struct ip *ip; |
78 | 68 | register struct udphdr *uh; |
79 | -/* struct mbuf *opts = 0;*/ | |
80 | 69 | int len; |
81 | 70 | struct ip save_ip; |
82 | 71 | struct socket *so; |
... | ... | @@ -129,14 +118,10 @@ udp_input(register struct mbuf *m, int iphlen) |
129 | 118 | /* |
130 | 119 | * Checksum extended UDP header and data. |
131 | 120 | */ |
132 | - if (UDPCKSUM && uh->uh_sum) { | |
121 | + if (uh->uh_sum) { | |
133 | 122 | memset(&((struct ipovly *)ip)->ih_mbuf, 0, sizeof(struct mbuf_ptr)); |
134 | 123 | ((struct ipovly *)ip)->ih_x1 = 0; |
135 | 124 | ((struct ipovly *)ip)->ih_len = uh->uh_ulen; |
136 | - /* keep uh_sum for ICMP reply | |
137 | - * uh->uh_sum = cksum(m, len + sizeof (struct ip)); | |
138 | - * if (uh->uh_sum) { | |
139 | - */ | |
140 | 125 | if(cksum(m, len + sizeof(struct ip))) { |
141 | 126 | STAT(udpstat.udps_badsum++); |
142 | 127 | goto bad; |
... | ... | @@ -201,7 +186,6 @@ udp_input(register struct mbuf *m, int iphlen) |
201 | 186 | /* |
202 | 187 | * Setup fields |
203 | 188 | */ |
204 | - /* udp_last_so = so; */ | |
205 | 189 | so->so_laddr = ip->ip_src; |
206 | 190 | so->so_lport = uh->uh_sport; |
207 | 191 | |
... | ... | @@ -246,7 +230,6 @@ udp_input(register struct mbuf *m, int iphlen) |
246 | 230 | return; |
247 | 231 | bad: |
248 | 232 | m_freem(m); |
249 | - /* if (opts) m_freem(opts); */ | |
250 | 233 | return; |
251 | 234 | } |
252 | 235 | |
... | ... | @@ -277,7 +260,7 @@ int udp_output2(struct socket *so, struct mbuf *m, |
277 | 260 | memset(&ui->ui_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); |
278 | 261 | ui->ui_x1 = 0; |
279 | 262 | ui->ui_pr = IPPROTO_UDP; |
280 | - ui->ui_len = htons(m->m_len - sizeof(struct ip)); /* + sizeof (struct udphdr)); */ | |
263 | + ui->ui_len = htons(m->m_len - sizeof(struct ip)); | |
281 | 264 | /* XXXXX Check for from-one-location sockets, or from-any-location sockets */ |
282 | 265 | ui->ui_src = saddr->sin_addr; |
283 | 266 | ui->ui_dst = daddr->sin_addr; |
... | ... | @@ -289,10 +272,8 @@ int udp_output2(struct socket *so, struct mbuf *m, |
289 | 272 | * Stuff checksum and output datagram. |
290 | 273 | */ |
291 | 274 | ui->ui_sum = 0; |
292 | - if (UDPCKSUM) { | |
293 | - if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0) | |
275 | + if ((ui->ui_sum = cksum(m, m->m_len)) == 0) | |
294 | 276 | ui->ui_sum = 0xffff; |
295 | - } | |
296 | 277 | ((struct ip *)ui)->ip_len = m->m_len; |
297 | 278 | |
298 | 279 | ((struct ip *)ui)->ip_ttl = IPDEFTTL; |
... | ... | @@ -363,8 +344,6 @@ void |
363 | 344 | udp_detach(struct socket *so) |
364 | 345 | { |
365 | 346 | closesocket(so->s); |
366 | - /* if (so->so_m) m_free(so->so_m); done by sofree */ | |
367 | - | |
368 | 347 | sofree(so); |
369 | 348 | } |
370 | 349 | |
... | ... | @@ -651,7 +630,6 @@ udp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, |
651 | 630 | return NULL; |
652 | 631 | } |
653 | 632 | setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); |
654 | -/* setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); */ | |
655 | 633 | |
656 | 634 | getsockname(so->s,(struct sockaddr *)&addr,&addrlen); |
657 | 635 | so->so_fport = addr.sin_port; | ... | ... |