diff options
author | sjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com> | 2012-03-11 06:28:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-11 18:38:16 -0400 |
commit | e3abcc2a8538f7d5f64dbf85404bdf8a1d1581b3 (patch) | |
tree | 68ea01fce98ab33507788f2c1ae8f830c077e987 /net/caif | |
parent | 374458b3fe4288f820dbf3de0728e314d969f9e4 (diff) |
caif: make zero a legal caif connetion id.
Connection ID configured through RTNL must allow zero as
connection id. If connection-id is not given when creating the
interface, configure a loopback interface using ifindex as
connection-id.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif')
-rw-r--r-- | net/caif/chnl_net.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index e866234d0e5a..20618dd3088b 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -28,6 +28,7 @@ | |||
28 | /* 5 sec. connect timeout */ | 28 | /* 5 sec. connect timeout */ |
29 | #define CONNECT_TIMEOUT (5 * HZ) | 29 | #define CONNECT_TIMEOUT (5 * HZ) |
30 | #define CAIF_NET_DEFAULT_QUEUE_LEN 500 | 30 | #define CAIF_NET_DEFAULT_QUEUE_LEN 500 |
31 | #define UNDEF_CONNID 0xffffffff | ||
31 | 32 | ||
32 | /*This list is protected by the rtnl lock. */ | 33 | /*This list is protected by the rtnl lock. */ |
33 | static LIST_HEAD(chnl_net_list); | 34 | static LIST_HEAD(chnl_net_list); |
@@ -408,7 +409,7 @@ static void ipcaif_net_setup(struct net_device *dev) | |||
408 | priv->conn_req.link_selector = CAIF_LINK_HIGH_BANDW; | 409 | priv->conn_req.link_selector = CAIF_LINK_HIGH_BANDW; |
409 | priv->conn_req.priority = CAIF_PRIO_LOW; | 410 | priv->conn_req.priority = CAIF_PRIO_LOW; |
410 | /* Insert illegal value */ | 411 | /* Insert illegal value */ |
411 | priv->conn_req.sockaddr.u.dgm.connection_id = 0; | 412 | priv->conn_req.sockaddr.u.dgm.connection_id = UNDEF_CONNID; |
412 | priv->flowenabled = false; | 413 | priv->flowenabled = false; |
413 | 414 | ||
414 | init_waitqueue_head(&priv->netmgmt_wq); | 415 | init_waitqueue_head(&priv->netmgmt_wq); |
@@ -471,9 +472,11 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev, | |||
471 | else | 472 | else |
472 | list_add(&caifdev->list_field, &chnl_net_list); | 473 | list_add(&caifdev->list_field, &chnl_net_list); |
473 | 474 | ||
474 | /* Take ifindex as connection-id if null */ | 475 | /* Use ifindex as connection id, and use loopback channel default. */ |
475 | if (caifdev->conn_req.sockaddr.u.dgm.connection_id == 0) | 476 | if (caifdev->conn_req.sockaddr.u.dgm.connection_id == UNDEF_CONNID) { |
476 | caifdev->conn_req.sockaddr.u.dgm.connection_id = dev->ifindex; | 477 | caifdev->conn_req.sockaddr.u.dgm.connection_id = dev->ifindex; |
478 | caifdev->conn_req.protocol = CAIFPROTO_DATAGRAM_LOOP; | ||
479 | } | ||
477 | return ret; | 480 | return ret; |
478 | } | 481 | } |
479 | 482 | ||