[Ntop-dev] n2n-patch: use hostname for supernode

Hai hai.zhao at gmail.com
Thu May 15 12:10:57 CEST 2008


With this patch, you can use hostname for supernode.


Index: edge.c
===================================================================
--- edge.c      (revision 3484)
+++ edge.c      (working copy)
@@ -995,10 +995,10 @@
        char *supernode_host = strtok(optarg, ":");
        if(supernode_host) {
          char *supernode_port = strtok(NULL, ":");
-
-         if(supernode_port) {
+         struct hostent *h = gethostbyname(supernode_host);
+         if(h && supernode_port) {
            supernode.port = htons(atoi(supernode_port));
-           supernode.addr_type.v4_addr = inet_addr(supernode_host);
+           supernode.addr_type.v4_addr = *((u_int32_t *)(h->h_addr));
          } else
            traceEvent(TRACE_WARNING, "Wrong supernode parameter (-l)");
        } else
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listgateway.unipi.it/pipermail/ntop-dev/attachments/20080515/866be300/attachment.html 


More information about the Ntop-dev mailing list