summaryrefslogtreecommitdiffstats
path: root/network/bridge.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-29 21:49:17 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-29 21:49:17 +0000
commit778fb0ca85a18c20a60cbd44c8786d60efe4d297 (patch)
tree5584329701619c82327d16dcdd9911727f6fbcbf /network/bridge.c
parent3b82e98cb01ce9632701c0872e5e64f1290a0c8a (diff)
network: Added bridge add interface function
Diffstat (limited to 'network/bridge.c')
-rw-r--r--network/bridge.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/network/bridge.c b/network/bridge.c
index 76c2a507..a6930194 100644
--- a/network/bridge.c
+++ b/network/bridge.c
@@ -74,3 +74,20 @@ int bridge_remove(const char *name)
return 0;
}
+
+int bridge_add_interface(const char *bridge, const char *dev)
+{
+ struct ifreq ifr;
+ int ifindex = if_nametoindex(dev);
+
+ if (ifindex == 0)
+ return -ENODEV;
+
+ strncpy(ifr.ifr_name, bridge, IFNAMSIZ);
+ ifr.ifr_ifindex = ifindex;
+
+ if (ioctl(bridge_socket, SIOCBRADDIF, &ifr) < 0)
+ return -errno;
+
+ return 0;
+}