Add Opaque option which prevent information from being forwarded to certain nodes.
[tinc] / src / protocol_subnet.c
index 48b5efe..cb33ba0 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: protocol_subnet.c,v 1.1.4.14 2003/07/22 20:55:20 guus Exp $
+    $Id: protocol_subnet.c,v 1.1.4.16 2003/11/10 22:31:53 guus Exp $
 */
 
 #include "system.h"
@@ -33,7 +33,7 @@
 #include "utils.h"
 #include "xalloc.h"
 
-bool send_add_subnet(connection_t *c, subnet_t *subnet)
+bool send_add_subnet(connection_t *c, const subnet_t *subnet)
 {
        bool x;
        char *netstr;
@@ -94,6 +94,9 @@ bool add_subnet_h(connection_t *c)
                node_add(owner);
        }
 
+       if(c->status.opaque && owner != myself && owner != c->node)
+               return false;
+
        /* Check if we already know this subnet */
 
        if(lookup_subnet(owner, s)) {
@@ -117,12 +120,13 @@ bool add_subnet_h(connection_t *c)
 
        /* Tell the rest */
 
-       forward_request(c);
+       if(!c->status.opaque)
+               forward_request(c);
 
        return true;
 }
 
-bool send_del_subnet(connection_t *c, subnet_t *s)
+bool send_del_subnet(connection_t *c, const subnet_t *s)
 {
        bool x;
        char *netstr;
@@ -171,6 +175,9 @@ bool del_subnet_h(connection_t *c)
                return true;
        }
 
+       if(c->status.opaque && owner != myself && owner != c->node)
+               return false;
+
        /* Check if subnet string is valid */
 
        s = str2net(subnetstr);
@@ -209,7 +216,8 @@ bool del_subnet_h(connection_t *c)
 
        /* Tell the rest */
 
-       forward_request(c);
+       if(!c->status.opaque)
+               forward_request(c);
 
        /* Finally, delete it. */