chiark
/
gitweb
/
~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server/tun-slip.c: Pass correct stdout to child process.
[tripe]
/
server
/
tun-slip.c
diff --git
a/server/tun-slip.c
b/server/tun-slip.c
index 2c99a81a9d7db80342229668276dc728f9a1edd1..264d1d42477ab166b2765b3003c8aa90f6f91159 100644
(file)
--- a/
server/tun-slip.c
+++ b/
server/tun-slip.c
@@
-62,11
+62,6
@@
static const char *slipcmd; /* Script to make new interfaces */
/*----- Main code ---------------------------------------------------------*/
/*----- Main code ---------------------------------------------------------*/
-#define SL_END 0xc0
-#define SL_ESC 0xdb
-#define SL_ESCEND 0xdc
-#define SL_ESCESC 0xdd
-
/* --- @t_read@ --- *
*
* Arguments: @int fd@ = file descriptor to read
/* --- @t_read@ --- *
*
* Arguments: @int fd@ = file descriptor to read
@@
-251,6
+246,7
@@
whine:
/* --- @t_create@ --- *
*
* Arguments: @peer *p@ = pointer to peer block
/* --- @t_create@ --- *
*
* Arguments: @peer *p@ = pointer to peer block
+ * @int fd@ = file descriptor of tunnel device (unused)
* @char **ifn@ = where to put the interface name
*
* Returns: A tunnel block if it worked, or null on failure.
* @char **ifn@ = where to put the interface name
*
* Returns: A tunnel block if it worked, or null on failure.
@@
-258,10
+254,11
@@
whine:
* Use: Initializes a new tunnel.
*/
* Use: Initializes a new tunnel.
*/
-static tunnel *t_create(peer *p, char **ifn)
+static tunnel *t_create(peer *p,
int fd,
char **ifn)
{
slipif *sl = 0;
int pin[2] = { -1, -1 }, pout[2] = { -1, -1 };
{
slipif *sl = 0;
int pin[2] = { -1, -1 }, pout[2] = { -1, -1 };
+ mdup_fd md[2];
pid_t kid = -1;
dstr d = DSTR_INIT;
unsigned char ch;
pid_t kid = -1;
dstr d = DSTR_INIT;
unsigned char ch;
@@
-296,10
+293,10
@@
static tunnel *t_create(peer *p, char **ifn)
goto fail;
}
if (!kid) {
goto fail;
}
if (!kid) {
- close(pin[1]);
-
close(pout[0])
;
-
dup2(pin[0], STDIN_FILENO)
;
-
dup2(pout[1], STDOUT_FILENO
);
+ close(pin[1]);
close(pout[0]);
+
md[0].cur = pin[0]; md[0].want = STDIN_FILENO
;
+
md[1].cur = pout[1]; md[1].want = STDOUT_FILENO
;
+
mdup(md, 2
);
execlp(slipcmd, slipcmd, p_name(p), (char *)0);
_exit(127);
}
execlp(slipcmd, slipcmd, p_name(p), (char *)0);
_exit(127);
}
@@
-444,6
+441,7
@@
static void t_destroy(tunnel *t)
const tunnel_ops tun_slip = {
"slip",
const tunnel_ops tun_slip = {
"slip",
+ 0,
t_init,
t_create,
t_setifname,
t_init,
t_create,
t_setifname,