Bridging

2014-10-22 Thread Anton Voyl
Hello,

Is it possible to bridge an interface that is managed by connman (e.g. wlan0) 
and an interface that is not managed by connman?

Does connman provide something like:
brctl addbr bridge
brctl addif bridge wlan0
brctl addif bridge other

Would it be possible to have connman manage the bridge?

Thank you for your attention, and regards,

Anton Voyl




___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: Bridging

2014-10-23 Thread Patrik Flykt

Hi,

On Wed, 2014-10-22 at 18:54 +0200, Anton Voyl wrote:
> Hello,
> 
> Is it possible to bridge an interface that is managed by connman (e.g.
> wlan0) and an interface that is not managed by connman?
> 
> Does connman provide something like:
> brctl addbr bridge
> brctl addif bridge wlan0
> brctl addif bridge other
> 
> Would it be possible to have connman manage the bridge?

If you enable tethering, ConnMan will set up a bridge and add all
necessary interfaces to the bridge on a technology basis. For WiFi only
AP capable interfaces will be added. The same bridge is used across
different technologies which means that connected Bluetooth PANU, WiFi
stations, ethernet and USB devices can connect to each other. If there
is a ConnMan service connected that provides an uplink Internet
connection, a Linux kernel masquerading rule takes care of NAT.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[RFC v0 0/6] Refactore bridging

2012-02-01 Thread Daniel Wagner
From: Daniel Wagner 

Hi,

These patches here factor out some code from tethering so that the session
code can access it. WIP.

You need the iptable patches from Tomasz for this here.

cheers,
daniel

Daniel Wagner (6):
  iptables-test: Parse also netmask for src/dst addresses
  iptables: Parse also netmask for src/dst addresses
  bridge: Move bridge code into a seperate file
  tethering: Use notifier to update default interface.
  nat: Move nat code into a seperate file
  test-nat: Add nat unit test

 Makefile.am   |   10 ++-
 src/connman.h |   14 +++-
 src/iptables.c|   47 --
 src/main.c|2 +
 src/nat.c |  235 +
 src/notifier.c|5 -
 src/tethering.c   |  215 -
 tools/iptables-test.c |   48 --
 unit/test-nat.c   |  126 ++
 9 files changed, 479 insertions(+), 223 deletions(-)
 create mode 100644 src/nat.c
 create mode 100644 unit/test-nat.c

-- 
1.7.9.48.g85da4d

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [RFC v0 0/6] Refactore bridging

2012-02-13 Thread Samuel Ortiz
Hi Daniel,

On Wed, Feb 01, 2012 at 06:51:41PM +0100, Daniel Wagner wrote:
> From: Daniel Wagner 
> 
> Hi,
> 
> These patches here factor out some code from tethering so that the session
> code can access it. WIP.
> 
> You need the iptable patches from Tomasz for this here.
All 6 patches applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH 2/2] inet: Fix error handling when bridging interfaces

2013-01-07 Thread Forest Bond
From: Forest Bond 

Functions that add and remove interfaces to and from bridges now return
an appropriate error code.
---
 src/inet.c |   40 ++--
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/inet.c b/src/inet.c
index c360f56..0027fe6 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -1183,59 +1183,63 @@ connman_bool_t connman_inet_compare_subnet(int index, 
const char *host)
 int connman_inet_remove_from_bridge(int index, const char *bridge)
 {
struct ifreq ifr;
-   int sk, err;
+   int sk, err = 0;
 
if (bridge == NULL)
return -EINVAL;
 
sk = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
-   if (sk < 0)
-   return sk;
+   if (sk < 0) {
+   err = -errno;
+   goto out;
+   }
 
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, bridge, IFNAMSIZ - 1);
ifr.ifr_ifindex = index;
 
-   err = ioctl(sk, SIOCBRDELIF, &ifr);
+   if (ioctl(sk, SIOCBRDELIF, &ifr) < 0)
+   err = -errno;
 
close(sk);
 
-   if (err < 0) {
+out:
+   if (err < 0)
connman_error("Remove interface from bridge error %s",
-   strerror(errno));
-   return err;
-   }
+   strerror(-err));
 
-   return 0;
+   return err;
 }
 
 int connman_inet_add_to_bridge(int index, const char *bridge)
 {
struct ifreq ifr;
-   int sk, err;
+   int sk, err = 0;
 
if (bridge == NULL)
return -EINVAL;
 
sk = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
-   if (sk < 0)
-   return sk;
+   if (sk < 0) {
+   err = -errno;
+   goto out;
+   }
 
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, bridge, IFNAMSIZ - 1);
ifr.ifr_ifindex = index;
 
-   err = ioctl(sk, SIOCBRADDIF, &ifr);
+   if (ioctl(sk, SIOCBRADDIF, &ifr) < 0)
+   err = -errno;
 
close(sk);
 
-   if (err < 0) {
+out:
+   if (err < 0)
connman_error("Add interface to bridge error %s",
-   strerror(errno));
-   return err;
-   }
+   strerror(-err));
 
-   return 0;
+   return err;
 }
 
 int connman_inet_set_mtu(int index, int mtu)
-- 
1.7.0.4
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH 2/2] inet: Fix error handling when bridging interfaces

2013-01-08 Thread Patrik Flykt
On Mon, 2013-01-07 at 09:24 -0500, Forest Bond wrote:
> From: Forest Bond 
> 
> Functions that add and remove interfaces to and from bridges now return
> an appropriate error code.

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman