- add macvlan aka VESA support d63a9b2b1e4e3eab0d0577d0a0f412d50be1e0a7

- kernel headers 2.6.33 ab322673298bd0b8927cdd9d11f3d36af5941b93 are needed
    for macvlan features and probably for other added later.
- fix number of release which contains 2.6.32 kernel headers and features
    but it was released as 2.6.31
This commit is contained in:
Marcela Mašláňová 2010-01-27 08:42:53 +00:00
parent 48890cc51a
commit a826967060
3 changed files with 2055 additions and 3 deletions

View File

@ -1,13 +1,15 @@
#%define date_version 20091106
%define cbq_version v0.7.3
%define up_version 2.6.31
Summary: Advanced IP routing and network device configuration tools
Name: iproute
Version: 2.6.31
Version: 2.6.32
Release: 1%{?dist}
Group: Applications/System
##Source: iproute2-%{date_version}.tar.bz2
Source: http://developer.osdl.org/dev/iproute2/download/iproute2-%{version}.tar.bz2
# mistake in number of release it's really 2.6.32 but upstream released it as 2.6.31.tar
Source: http://developer.osdl.org/dev/iproute2/download/iproute2-%{up_version}.tar.bz2
URL: http://linux-net.osdl.org/index.php/Iproute2
Patch0: man-pages.patch
Patch1: iproute2-2.6.29-kernel.patch
@ -17,6 +19,8 @@ Patch4: iproute2-sharepath.patch
Patch5: iproute2-2.6.31-tc_modules.patch
Patch6: iproute2-2.6.29-IPPROTO_IP_for_SA.patch
Patch7: iproute2-example-cbq-service.patch
Patch8: iproute2-2.6.32-macvlan.patch
Patch9: iproute2-2.6.33-kernel-headers.patch
License: GPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -39,7 +43,7 @@ License: GPLv2+
The iproute documentation contains howtos and examples of settings.
%prep
%setup -q -n iproute2-%{version}
%setup -q -n iproute2-%{up_version}
%patch0 -p1
%patch1 -p1 -b .kernel
%patch2 -p1 -b .opt_flags
@ -48,6 +52,8 @@ The iproute documentation contains howtos and examples of settings.
%patch5 -p1 -b .ipt
%patch6 -p1 -b .ipproto
%patch7 -p1 -b .fix_cbq
%patch8 -p1 -b .macvlan
%patch9 -p1 -b .headers
%build
export LIBDIR=/%{_libdir}
@ -126,6 +132,13 @@ EOF
%doc RELNOTES
%changelog
* Tue Jan 26 2010 Marcela Mašláňová <mmaslano@redhat.com> - 2.6.32-2
- add macvlan aka VESA support d63a9b2b1e4e3eab0d0577d0a0f412d50be1e0a7
- kernel headers 2.6.33 ab322673298bd0b8927cdd9d11f3d36af5941b93
are needed for macvlan features and probably for other added later.
- fix number of release which contains 2.6.32 kernel headers and features
but it was released as 2.6.31
* Mon Jan 4 2010 Marcela Mašláňová <mmaslano@redhat.com> - 2.6.31-1
- update to 2.6.31

View File

