Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 152311 Details for
Bug 235392
2.6.21.x kernels: IP MASQUERADE initialization problems
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Mac-On-Linux TUN test framework source code
tun-setup.c (text/plain), 1.29 KB, created by
Joseph Sacco
on 2007-04-11 18:37:47 UTC
(
hide
)
Description:
Mac-On-Linux TUN test framework source code
Filename:
MIME Type:
Creator:
Joseph Sacco
Created:
2007-04-11 18:37:47 UTC
Size:
1.29 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <sys/wait.h> >#include <fcntl.h> >#include <errno.h> >#include <ctype.h> >#include <sys/ioctl.h> >#include <sys/socket.h> > > >#include <linux/if.h> >#include <linux/if_tun.h> > >int tun_alloc(char *dev) >{ > struct ifreq ifr; > int fd, err; > > /* allocate tun/tap device */ > if( (fd=open("/dev/net/tun", O_RDWR | O_NONBLOCK)) < 0 ) { > return -1; > } > fcntl( fd, F_SETFD, FD_CLOEXEC ); > > memset( &ifr, 0, sizeof(ifr) ); > > ifr.ifr_flags = IFF_TUN | IFF_NO_PI; > > strncpy( ifr.ifr_name, dev, IFNAMSIZ ); > if( ioctl(fd, TUNSETIFF, &ifr) < 0 ){ > goto out; > } > > /* don't checksum */ > ioctl( fd, TUNSETNOCSUM, 1 ); > > strcpy(dev, ifr.ifr_name); > return fd; > >out: > close(fd); > return -1; > } > >int main(char* argv, int argc) >{ > int fd, status; > pid_t pid; > char tundev[4]; > > /* allocate a tunnel: tun1 */ > sprintf(tundev,"%s","tun1"); > fd = tun_alloc(tundev); > > /* configure device */ > if ( !(pid=fork()) ) { > execlp("./tunconfig", "tunconfig", "tun1", "up", NULL); > } > (void)waitpid(pid,&status,0); > if( !WIFEXITED(status) ) { > printf("!WIFEXITED()\n"); > close(fd); > return -1; > } > > /* spin for a while */ > sleep(15); > > /* clean up and exit */ > close(fd); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 235392
:
152310
| 152311