Merge from vendor branch FREEBSD:
[pkgsrc.git] / net / pptp / patches / patch-ab
1 $NetBSD$
2
3 Index: pptp.c
4 --- pptp.c.orig 1998/09/02 14:40:54
5 +++ pptp.c      1999/02/12 14:23:28
6 @@ -71,6 +71,8 @@
7    /* Step 1: Get IP address for the hostname in argv[1] */
8    inetaddr = get_ip_address(argv[1]);
9  
10 +  log("using remote IP address %s\n", inet_ntoa(inetaddr));
11 +
12    /* Step 2: Open connection to call manager
13     *         (Launch call manager if necessary.)
14     */
15 @@ -127,8 +129,8 @@
16    }
17  
18    /* Step 6: Do GRE copy until close. */
19 -  pptp_gre_copy(call_id, peer_call_id, pty_fd, inetaddr);
20 -
21 +  pptp_gre_copy(peer_call_id, call_id, pty_fd, inetaddr);
22
23  shutdown:
24    /* on close, kill all. */
25    kill(parent_pid, SIGTERM);
26 @@ -140,13 +142,14 @@
27  struct in_addr get_ip_address(char *name) {
28    struct in_addr retval;
29    struct hostent *host = gethostbyname(name);
30 -  if (host==NULL)
31 +  if (host==NULL) {
32      if (h_errno == HOST_NOT_FOUND)
33        fatal("gethostbyname: HOST NOT FOUND");
34      else if (h_errno == NO_ADDRESS)
35        fatal("gethostbyname: NO IP ADDRESS");
36      else
37        fatal("gethostbyname: name server error");
38 +  }
39    
40    if (host->h_addrtype != AF_INET)
41      fatal("Host has non-internet address");
42 @@ -239,9 +242,14 @@
43    new_argv[0] = PPPD_BINARY;
44    new_argv[1] = ttydev;
45    new_argv[2] = "38400";
46 -  for (i=0; i<argc; i++)
47 -    new_argv[i+3] = argv[i];
48 +  fprintf(stderr, "running pppd: %s %s %s", new_argv[0], new_argv[1], new_argv[2]);
49 +  for (i=0; i<argc; i++) {
50 +      fprintf(stderr, " %s", argv[i]);
51 +      new_argv[i+3] = argv[i];
52 +  }
53 +  fprintf(stderr, "\n");
54    new_argv[i+3] = NULL;
55 +  
56    execvp(new_argv[0], new_argv);
57  }
58