@ -0,0 +1,158 @@
From d63a9b2b1e4e3eab0d0577d0a0f412d50be1e0a7 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Sat, 26 Dec 2009 11:22:57 -0800
Subject: [PATCH] iproute2/iplink: add macvlan options for bridge mode
Macvlan can now optionally support forwarding between its
ports, if they are in "bridge" mode. This adds support
for this option to "ip link add", "ip link set" and "ip
-d link show".
The default mode in the kernel is now "vepa" mode, meaning
"virtual ethernet port aggregator". This mode is used
together with the "hairpin" mode of an ethernet bridge
that the parent of the macvlan device is connected to.
All frames still get sent out to the external interface,
but the adjacent bridge is able to send them back on
the same wire in hairpin mode, so the macvlan ports
are able to see each other, which the bridge can be
configured to monitor and control traffic between
all macvlan instances. Multicast traffic coming in
from the external interface is checked for the source
MAC address and only delivered to ports that have not
yet seen it.
In bridge mode, macvlan will send all multicast traffic
to other interfaces that are also in bridge mode but
not to those in vepa mode, which get them on the way
back from the hairpin.
The third supported mode is "private", which prevents
communication between macvlans even if the adjacent
bridge is in hairpin mode. This behavior is closer to
the original implementation of macvlan but stricly
maintains isolation.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
ip/Makefile | 3 +-
ip/iplink_macvlan.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 1 deletions(-)
create mode 100644 ip/iplink_macvlan.c
diff --git a/ip/Makefile b/ip/Makefile
index 51914e8..46a9836 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -2,7 +2,8 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o \
rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
- iplink_vlan.o link_veth.o link_gre.o iplink_can.o
+ iplink_vlan.o link_veth.o link_gre.o iplink_can.o \
+ iplink_macvlan.o
RTMONOBJ=rtmon.o
diff --git a/ip/iplink_macvlan.c b/ip/iplink_macvlan.c
new file mode 100644
index 0000000..a3c78bd
--- /dev/null
+++ b/ip/iplink_macvlan.c
@@ -0,0 +1,93 @@
+/*
+ * iplink_vlan.c VLAN device support
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Patrick McHardy <kaber@trash.net>
+ * Arnd Bergmann <arnd@arndb.de>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <linux/if_link.h>
+
+#include "rt_names.h"
+#include "utils.h"
+#include "ip_common.h"
+
+static void explain(void)
+{
+ fprintf(stderr,
+ "Usage: ... macvlan mode { private | vepa | bridge }\n"
+ );
+}
+
+static int mode_arg(void)
+{
+ fprintf(stderr, "Error: argument of \"mode\" must be \"private\", "
+ "\"vepa\" or \"bridge\"\n");
+ return -1;
+}
+
+static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
+ struct nlmsghdr *n)
+{
+ while (argc > 0) {
+ if (matches(*argv, "mode") == 0) {
+ __u32 mode = 0;
+ NEXT_ARG();
+
+ if (strcmp(*argv, "private") == 0)
+ mode = MACVLAN_MODE_PRIVATE;
+ else if (strcmp(*argv, "vepa") == 0)
+ mode = MACVLAN_MODE_VEPA;
+ else if (strcmp(*argv, "bridge") == 0)
+ mode = MACVLAN_MODE_BRIDGE;
+ else
+ return mode_arg();
+
+ addattr32(n, 1024, IFLA_MACVLAN_MODE, mode);
+ } else if (matches(*argv, "help") == 0) {
+ explain();
+ return -1;
+ } else {
+ fprintf(stderr, "macvlan: what is \"%s\"?\n", *argv);
+ explain();
+ return -1;
+ }
+ argc--, argv++;
+ }
+
+ return 0;
+}
+
+static void macvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+ __u32 mode;
+
+ if (!tb)
+ return;
+
+ if (!tb[IFLA_MACVLAN_MODE] ||
+ RTA_PAYLOAD(tb[IFLA_MACVLAN_MODE]) < sizeof(__u32))
+ return;
+
+ mode = *(__u32 *)RTA_DATA(tb[IFLA_VLAN_ID]);
+ fprintf(f, " mode %s ",
+ mode == MACVLAN_MODE_PRIVATE ? "private"
+ : mode == MACVLAN_MODE_VEPA ? "vepa"
+ : mode == MACVLAN_MODE_BRIDGE ? "bridge"
+ : "unknown");
+}
+
+struct link_util macvlan_link_util = {
+ .id = "macvlan",
+ .maxattr = IFLA_MACVLAN_MAX,
+ .parse_opt = macvlan_parse_opt,
+ .print_opt = macvlan_print_opt,
+};
--
1.6.6

File diff suppressed because it is too large Load Diff