Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/btpand when a BNEP channel is opened, clear any Net...



details:   https://anonhg.NetBSD.org/src/rev/f2ecc1c6cf97
branches:  trunk
changeset: 761434:f2ecc1c6cf97
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Jan 27 12:19:48 2011 +0000

description:
when a BNEP channel is opened, clear any NetType or MulticastAddress
filters that may be in effect at the remote side.

diffstat:

 usr.sbin/btpand/bnep.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r bc9affdd5b83 -r f2ecc1c6cf97 usr.sbin/btpand/bnep.c
--- a/usr.sbin/btpand/bnep.c    Thu Jan 27 11:33:43 2011 +0000
+++ b/usr.sbin/btpand/bnep.c    Thu Jan 27 12:19:48 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bnep.c,v 1.8 2009/05/12 21:08:30 plunky Exp $  */
+/*     $NetBSD: bnep.c,v 1.9 2011/01/27 12:19:48 plunky Exp $  */
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bnep.c,v 1.8 2009/05/12 21:08:30 plunky Exp $");
+__RCSID("$NetBSD: bnep.c,v 1.9 2011/01/27 12:19:48 plunky Exp $");
 
 #include <bluetooth.h>
 #include <sdp.h>
@@ -370,6 +370,10 @@
            ether_ntoa((struct ether_addr *)chan->raddr), rsp);
 
        bnep_send_control(chan, BNEP_SETUP_CONNECTION_RESPONSE, rsp);
+       if (rsp == BNEP_SETUP_SUCCESS) {
+               bnep_send_control(chan, BNEP_FILTER_NET_TYPE_SET);
+               bnep_send_control(chan, BNEP_FILTER_MULTI_ADDR_SET);
+       }
        return (len * 2 + 1);
 }
 
@@ -394,6 +398,8 @@
        if (rsp == BNEP_SETUP_SUCCESS) {
                chan->state = CHANNEL_OPEN;
                channel_timeout(chan, 0);
+               bnep_send_control(chan, BNEP_FILTER_NET_TYPE_SET);
+               bnep_send_control(chan, BNEP_FILTER_MULTI_ADDR_SET);
        } else {
                chan->down(chan);
        }
@@ -480,7 +486,6 @@
                log_err("filter_net_type: addr %s response 0x%2.2x",
                    ether_ntoa((struct ether_addr *)chan->raddr), rsp);
 
-       /* we did not send any filter_net_type_set message */
        return 2;
 }
 
@@ -570,7 +575,6 @@
                log_err("filter_multi_addr: addr %s response 0x%2.2x",
                    ether_ntoa((struct ether_addr *)chan->raddr), rsp);
 
-       /* we did not send any filter_multi_addr_set message */
        return 2;
 }
 
@@ -613,8 +617,12 @@
                p += 2;
                break;
 
-       case BNEP_FILTER_NET_TYPE_SET:          /* TODO */
-       case BNEP_FILTER_MULTI_ADDR_SET:        /* TODO */
+       case BNEP_FILTER_NET_TYPE_SET:
+       case BNEP_FILTER_MULTI_ADDR_SET:
+               be16enc(p, 0);  /* just clear filters for now */
+               p += 2;
+               break;
+
        default:
                log_err("Can't send control type 0x%2.2x", type);
                break;



Home | Main Index | Thread Index | Old Index