Use TUNSIFPID when we change our PID (if it exists).

This commit is contained in:
Brian Somers 2000-01-21 00:33:27 +00:00
parent bbdecb957c
commit 06b47306d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56350
3 changed files with 12 additions and 1 deletions

View File

@ -30,7 +30,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <net/if_tun.h> /* For TUNSIFMODE & TUNSLMODE */
#include <net/if_tun.h> /* For TUNSIFMODE, TUNSLMODE & TUNSIFPID*/
#include <arpa/inet.h>
#include <net/route.h>
#include <netinet/in_systm.h>
@ -1738,6 +1738,7 @@ bundle_setsid(struct bundle *bundle, int holdsession)
read(fds[0], &done, 1); /* uu_locks are mine ! */
close(fds[0]);
setsid();
bundle_ChangedPID(bundle);
log_Printf(LogPHASE, "%d -> %d: %s session control\n",
(int)orig, (int)getpid(),
holdsession ? "Passed" : "Dropped");
@ -1940,3 +1941,11 @@ bundle_WantAutoloadTimer(struct bundle *bundle)
return 0;
}
void
bundle_ChangedPID(struct bundle *bundle)
{
#ifdef TUNSIFPID
ioctl(bundle->dev.fd, TUNSIFPID, 0);
#endif
}

View File

@ -187,3 +187,4 @@ extern void bundle_AdjustFilters(struct bundle *, struct in_addr *,
extern void bundle_CalculateBandwidth(struct bundle *);
extern void bundle_AutoAdjust(struct bundle *, int, int);
extern int bundle_WantAutoloadTimer(struct bundle *);
extern void bundle_ChangedPID(struct bundle *);

View File

@ -463,6 +463,7 @@ main(int argc, char **argv)
bundle->notify.fd = bgpipe[1];
}
bundle_ChangedPID(bundle);
bundle_LockTun(bundle); /* we have a new pid */
}