提交 0d227a86 编写于 作者: S Simon Horman 提交者: David S. Miller

mpls: allow routes on ipgre devices

This appears to be necessary and sufficient to provide
MPLS in GRE (RFC4023) support.

This can be used by establishing an ipgre tunnel device
and then routing MPLS over it.

The following example will forward MPLS frames received with an outermost
MPLS label 100 over tun1, a GRE tunnel. The forwarded packet will have the
outermost MPLS LSE removed and two new LSEs added with labels 200
(outermost) and 300 (next).

ip link add name tun1 type gre remote 10.0.99.193 local 10.0.99.192 ttl 225
ip link set up dev tun1
ip addr add 10.0.98.192/24 dev tun1
ip route sh

echo 1 > /proc/sys/net/mpls/conf/eth0/input
echo 101 > /proc/sys/net/mpls/platform_labels
ip -f mpls route add 100 as 200/300 via inet 10.0.98.193
ip -f mpls route sh

Also remove unnecessary braces.
Reviewed-by: NDinan Gunawardena <dinan.gunawardena@netronome.com>
Signed-off-by: NSimon Horman <simon.horman@netronome.com>
Acked-by: NRobert Shearman <rshearma@brocade.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fae56178
...@@ -1009,9 +1009,10 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event, ...@@ -1009,9 +1009,10 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event,
unsigned int flags; unsigned int flags;
if (event == NETDEV_REGISTER) { if (event == NETDEV_REGISTER) {
/* For now just support ethernet devices */ /* For now just support Ethernet and IPGRE devices */
if ((dev->type == ARPHRD_ETHER) || if (dev->type == ARPHRD_ETHER ||
(dev->type == ARPHRD_LOOPBACK)) { dev->type == ARPHRD_LOOPBACK ||
dev->type == ARPHRD_IPGRE) {
mdev = mpls_add_dev(dev); mdev = mpls_add_dev(dev);
if (IS_ERR(mdev)) if (IS_ERR(mdev))
return notifier_from_errno(PTR_ERR(mdev)); return notifier_from_errno(PTR_ERR(mdev));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册