| 
version 1.1.1.2, 2013/07/22 08:44:29
 | 
version 1.1.1.3, 2021/03/17 00:39:23
 | 
| 
 Line 126
 | 
 Line 126
 | 
 |    static void   PptpListenUpdate(Link l); | 
    static void   PptpListenUpdate(Link l); | 
 |   | 
   | 
 |    static struct pptplinkinfo    PptpIncoming(struct pptpctrlinfo *cinfo, | 
    static struct pptplinkinfo    PptpIncoming(struct pptpctrlinfo *cinfo, | 
|                                   struct u_addr *self, struct u_addr *peer, in_port_t port, int bearType, |                                   struct u_addr *self, struct u_addr *peer, in_port_t port, | 
 |                                    const char *callingNum, | 
                                    const char *callingNum, | 
|                                   const char *calledNum, |                                   const char *calledNum); | 
|                                   const char *subAddress); |   | 
 |   | 
   | 
 |    static struct pptplinkinfo    PptpOutgoing(struct pptpctrlinfo *cinfo, | 
    static struct pptplinkinfo    PptpOutgoing(struct pptpctrlinfo *cinfo, | 
|                                   struct u_addr *self, struct u_addr *peer, in_port_t port, int bearType, |                                   struct u_addr *self, struct u_addr *peer, in_port_t port, | 
|                                   int frameType, int minBps, int maxBps, |                                   const char *calledNum); | 
|                                   const char *calledNum, |   | 
|                                   const char *subAddress); |   | 
 |   | 
   | 
 |    static struct pptplinkinfo    PptpPeerCall(struct pptpctrlinfo *cinfo, | 
    static struct pptplinkinfo    PptpPeerCall(struct pptpctrlinfo *cinfo, | 
 |                                    struct u_addr *self, struct u_addr *peer, in_port_t port, int incoming, | 
                                    struct u_addr *self, struct u_addr *peer, in_port_t port, int incoming, | 
 |                                    const char *callingNum, | 
                                    const char *callingNum, | 
|                                   const char *calledNum, |                                   const char *calledNum); | 
|                                   const char *subAddress); |   | 
 |   | 
   | 
|   static int    PptpSetCommand(Context ctx, int ac, char *av[], void *arg); |   static int    PptpSetCommand(Context ctx, int ac, const char *const av[], const void *arg); | 
 |    static int    PptpTunEQ(struct ghash *g, const void *item1, const void *item2); | 
    static int    PptpTunEQ(struct ghash *g, const void *item1, const void *item2); | 
 |    static u_int32_t      PptpTunHash(struct ghash *g, const void *item); | 
    static u_int32_t      PptpTunHash(struct ghash *g, const void *item); | 
 |   | 
   | 
| 
 Line 196
 | 
 Line 192
 | 
 |          PptpSetCommand, NULL, 2, (void *) SET_ENABLE }, | 
          PptpSetCommand, NULL, 2, (void *) SET_ENABLE }, | 
 |      { "disable [opt ...]",              "Disable option", | 
      { "disable [opt ...]",              "Disable option", | 
 |          PptpSetCommand, NULL, 2, (void *) SET_DISABLE }, | 
          PptpSetCommand, NULL, 2, (void *) SET_DISABLE }, | 
|     { NULL }, |     { NULL, NULL, NULL, NULL, 0, NULL }, | 
 |    }; | 
    }; | 
 |   | 
   | 
 |  /* | 
  /* | 
| 
 Line 214
 | 
 Line 210
 | 
 |      { 0,        0,                      NULL            }, | 
      { 0,        0,                      NULL            }, | 
 |    }; | 
    }; | 
 |   | 
   | 
| struct ghash    *gPptpTuns; | static struct ghash    *gPptpTuns; | 
 |   | 
   | 
 |  /* | 
  /* | 
 |   * PptpTInit() | 
   * PptpTInit() | 
| 
 Line 591  PptpPeerMacAddr(Link l, void *buf, size_t buf_len)
 | 
 Line 587  PptpPeerMacAddr(Link l, void *buf, size_t buf_len)
 | 
 |  { | 
  { | 
 |      PptpInfo    const pptp = (PptpInfo) l->info; | 
      PptpInfo    const pptp = (PptpInfo) l->info; | 
 |   | 
   | 
|     if (pptp->peer_iface[0]) { |     if (buf_len >= 18 && pptp->peer_iface[0]) { | 
 |          ether_ntoa_r((struct ether_addr *)pptp->peer_mac_addr, buf); | 
          ether_ntoa_r((struct ether_addr *)pptp->peer_mac_addr, buf); | 
 |          return (0); | 
          return (0); | 
 |      } | 
      } | 
| 
 Line 784  PptpTunEQ(struct ghash *g, const void *item1, const vo
 | 
 Line 780  PptpTunEQ(struct ghash *g, const void *item1, const vo
 | 
 |  { | 
  { | 
 |      const struct pptptun *tun1 = item1; | 
      const struct pptptun *tun1 = item1; | 
 |      const struct pptptun *tun2 = item2; | 
      const struct pptptun *tun2 = item2; | 
 |   | 
   | 
 |   | 
      (void)g; | 
 |      if (u_addrcompare(&tun1->self_addr, &tun2->self_addr) == 0 && | 
      if (u_addrcompare(&tun1->self_addr, &tun2->self_addr) == 0 && | 
 |          u_addrcompare(&tun1->peer_addr, &tun2->peer_addr) == 0) | 
          u_addrcompare(&tun1->peer_addr, &tun2->peer_addr) == 0) | 
 |              return (1); | 
              return (1); | 
| 
 Line 794  static u_int32_t
 | 
 Line 792  static u_int32_t
 | 
 |  PptpTunHash(struct ghash *g, const void *item) | 
  PptpTunHash(struct ghash *g, const void *item) | 
 |  { | 
  { | 
 |      const struct pptptun *tun = item; | 
      const struct pptptun *tun = item; | 
 |   | 
   | 
 |   | 
      (void)g; | 
 |      return (u_addrtoid(&tun->self_addr) + u_addrtoid(&tun->peer_addr)); | 
      return (u_addrtoid(&tun->self_addr) + u_addrtoid(&tun->peer_addr)); | 
 |  } | 
  } | 
 |   | 
   | 
| 
 Line 913  PptpHookUp(Link l)
 | 
 Line 913  PptpHookUp(Link l)
 | 
 |          /* increase recvspace to avoid packet loss due to very small GRE recv buffer. */ | 
          /* increase recvspace to avoid packet loss due to very small GRE recv buffer. */ | 
 |          ksso->level=SOL_SOCKET; | 
          ksso->level=SOL_SOCKET; | 
 |          ksso->name=SO_RCVBUF; | 
          ksso->name=SO_RCVBUF; | 
