- int tunfd = tun_open("tungre");
- int gresock = socket(AF_INET6, SOCK_RAW, IPPROTO_GRE);
- if (gresock == -1) {
- perror("socket");
- exit(1);
- }
-
- sockaddr_in6 my_addr;
- memset(&my_addr, 0, sizeof(my_addr));
- my_addr.sin6_family = AF_INET6;
- my_addr.sin6_addr = get_addr(argv[1]);
- if (bind(gresock, (sockaddr *)&my_addr, sizeof(my_addr)) == -1) {
- perror("bind");
- exit(1);
- }
-