|         ((int *)(ksso->value))[0]=48*1024; |         ((int *)(void *)(ksso->value))[0]=48*1024; | 
 |          if (NgSendMsg(csock, ksockpath, NGM_KSOCKET_COOKIE, | 
          if (NgSendMsg(csock, ksockpath, NGM_KSOCKET_COOKIE, | 
 |              NGM_KSOCKET_SETOPT, &u, sizeof(u)) < 0) { | 
              NGM_KSOCKET_SETOPT, &u, sizeof(u)) < 0) { | 
 |                  Perror("[%s] PPTP: can't setsockopt %s node", | 
                  Perror("[%s] PPTP: can't setsockopt %s node", | 
| 
 Line 985  PptpHookUp(Link l)
 | 
 Line 985  PptpHookUp(Link l)
 | 
 |   | 
   | 
 |  static struct pptplinkinfo | 
  static struct pptplinkinfo | 
 |  PptpIncoming(struct pptpctrlinfo *cinfo, | 
  PptpIncoming(struct pptpctrlinfo *cinfo, | 
|         struct u_addr *self, struct u_addr *peer, in_port_t port, int bearType, |         struct u_addr *self, struct u_addr *peer, in_port_t port, | 
 |          const char *callingNum, | 
          const char *callingNum, | 
|         const char *calledNum, |         const char *calledNum) | 
|         const char *subAddress) |   | 
 |  { | 
  { | 
|     return(PptpPeerCall(cinfo, self, peer, port, TRUE, callingNum, calledNum, subAddress)); |     return(PptpPeerCall(cinfo, self, peer, port, TRUE, callingNum, calledNum)); | 
 |  } | 
  } | 
 |   | 
   | 
 |  /* | 
  /* | 
| 
 Line 1004  PptpIncoming(struct pptpctrlinfo *cinfo,
 | 
 Line 1003  PptpIncoming(struct pptpctrlinfo *cinfo,
 | 
 |   | 
   | 
 |  static struct pptplinkinfo | 
  static struct pptplinkinfo | 
 |  PptpOutgoing(struct pptpctrlinfo *cinfo, | 
  PptpOutgoing(struct pptpctrlinfo *cinfo, | 
|         struct u_addr *self, struct u_addr *peer, in_port_t port, int bearType, |         struct u_addr *self, struct u_addr *peer, in_port_t port, | 
|         int frameType, int minBps, int maxBps, |         const char *calledNum) | 
|         const char *calledNum, const char *subAddress) |   | 
 |  { | 
  { | 
|     return(PptpPeerCall(cinfo, self, peer, port, FALSE, "", calledNum, subAddress)); |     return(PptpPeerCall(cinfo, self, peer, port, FALSE, "", calledNum)); | 
 |  } | 
  } | 
 |   | 
   | 
 |  /* | 
  /* | 
| 
 Line 1023  static struct pptplinkinfo
 | 
 Line 1021  static struct pptplinkinfo
 | 
 |  PptpPeerCall(struct pptpctrlinfo *cinfo, | 
  PptpPeerCall(struct pptpctrlinfo *cinfo, | 
 |          struct u_addr *self, struct u_addr *peer, in_port_t port, int incoming, | 
          struct u_addr *self, struct u_addr *peer, in_port_t port, int incoming, | 
 |          const char *callingNum, | 
          const char *callingNum, | 
|         const char *calledNum, |         const char *calledNum) | 
|         const char *subAddress) |   | 
 |  { | 
  { | 
 |      struct pptplinkinfo linfo; | 
      struct pptplinkinfo linfo; | 
 |      Link                l = NULL; | 
      Link                l = NULL; | 
| 
 Line 1171  PptpListenUpdate(Link l)
 | 
 Line 1168  PptpListenUpdate(Link l)
 | 
 |   */ | 
   */ | 
 |   | 
   | 
 |  static int | 
  static int | 
| PptpSetCommand(Context ctx, int ac, char *av[], void *arg) | PptpSetCommand(Context ctx, int ac, const char *const av[], const void *arg) | 
 |  { | 
  { | 
 |      PptpInfo            const pi = (PptpInfo) ctx->lnk->info; | 
      PptpInfo            const pi = (PptpInfo) ctx->lnk->info; | 
 |      char                **fqdn_peer_addr = &pi->conf.fqdn_peer_addr; | 
      char                **fqdn_peer_addr = &pi->conf.fqdn_peer_addr; |