* [net-next-2.6] Latest GIT pulled into linux-next
From: Sedat Dilek @ 2011-03-12 12:26 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Hi,
I pulled net-next-2.6 (last commit
70d279a7e2a6e308530822ba2bf4134cc0f5c091 "e1000e: bump version
number") into linux-next (next-20110311).
Unfortunately, I see this breakage:
[ build.log ]
...
In file included from
/home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss.c:351:0:
/home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:
In function ‘scsi_cmd_stack_setup’:
/home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:229:48:
error: ‘struct cciss_scsi_cmd_stack_t’ has no member named ‘nelems’
/home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:
In function ‘scsi_cmd_stack_free’:
/home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:266:12:
error: incompatible types when assigning to type ‘struct
cciss_scsi_cmd_stack_elem_t *[34]’ from type ‘void *’
Just FYI.
Regards,
- Sedat -
^ permalink raw reply
* Re: [net-next-2.6] Latest GIT pulled into linux-next
From: Sedat Dilek @ 2011-03-12 12:32 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
In-Reply-To: <AANLkTi=hna0mq5QTahDP8bHCq5_6ezs7PFeimpLuUe7S@mail.gmail.com>
Ooops, wrong ML and maintainer (sorry for this, it should be Jens and
linux-2.6-block).
- Sedat -
On Sat, Mar 12, 2011 at 1:26 PM, Sedat Dilek <sedat.dilek@googlemail.com> wrote:
> Hi,
>
> I pulled net-next-2.6 (last commit
> 70d279a7e2a6e308530822ba2bf4134cc0f5c091 "e1000e: bump version
> number") into linux-next (next-20110311).
>
> Unfortunately, I see this breakage:
>
> [ build.log ]
> ...
> In file included from
> /home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss.c:351:0:
> /home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:
> In function ‘scsi_cmd_stack_setup’:
> /home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:229:48:
> error: ‘struct cciss_scsi_cmd_stack_t’ has no member named ‘nelems’
> /home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:
> In function ‘scsi_cmd_stack_free’:
> /home/sd/src/linux-2.6/linux-2.6.38-rc8/debian/build/source_i386_none/drivers/block/cciss_scsi.c:266:12:
> error: incompatible types when assigning to type ‘struct
> cciss_scsi_cmd_stack_elem_t *[34]’ from type ‘void *’
>
> Just FYI.
>
> Regards,
> - Sedat -
>
^ permalink raw reply
* [patch net-next-2.6 0/6] mostly bonding cleanups (partial repost)
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
My original series had 2 more patches. That ones I posponed until I resolve
problems with delivering vlan arps to bond_frame_handler on non-vlan_hw_accel
path.
So for now, there are following patches that are ready to be applied I believe.
Note the dependency on "fcoe: correct checking for bonding" patch that has not
been applied so far on scsi-misc. I believe that maybe this patch could be
applied on net-next instead.
Jiri Pirko (6):
af_packet: use skb->skb_iif instead of orig_dev->ifindex
bonding: register slave pointer for rx_handler
net: get rid of multiple bond-related netdevice->priv_flags
bonding: wrap slave state work
bonding: get rid of IFF_SLAVE_INACTIVE netdev->priv_flag
net: introduce rx_handler results and logic around that
drivers/net/bonding/bond_3ad.c | 2 +-
drivers/net/bonding/bond_main.c | 102 +++++++++++++++++++-------------------
drivers/net/bonding/bond_sysfs.c | 14 +----
drivers/net/bonding/bonding.h | 60 +++++++++++++----------
drivers/net/macvlan.c | 11 ++--
include/linux/if.h | 23 +++-----
include/linux/netdevice.h | 50 ++++++++++++++++++-
include/linux/skbuff.h | 5 +--
net/bridge/br_input.c | 25 ++++++----
net/bridge/br_private.h | 2 +-
net/core/dev.c | 21 +++++---
net/core/skbuff.c | 1 -
net/packet/af_packet.c | 4 +-
13 files changed, 186 insertions(+), 134 deletions(-)
--
1.7.4
^ permalink raw reply
* [patch net-next-2.6 2/6] bonding: register slave pointer for rx_handler
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
In-Reply-To: <1299935679-18135-1-git-send-email-jpirko@redhat.com>
Register slave pointer as rx_handler data. That would eventually prevent
need to loop over slave devices to find the right slave.
Use synchronize_net to ensure that bond_handle_frame does not get slave
structure freed when working with that.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
---
drivers/net/bonding/bond_main.c | 17 +++++++++++------
drivers/net/bonding/bonding.h | 3 +++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 68a5ce0..29f69da 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1482,21 +1482,22 @@ static bool bond_should_deliver_exact_match(struct sk_buff *skb,
static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
{
- struct net_device *slave_dev;
+ struct slave *slave;
struct net_device *bond_dev;
skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
return NULL;
- slave_dev = skb->dev;
- bond_dev = ACCESS_ONCE(slave_dev->master);
+
+ slave = bond_slave_get_rcu(skb->dev);
+ bond_dev = ACCESS_ONCE(slave->dev->master);
if (unlikely(!bond_dev))
return skb;
if (bond_dev->priv_flags & IFF_MASTER_ARPMON)
- slave_dev->last_rx = jiffies;
+ slave->dev->last_rx = jiffies;
- if (bond_should_deliver_exact_match(skb, slave_dev, bond_dev)) {
+ if (bond_should_deliver_exact_match(skb, slave->dev, bond_dev)) {
skb->deliver_no_wcard = 1;
return skb;
}
@@ -1694,7 +1695,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
pr_debug("Error %d calling netdev_set_bond_master\n", res);
goto err_restore_mac;
}
- res = netdev_rx_handler_register(slave_dev, bond_handle_frame, NULL);
+ res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
+ new_slave);
if (res) {
pr_debug("Error %d calling netdev_rx_handler_register\n", res);
goto err_unset_master;
@@ -1916,6 +1918,7 @@ err_close:
err_unreg_rxhandler:
netdev_rx_handler_unregister(slave_dev);
+ synchronize_net();
err_unset_master:
netdev_set_bond_master(slave_dev, NULL);
@@ -2099,6 +2102,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
}
netdev_rx_handler_unregister(slave_dev);
+ synchronize_net();
netdev_set_bond_master(slave_dev, NULL);
slave_disable_netpoll(slave);
@@ -2213,6 +2217,7 @@ static int bond_release_all(struct net_device *bond_dev)
}
netdev_rx_handler_unregister(slave_dev);
+ synchronize_net();
netdev_set_bond_master(slave_dev, NULL);
slave_disable_netpoll(slave);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index c4e2343..ff9af31 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -266,6 +266,9 @@ struct bonding {
#endif /* CONFIG_DEBUG_FS */
};
+#define bond_slave_get_rcu(dev) \
+ ((struct slave *) rcu_dereference(dev->rx_handler_data))
+
/**
* Returns NULL if the net_device does not belong to any of the bond's slaves
*
--
1.7.4
^ permalink raw reply related
* [patch net-next-2.6 3/6] net: get rid of multiple bond-related netdevice->priv_flags
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
In-Reply-To: <1299935679-18135-1-git-send-email-jpirko@redhat.com>
Now when bond-related code is moved from net/core/dev.c into bonding
code, multiple priv_flags are not needed anymore. So toss them out.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
---
drivers/net/bonding/bond_main.c | 33 ++++++++++++++-------------------
drivers/net/bonding/bond_sysfs.c | 8 --------
drivers/net/bonding/bonding.h | 24 +-----------------------
include/linux/if.h | 22 +++++++++-------------
4 files changed, 24 insertions(+), 63 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 29f69da..3c6ac2f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1458,20 +1458,20 @@ static void bond_setup_by_slave(struct net_device *bond_dev,
* ARP on active-backup slaves with arp_validate enabled.
*/
static bool bond_should_deliver_exact_match(struct sk_buff *skb,
- struct net_device *slave_dev,
- struct net_device *bond_dev)
+ struct slave *slave,
+ struct bonding *bond)
{
- if (slave_dev->priv_flags & IFF_SLAVE_INACTIVE) {
- if (slave_dev->priv_flags & IFF_SLAVE_NEEDARP &&
+ if (slave->dev->priv_flags & IFF_SLAVE_INACTIVE) {
+ if (slave_do_arp_validate(bond, slave) &&
skb->protocol == __cpu_to_be16(ETH_P_ARP))
return false;
- if (bond_dev->priv_flags & IFF_MASTER_ALB &&
+ if (bond->params.mode == BOND_MODE_ALB &&
skb->pkt_type != PACKET_BROADCAST &&
skb->pkt_type != PACKET_MULTICAST)
return false;
- if (bond_dev->priv_flags & IFF_MASTER_8023AD &&
+ if (bond->params.mode == BOND_MODE_8023AD &&
skb->protocol == __cpu_to_be16(ETH_P_SLOW))
return false;
@@ -1484,6 +1484,7 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
{
struct slave *slave;
struct net_device *bond_dev;
+ struct bonding *bond;
skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
@@ -1494,17 +1495,19 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
if (unlikely(!bond_dev))
return skb;
- if (bond_dev->priv_flags & IFF_MASTER_ARPMON)
+ bond = netdev_priv(bond_dev);
+
+ if (bond->params.arp_interval)
slave->dev->last_rx = jiffies;
- if (bond_should_deliver_exact_match(skb, slave->dev, bond_dev)) {
+ if (bond_should_deliver_exact_match(skb, slave, bond)) {
skb->deliver_no_wcard = 1;
return skb;
}
skb->dev = bond_dev;
- if (bond_dev->priv_flags & IFF_MASTER_ALB &&
+ if (bond->params.mode == BOND_MODE_ALB &&
bond_dev->priv_flags & IFF_BRIDGE_PORT &&
skb->pkt_type == PACKET_HOST) {
@@ -2119,9 +2122,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
dev_set_mtu(slave_dev, slave->original_mtu);
- slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
- IFF_SLAVE_INACTIVE | IFF_BONDING |
- IFF_SLAVE_NEEDARP);
+ slave_dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_BONDING);
kfree(slave);
@@ -2232,8 +2233,7 @@ static int bond_release_all(struct net_device *bond_dev)
dev_set_mac_address(slave_dev, &addr);
}
- slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
- IFF_SLAVE_INACTIVE);
+ slave_dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
kfree(slave);
@@ -4416,11 +4416,9 @@ void bond_set_mode_ops(struct bonding *bond, int mode)
case BOND_MODE_BROADCAST:
break;
case BOND_MODE_8023AD:
- bond_set_master_3ad_flags(bond);
bond_set_xmit_hash_policy(bond);
break;
case BOND_MODE_ALB:
- bond_set_master_alb_flags(bond);
/* FALLTHRU */
case BOND_MODE_TLB:
break;
@@ -4511,9 +4509,6 @@ static void bond_setup(struct net_device *bond_dev)
bond_dev->priv_flags |= IFF_BONDING;
bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
- if (bond->params.arp_interval)
- bond_dev->priv_flags |= IFF_MASTER_ARPMON;
-
/* At first, we block adding VLANs. That's the only way to
* prevent problems that occur when adding VLANs over an
* empty bond. The block will be removed once non-challenged
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 72bb0f6..05e0ae5 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -322,11 +322,6 @@ static ssize_t bonding_store_mode(struct device *d,
ret = -EINVAL;
goto out;
}
- if (bond->params.mode == BOND_MODE_8023AD)
- bond_unset_master_3ad_flags(bond);
-
- if (bond->params.mode == BOND_MODE_ALB)
- bond_unset_master_alb_flags(bond);
bond->params.mode = new_value;
bond_set_mode_ops(bond, bond->params.mode);
@@ -527,8 +522,6 @@ static ssize_t bonding_store_arp_interval(struct device *d,
pr_info("%s: Setting ARP monitoring interval to %d.\n",
bond->dev->name, new_value);
bond->params.arp_interval = new_value;
- if (bond->params.arp_interval)
- bond->dev->priv_flags |= IFF_MASTER_ARPMON;
if (bond->params.miimon) {
pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
bond->dev->name, bond->dev->name);
@@ -1004,7 +997,6 @@ static ssize_t bonding_store_miimon(struct device *d,
pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
bond->dev->name);
bond->params.arp_interval = 0;
- bond->dev->priv_flags &= ~IFF_MASTER_ARPMON;
if (bond->params.arp_validate) {
bond_unregister_arp(bond);
bond->params.arp_validate =
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ff9af31..049619f 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -356,34 +356,12 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
slave->state = BOND_STATE_BACKUP;
if (!bond->params.all_slaves_active)
slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
- if (slave_do_arp_validate(bond, slave))
- slave->dev->priv_flags |= IFF_SLAVE_NEEDARP;
}
static inline void bond_set_slave_active_flags(struct slave *slave)
{
slave->state = BOND_STATE_ACTIVE;
- slave->dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_SLAVE_NEEDARP);
-}
-
-static inline void bond_set_master_3ad_flags(struct bonding *bond)
-{
- bond->dev->priv_flags |= IFF_MASTER_8023AD;
-}
-
-static inline void bond_unset_master_3ad_flags(struct bonding *bond)
-{
- bond->dev->priv_flags &= ~IFF_MASTER_8023AD;
-}
-
-static inline void bond_set_master_alb_flags(struct bonding *bond)
-{
- bond->dev->priv_flags |= IFF_MASTER_ALB;
-}
-
-static inline void bond_unset_master_alb_flags(struct bonding *bond)
-{
- bond->dev->priv_flags &= ~IFF_MASTER_ALB;
+ slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
}
struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr);
diff --git a/include/linux/if.h b/include/linux/if.h
index 3bc63e6..2fdd47a 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -60,21 +60,17 @@
#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */
#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */
#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
-#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
-#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
-#define IFF_BONDING 0x20 /* bonding master or slave */
-#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
-#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
-#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
-#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
-#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to
+#define IFF_BONDING 0x8 /* bonding master or slave */
+#define IFF_ISATAP 0x10 /* ISATAP interface (RFC4214) */
+#define IFF_WAN_HDLC 0x20 /* WAN HDLC device */
+#define IFF_XMIT_DST_RELEASE 0x40 /* dev_hard_start_xmit() is allowed to
* release skb->dst
*/
-#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
-#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
-#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
-#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
-#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
+#define IFF_DONT_BRIDGE 0x80 /* disallow bridging this ether dev */
+#define IFF_DISABLE_NETPOLL 0x100 /* disable netpoll at run-time */
+#define IFF_MACVLAN_PORT 0x200 /* device used as macvlan port */
+#define IFF_BRIDGE_PORT 0x400 /* device used as bridge port */
+#define IFF_OVS_DATAPATH 0x800 /* device used as Open vSwitch
* datapath port */
#define IF_GET_IFACE 0x0001 /* for querying only */
--
1.7.4
^ permalink raw reply related
* [patch net-next-2.6 1/6] af_packet: use skb->skb_iif instead of orig_dev->ifindex
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
In-Reply-To: <1299935679-18135-1-git-send-email-jpirko@redhat.com>
Since skb_iif has the desired value (ifindex of physical device actually
received the traffic) use that instead.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Changli Gao <xiaosuo@gmail.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
---
net/packet/af_packet.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b5362e9..714383c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -627,7 +627,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
sll->sll_protocol = skb->protocol;
sll->sll_pkttype = skb->pkt_type;
if (unlikely(po->origdev))
- sll->sll_ifindex = orig_dev->ifindex;
+ sll->sll_ifindex = skb->skb_iif;
else
sll->sll_ifindex = dev->ifindex;
@@ -812,7 +812,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
sll->sll_protocol = skb->protocol;
sll->sll_pkttype = skb->pkt_type;
if (unlikely(po->origdev))
- sll->sll_ifindex = orig_dev->ifindex;
+ sll->sll_ifindex = skb->skb_iif;
else
sll->sll_ifindex = dev->ifindex;
--
1.7.4
^ permalink raw reply related
* [patch net-next-2.6 4/6] bonding: wrap slave state work
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
In-Reply-To: <1299935679-18135-1-git-send-email-jpirko@redhat.com>
transfers slave->state into slave->backup (that it's going to transfer
into bitfield. Introduce wrapper inlines to do the work with it.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
---
drivers/net/bonding/bond_3ad.c | 2 +-
drivers/net/bonding/bond_main.c | 36 ++++++++++++++++++------------------
drivers/net/bonding/bond_sysfs.c | 2 +-
drivers/net/bonding/bonding.h | 31 ++++++++++++++++++++++++++-----
4 files changed, 46 insertions(+), 25 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 1024ae1..047af0b 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -246,7 +246,7 @@ static inline void __enable_port(struct port *port)
*/
static inline int __port_is_enabled(struct port *port)
{
- return port->slave->state == BOND_STATE_ACTIVE;
+ return bond_is_active_slave(port->slave);
}
/**
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3c6ac2f..c5f3a01 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1863,7 +1863,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
break;
case BOND_MODE_TLB:
case BOND_MODE_ALB:
- new_slave->state = BOND_STATE_ACTIVE;
+ bond_set_active_slave(new_slave);
bond_set_slave_inactive_flags(new_slave);
bond_select_active_slave(bond);
break;
@@ -1871,7 +1871,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
pr_debug("This slave is always active in trunk mode\n");
/* always active in trunk mode */
- new_slave->state = BOND_STATE_ACTIVE;
+ bond_set_active_slave(new_slave);
/* In trunking mode there is little meaning to curr_active_slave
* anyway (it holds no special properties of the bond device),
@@ -1909,7 +1909,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
bond_dev->name, slave_dev->name,
- new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
+ bond_is_active_slave(new_slave) ? "n active" : " backup",
new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
/* enslave is successful */
@@ -2007,7 +2007,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
pr_info("%s: releasing %s interface %s\n",
bond_dev->name,
- (slave->state == BOND_STATE_ACTIVE) ? "active" : "backup",
+ bond_is_active_slave(slave) ? "active" : "backup",
slave_dev->name);
oldcurrent = bond->curr_active_slave;
@@ -2348,7 +2348,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
res = 0;
strcpy(info->slave_name, slave->dev->name);
info->link = slave->link;
- info->state = slave->state;
+ info->state = bond_slave_state(slave);
info->link_failure_count = slave->link_failure_count;
break;
}
@@ -2387,7 +2387,7 @@ static int bond_miimon_inspect(struct bonding *bond)
bond->dev->name,
(bond->params.mode ==
BOND_MODE_ACTIVEBACKUP) ?
- ((slave->state == BOND_STATE_ACTIVE) ?
+ (bond_is_active_slave(slave) ?
"active " : "backup ") : "",
slave->dev->name,
bond->params.downdelay * bond->params.miimon);
@@ -2478,13 +2478,13 @@ static void bond_miimon_commit(struct bonding *bond)
if (bond->params.mode == BOND_MODE_8023AD) {
/* prevent it from being the active one */
- slave->state = BOND_STATE_BACKUP;
+ bond_set_backup_slave(slave);
} else if (bond->params.mode != BOND_MODE_ACTIVEBACKUP) {
/* make it immediately active */
- slave->state = BOND_STATE_ACTIVE;
+ bond_set_active_slave(slave);
} else if (slave != bond->primary_slave) {
/* prevent it from being the active one */
- slave->state = BOND_STATE_BACKUP;
+ bond_set_backup_slave(slave);
}
bond_update_speed_duplex(slave);
@@ -2862,7 +2862,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
memcpy(&tip, arp_ptr, 4);
pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
- bond->dev->name, slave->dev->name, slave->state,
+ bond->dev->name, slave->dev->name, bond_slave_state(slave),
bond->params.arp_validate, slave_do_arp_validate(bond, slave),
&sip, &tip);
@@ -2874,7 +2874,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
* the active, through one switch, the router, then the other
* switch before reaching the backup.
*/
- if (slave->state == BOND_STATE_ACTIVE)
+ if (bond_is_active_slave(slave))
bond_validate_arp(bond, slave, sip, tip);
else
bond_validate_arp(bond, slave, tip, sip);
@@ -2936,7 +2936,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
slave->dev->last_rx + delta_in_ticks)) {
slave->link = BOND_LINK_UP;
- slave->state = BOND_STATE_ACTIVE;
+ bond_set_active_slave(slave);
/* primary_slave has no meaning in round-robin
* mode. the window of a slave being up and
@@ -2969,7 +2969,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
slave->dev->last_rx + 2 * delta_in_ticks)) {
slave->link = BOND_LINK_DOWN;
- slave->state = BOND_STATE_BACKUP;
+ bond_set_backup_slave(slave);
if (slave->link_failure_count < UINT_MAX)
slave->link_failure_count++;
@@ -3063,7 +3063,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
* gives each slave a chance to tx/rx traffic
* before being taken out
*/
- if (slave->state == BOND_STATE_BACKUP &&
+ if (!bond_is_active_slave(slave) &&
!bond->current_arp_slave &&
!time_in_range(jiffies,
slave_last_rx(bond, slave) - delta_in_ticks,
@@ -3080,7 +3080,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
* the bond has an IP address)
*/
trans_start = dev_trans_start(slave->dev);
- if ((slave->state == BOND_STATE_ACTIVE) &&
+ if (bond_is_active_slave(slave) &&
(!time_in_range(jiffies,
trans_start - delta_in_ticks,
trans_start + 2 * delta_in_ticks) ||
@@ -4144,7 +4144,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
bond_for_each_slave_from(bond, slave, i, start_at) {
if (IS_UP(slave->dev) &&
(slave->link == BOND_LINK_UP) &&
- (slave->state == BOND_STATE_ACTIVE)) {
+ bond_is_active_slave(slave)) {
res = bond_dev_queue_xmit(bond, skb, slave->dev);
break;
}
@@ -4221,7 +4221,7 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
bond_for_each_slave_from(bond, slave, i, start_at) {
if (IS_UP(slave->dev) &&
(slave->link == BOND_LINK_UP) &&
- (slave->state == BOND_STATE_ACTIVE)) {
+ bond_is_active_slave(slave)) {
res = bond_dev_queue_xmit(bond, skb, slave->dev);
break;
}
@@ -4262,7 +4262,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
bond_for_each_slave_from(bond, slave, i, start_at) {
if (IS_UP(slave->dev) &&
(slave->link == BOND_LINK_UP) &&
- (slave->state == BOND_STATE_ACTIVE)) {
+ bond_is_active_slave(slave)) {
if (tx_dev) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
if (!skb2) {
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 05e0ae5..344d23f 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1579,7 +1579,7 @@ static ssize_t bonding_store_slaves_active(struct device *d,
}
bond_for_each_slave(bond, slave, i) {
- if (slave->state == BOND_STATE_BACKUP) {
+ if (!bond_is_active_slave(slave)) {
if (new_value)
slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
else
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 049619f..63e9cf7 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -55,7 +55,7 @@
(((slave)->dev->flags & IFF_UP) && \
netif_running((slave)->dev) && \
((slave)->link == BOND_LINK_UP) && \
- ((slave)->state == BOND_STATE_ACTIVE))
+ bond_is_active_slave(slave))
#define USES_PRIMARY(mode) \
@@ -192,7 +192,8 @@ struct slave {
unsigned long last_arp_rx;
s8 link; /* one of BOND_LINK_XXXX */
s8 new_link;
- s8 state; /* one of BOND_STATE_XXXX */
+ u8 backup; /* indicates backup slave. Value corresponds with
+ BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
u32 original_mtu;
u32 link_failure_count;
u8 perm_hwaddr[ETH_ALEN];
@@ -304,6 +305,26 @@ static inline bool bond_is_lb(const struct bonding *bond)
bond->params.mode == BOND_MODE_ALB);
}
+static inline void bond_set_active_slave(struct slave *slave)
+{
+ slave->backup = 0;
+}
+
+static inline void bond_set_backup_slave(struct slave *slave)
+{
+ slave->backup = 1;
+}
+
+static inline int bond_slave_state(struct slave *slave)
+{
+ return slave->backup;
+}
+
+static inline bool bond_is_active_slave(struct slave *slave)
+{
+ return !bond_slave_state(slave);
+}
+
#define BOND_PRI_RESELECT_ALWAYS 0
#define BOND_PRI_RESELECT_BETTER 1
#define BOND_PRI_RESELECT_FAILURE 2
@@ -321,7 +342,7 @@ static inline bool bond_is_lb(const struct bonding *bond)
static inline int slave_do_arp_validate(struct bonding *bond,
struct slave *slave)
{
- return bond->params.arp_validate & (1 << slave->state);
+ return bond->params.arp_validate & (1 << bond_slave_state(slave));
}
static inline unsigned long slave_last_rx(struct bonding *bond,
@@ -353,14 +374,14 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
{
struct bonding *bond = netdev_priv(slave->dev->master);
if (!bond_is_lb(bond))
- slave->state = BOND_STATE_BACKUP;
+ bond_set_backup_slave(slave);
if (!bond->params.all_slaves_active)
slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
}
static inline void bond_set_slave_active_flags(struct slave *slave)
{
- slave->state = BOND_STATE_ACTIVE;
+ bond_set_active_slave(slave);
slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
}
--
1.7.4
^ permalink raw reply related
* [patch net-next-2.6 6/6] net: introduce rx_handler results and logic around that
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
In-Reply-To: <1299935679-18135-1-git-send-email-jpirko@redhat.com>
This patch allows rx_handlers to better signalize what to do next to
it's caller. That makes skb->deliver_no_wcard no longer needed.
kernel-doc for rx_handler_result is taken from Nicolas' patch.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
eviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
---
drivers/net/bonding/bond_main.c | 22 +++++++++-------
drivers/net/macvlan.c | 11 ++++----
include/linux/netdevice.h | 50 ++++++++++++++++++++++++++++++++++++++-
include/linux/skbuff.h | 5 +---
net/bridge/br_input.c | 25 +++++++++++-------
net/bridge/br_private.h | 2 +-
net/core/dev.c | 21 +++++++++++-----
net/core/skbuff.c | 1 -
8 files changed, 98 insertions(+), 39 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c3150df..fdba1a1 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1480,20 +1480,23 @@ static bool bond_should_deliver_exact_match(struct sk_buff *skb,
return false;
}
-static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
+static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
{
+ struct sk_buff *skb = *pskb;
struct slave *slave;
struct net_device *bond_dev;
struct bonding *bond;
- skb = skb_share_check(skb, GFP_ATOMIC);
- if (unlikely(!skb))
- return NULL;
-
slave = bond_slave_get_rcu(skb->dev);
bond_dev = ACCESS_ONCE(slave->dev->master);
if (unlikely(!bond_dev))
- return skb;
+ return RX_HANDLER_PASS;
+
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (unlikely(!skb))
+ return RX_HANDLER_CONSUMED;
+
+ *pskb = skb;
bond = netdev_priv(bond_dev);
@@ -1501,8 +1504,7 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
slave->dev->last_rx = jiffies;
if (bond_should_deliver_exact_match(skb, slave, bond)) {
- skb->deliver_no_wcard = 1;
- return skb;
+ return RX_HANDLER_EXACT;
}
skb->dev = bond_dev;
@@ -1514,12 +1516,12 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
if (unlikely(skb_cow_head(skb,
skb->data - skb_mac_header(skb)))) {
kfree_skb(skb);
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
memcpy(eth_hdr(skb)->h_dest, bond_dev->dev_addr, ETH_ALEN);
}
- return skb;
+ return RX_HANDLER_ANOTHER;
}
/* enslave device <slave> to bond device <master> */
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ed577b..ead9a8f 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -152,9 +152,10 @@ static void macvlan_broadcast(struct sk_buff *skb,
}
/* called under rcu_read_lock() from netif_receive_skb */
-static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
+static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
{
struct macvlan_port *port;
+ struct sk_buff *skb = *pskb;
const struct ethhdr *eth = eth_hdr(skb);
const struct macvlan_dev *vlan;
const struct macvlan_dev *src;
@@ -184,7 +185,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
*/
macvlan_broadcast(skb, port, src->dev,
MACVLAN_MODE_VEPA);
- return skb;
+ return RX_HANDLER_PASS;
}
if (port->passthru)
@@ -192,12 +193,12 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
else
vlan = macvlan_hash_lookup(port, eth->h_dest);
if (vlan == NULL)
- return skb;
+ return RX_HANDLER_PASS;
dev = vlan->dev;
if (unlikely(!(dev->flags & IFF_UP))) {
kfree_skb(skb);
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
len = skb->len + ETH_HLEN;
skb = skb_share_check(skb, GFP_ATOMIC);
@@ -211,7 +212,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
out:
macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6bd5d46..6275a95 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -390,7 +390,55 @@ enum gro_result {
};
typedef enum gro_result gro_result_t;
-typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
+/*
+ * enum rx_handler_result - Possible return values for rx_handlers.
+ * @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it
+ * further.
+ * @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in
+ * case skb->dev was changed by rx_handler.
+ * @RX_HANDLER_EXACT: Force exact delivery, no wildcard.
+ * @RX_HANDLER_PASS: Do nothing, passe the skb as if no rx_handler was called.
+ *
+ * rx_handlers are functions called from inside __netif_receive_skb(), to do
+ * special processing of the skb, prior to delivery to protocol handlers.
+ *
+ * Currently, a net_device can only have a single rx_handler registered. Trying
+ * to register a second rx_handler will return -EBUSY.
+ *
+ * To register a rx_handler on a net_device, use netdev_rx_handler_register().
+ * To unregister a rx_handler on a net_device, use
+ * netdev_rx_handler_unregister().
+ *
+ * Upon return, rx_handler is expected to tell __netif_receive_skb() what to
+ * do with the skb.
+ *
+ * If the rx_handler consumed to skb in some way, it should return
+ * RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for
+ * the skb to be delivered in some other ways.
+ *
+ * If the rx_handler changed skb->dev, to divert the skb to another
+ * net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the
+ * new device will be called if it exists.
+ *
+ * If the rx_handler consider the skb should be ignored, it should return
+ * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
+ * are registred on exact device (ptype->dev == skb->dev).
+ *
+ * If the rx_handler didn't changed skb->dev, but want the skb to be normally
+ * delivered, it should return RX_HANDLER_PASS.
+ *
+ * A device without a registered rx_handler will behave as if rx_handler
+ * returned RX_HANDLER_PASS.
+ */
+
+enum rx_handler_result {
+ RX_HANDLER_CONSUMED,
+ RX_HANDLER_ANOTHER,
+ RX_HANDLER_EXACT,
+ RX_HANDLER_PASS,
+};
+typedef enum rx_handler_result rx_handler_result_t;
+typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
extern void __napi_schedule(struct napi_struct *n);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 31f02d0..24cfa62 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -388,10 +388,7 @@ struct sk_buff {
kmemcheck_bitfield_begin(flags2);
__u16 queue_mapping:16;
#ifdef CONFIG_IPV6_NDISC_NODETYPE
- __u8 ndisc_nodetype:2,
- deliver_no_wcard:1;
-#else
- __u8 deliver_no_wcard:1;
+ __u8 ndisc_nodetype:2;
#endif
__u8 ooo_okay:1;
kmemcheck_bitfield_end(flags2);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 88e4aa9..e216079 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -139,21 +139,22 @@ static inline int is_link_local(const unsigned char *dest)
* Return NULL if skb is handled
* note: already called with rcu_read_lock
*/
-struct sk_buff *br_handle_frame(struct sk_buff *skb)
+rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
{
struct net_bridge_port *p;
+ struct sk_buff *skb = *pskb;
const unsigned char *dest = eth_hdr(skb)->h_dest;
br_should_route_hook_t *rhook;
if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
- return skb;
+ return RX_HANDLER_PASS;
if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
goto drop;
skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
- return NULL;
+ return RX_HANDLER_CONSUMED;
p = br_port_get_rcu(skb->dev);
@@ -167,10 +168,12 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
goto forward;
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
- NULL, br_handle_local_finish))
- return NULL; /* frame consumed by filter */
- else
- return skb; /* continue processing */
+ NULL, br_handle_local_finish)) {
+ return RX_HANDLER_CONSUMED; /* consumed by filter */
+ } else {
+ *pskb = skb;
+ return RX_HANDLER_PASS; /* continue processing */
+ }
}
forward:
@@ -178,8 +181,10 @@ forward:
case BR_STATE_FORWARDING:
rhook = rcu_dereference(br_should_route_hook);
if (rhook) {
- if ((*rhook)(skb))
- return skb;
+ if ((*rhook)(skb)) {
+ *pskb = skb;
+ return RX_HANDLER_PASS;
+ }
dest = eth_hdr(skb)->h_dest;
}
/* fall through */
@@ -194,5 +199,5 @@ forward:
drop:
kfree_skb(skb);
}
- return NULL;
+ return RX_HANDLER_CONSUMED;
}
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index f7afc36..19e2f46 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -379,7 +379,7 @@ extern void br_features_recompute(struct net_bridge *br);
/* br_input.c */
extern int br_handle_frame_finish(struct sk_buff *skb);
-extern struct sk_buff *br_handle_frame(struct sk_buff *skb);
+extern rx_handler_result_t br_handle_frame(struct sk_buff **pskb);
/* br_ioctl.c */
extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
diff --git a/net/core/dev.c b/net/core/dev.c
index 9f66de9..329e670 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3062,6 +3062,8 @@ out:
* on a failure.
*
* The caller must hold the rtnl_mutex.
+ *
+ * For a general description of rx_handler, see enum rx_handler_result.
*/
int netdev_rx_handler_register(struct net_device *dev,
rx_handler_func_t *rx_handler,
@@ -3121,6 +3123,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
rx_handler_func_t *rx_handler;
struct net_device *orig_dev;
struct net_device *null_or_dev;
+ bool deliver_exact = false;
int ret = NET_RX_DROP;
__be16 type;
@@ -3173,18 +3176,22 @@ ncls:
rx_handler = rcu_dereference(skb->dev->rx_handler);
if (rx_handler) {
- struct net_device *prev_dev;
-
if (pt_prev) {
ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = NULL;
}
- prev_dev = skb->dev;
- skb = rx_handler(skb);
- if (!skb)
+ switch (rx_handler(&skb)) {
+ case RX_HANDLER_CONSUMED:
goto out;
- if (skb->dev != prev_dev)
+ case RX_HANDLER_ANOTHER:
goto another_round;
+ case RX_HANDLER_EXACT:
+ deliver_exact = true;
+ case RX_HANDLER_PASS:
+ break;
+ default:
+ BUG();
+ }
}
if (vlan_tx_tag_present(skb)) {
@@ -3202,7 +3209,7 @@ ncls:
vlan_on_bond_hook(skb);
/* deliver only exact match when indicated */
- null_or_dev = skb->deliver_no_wcard ? skb->dev : NULL;
+ null_or_dev = deliver_exact ? skb->dev : NULL;
type = skb->protocol;
list_for_each_entry_rcu(ptype,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1eb526a..801dd08 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -523,7 +523,6 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
new->ip_summed = old->ip_summed;
skb_copy_queue_mapping(new, old);
new->priority = old->priority;
- new->deliver_no_wcard = old->deliver_no_wcard;
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
new->ipvs_property = old->ipvs_property;
#endif
--
1.7.4
^ permalink raw reply related
* [patch net-next-2.6 5/6] bonding: get rid of IFF_SLAVE_INACTIVE netdev->priv_flag
From: Jiri Pirko @ 2011-03-12 13:14 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian,
andy, xiaosuo
In-Reply-To: <1299935679-18135-1-git-send-email-jpirko@redhat.com>
Since bond-related code was moved from net/core/dev.c into bonding,
IFF_SLAVE_INACTIVE is no longer needed. Replace is with flag "inactive"
stored in slave structure
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
---
drivers/net/bonding/bond_main.c | 6 ++----
drivers/net/bonding/bond_sysfs.c | 4 ++--
drivers/net/bonding/bonding.h | 14 ++++++++++----
include/linux/if.h | 19 +++++++++----------
4 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c5f3a01..c3150df 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1461,7 +1461,7 @@ static bool bond_should_deliver_exact_match(struct sk_buff *skb,
struct slave *slave,
struct bonding *bond)
{
- if (slave->dev->priv_flags & IFF_SLAVE_INACTIVE) {
+ if (bond_is_slave_inactive(slave)) {
if (slave_do_arp_validate(bond, slave) &&
skb->protocol == __cpu_to_be16(ETH_P_ARP))
return false;
@@ -2122,7 +2122,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
dev_set_mtu(slave_dev, slave->original_mtu);
- slave_dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_BONDING);
+ slave_dev->priv_flags &= ~IFF_BONDING;
kfree(slave);
@@ -2233,8 +2233,6 @@ static int bond_release_all(struct net_device *bond_dev)
dev_set_mac_address(slave_dev, &addr);
}
- slave_dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
-
kfree(slave);
/* re-acquire the lock before getting the next slave */
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 344d23f..5161183 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1581,9 +1581,9 @@ static ssize_t bonding_store_slaves_active(struct device *d,
bond_for_each_slave(bond, slave, i) {
if (!bond_is_active_slave(slave)) {
if (new_value)
- slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
+ slave->inactive = 0;
else
- slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
+ slave->inactive = 1;
}
}
out:
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 63e9cf7..6b26962 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -192,8 +192,9 @@ struct slave {
unsigned long last_arp_rx;
s8 link; /* one of BOND_LINK_XXXX */
s8 new_link;
- u8 backup; /* indicates backup slave. Value corresponds with
- BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
+ u8 backup:1, /* indicates backup slave. Value corresponds with
+ BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
+ inactive:1; /* indicates inactive slave */
u32 original_mtu;
u32 link_failure_count;
u8 perm_hwaddr[ETH_ALEN];
@@ -376,13 +377,18 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
if (!bond_is_lb(bond))
bond_set_backup_slave(slave);
if (!bond->params.all_slaves_active)
- slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
+ slave->inactive = 1;
}
static inline void bond_set_slave_active_flags(struct slave *slave)
{
bond_set_active_slave(slave);
- slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
+ slave->inactive = 0;
+}
+
+static inline bool bond_is_slave_inactive(struct slave *slave)
+{
+ return slave->inactive;
}
struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr);
diff --git a/include/linux/if.h b/include/linux/if.h
index 2fdd47a..0da7991 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -59,18 +59,17 @@
/* Private (from user) interface flags (netdevice->priv_flags). */
#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */
#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */
-#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
-#define IFF_BONDING 0x8 /* bonding master or slave */
-#define IFF_ISATAP 0x10 /* ISATAP interface (RFC4214) */
-#define IFF_WAN_HDLC 0x20 /* WAN HDLC device */
-#define IFF_XMIT_DST_RELEASE 0x40 /* dev_hard_start_xmit() is allowed to
+#define IFF_BONDING 0x4 /* bonding master or slave */
+#define IFF_ISATAP 0x8 /* ISATAP interface (RFC4214) */
+#define IFF_WAN_HDLC 0x10 /* WAN HDLC device */
+#define IFF_XMIT_DST_RELEASE 0x20 /* dev_hard_start_xmit() is allowed to
* release skb->dst
*/
-#define IFF_DONT_BRIDGE 0x80 /* disallow bridging this ether dev */
-#define IFF_DISABLE_NETPOLL 0x100 /* disable netpoll at run-time */
-#define IFF_MACVLAN_PORT 0x200 /* device used as macvlan port */
-#define IFF_BRIDGE_PORT 0x400 /* device used as bridge port */
-#define IFF_OVS_DATAPATH 0x800 /* device used as Open vSwitch
+#define IFF_DONT_BRIDGE 0x40 /* disallow bridging this ether dev */
+#define IFF_DISABLE_NETPOLL 0x80 /* disable netpoll at run-time */
+#define IFF_MACVLAN_PORT 0x100 /* device used as macvlan port */
+#define IFF_BRIDGE_PORT 0x200 /* device used as bridge port */
+#define IFF_OVS_DATAPATH 0x400 /* device used as Open vSwitch
* datapath port */
#define IF_GET_IFACE 0x0001 /* for querying only */
--
1.7.4
^ permalink raw reply related
* Re: [patch net-next-2.6 6/6] net: introduce rx_handler results and logic around that
From: Nicolas de Pesloüan @ 2011-03-12 13:24 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy,
xiaosuo
In-Reply-To: <1299935679-18135-7-git-send-email-jpirko@redhat.com>
Le 12/03/2011 14:14, Jiri Pirko a écrit :
> This patch allows rx_handlers to better signalize what to do next to
> it's caller. That makes skb->deliver_no_wcard no longer needed.
>
> kernel-doc for rx_handler_result is taken from Nicolas' patch.
>
> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> eviewed-by: Nicolas de Pesloüan<nicolas.2p.debian@free.fr>
Typo in [R]eviewed-by and missing space between Pesloüan and <nicolas.
Nicolas.
^ permalink raw reply
* Re: [patch net-next-2.6 6/6] net: introduce rx_handler results and logic around that
From: Nicolas de Pesloüan @ 2011-03-12 13:25 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet, andy,
xiaosuo
In-Reply-To: <4D7B7403.6050402@gmail.com>
Le 12/03/2011 14:24, Nicolas de Pesloüan a écrit :
> Le 12/03/2011 14:14, Jiri Pirko a écrit :
>> This patch allows rx_handlers to better signalize what to do next to
>> it's caller. That makes skb->deliver_no_wcard no longer needed.
>>
>> kernel-doc for rx_handler_result is taken from Nicolas' patch.
>>
>> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>> eviewed-by: Nicolas de Pesloüan<nicolas.2p.debian@free.fr>
>
> Typo in [R]eviewed-by and missing space between Pesloüan and <nicolas.
>
> Nicolas.
Only the missing R in Reviewed-by:. The space was removed by my mail client, sorry.
Nicolas.
^ permalink raw reply
* Re: [patch net-next-2.6 6/6] net: introduce rx_handler results and logic around that
From: Jiri Pirko @ 2011-03-12 13:36 UTC (permalink / raw)
To: Nicolas de Pesloüan; +Cc: netdev, davem
In-Reply-To: <4D7B7453.5040606@gmail.com>
Sat, Mar 12, 2011 at 02:25:39PM CET, nicolas.2p.debian@gmail.com wrote:
>Le 12/03/2011 14:24, Nicolas de Pesloüan a écrit :
>>Le 12/03/2011 14:14, Jiri Pirko a écrit :
>>>This patch allows rx_handlers to better signalize what to do next to
>>>it's caller. That makes skb->deliver_no_wcard no longer needed.
>>>
>>>kernel-doc for rx_handler_result is taken from Nicolas' patch.
>>>
>>>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>>eviewed-by: Nicolas de Pesloüan<nicolas.2p.debian@free.fr>
>>
>>Typo in [R]eviewed-by and missing space between Pesloüan and <nicolas.
>>
>>Nicolas.
>
>Only the missing R in Reviewed-by:. The space was removed by my mail client, sorry.
Copypaste err :( Sorry..
Dave would you please add "R" before you apply. Many thanks.
Jirka
>
> Nicolas.
>
^ permalink raw reply
* Re: fcoe: correct checking for bonding
From: David Miller @ 2011-03-12 18:59 UTC (permalink / raw)
To: jpirko
Cc: robert.w.love, James.Bottomley, linux-scsi, devel, netdev, fubar,
joe.eykholt
In-Reply-To: <20110312120109.GA2899@psychotron.redhat.com>
From: Jiri Pirko <jpirko@redhat.com>
Date: Sat, 12 Mar 2011 13:01:10 +0100
> Thu, Mar 03, 2011 at 02:09:18AM CET, robert.w.love@intel.com wrote:
>>On Wed, 2011-03-02 at 01:55 -0800, Jiri Pirko wrote:
>>> Or perhaps this should be applied to net-next?
>>>
>>I think this should go through scsi-misc as all the other
>>libfc/libfcoe/fcoe patches do.
>>
>>> Wed, Mar 02, 2011 at 07:05:35AM CET, jpirko@redhat.com wrote:
>>> >Check for bonding master and refuse to use that.
>>> >
>>> >Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>>> >---
>>> > drivers/scsi/fcoe/fcoe.c | 4 +---
>>> > 1 files changed, 1 insertions(+), 3 deletions(-)
>>> >
>>> >diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
>>> >index 9f9600b..3becc6a 100644
>>> >--- a/drivers/scsi/fcoe/fcoe.c
>>> >+++ b/drivers/scsi/fcoe/fcoe.c
>>> >@@ -285,9 +285,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
>>> > }
>>> >
>>> > /* Do not support for bonding device */
>>> >- if ((netdev->priv_flags & IFF_MASTER_ALB) ||
>>> >- (netdev->priv_flags & IFF_SLAVE_INACTIVE) ||
>>> >- (netdev->priv_flags & IFF_MASTER_8023AD)) {
>>> >+ if (netdev->priv_flags & IFF_BONDING && netdev->flags & IFF_MASTER) {
>>> > FCOE_NETDEV_DBG(netdev, "Bonded interfaces not supported\n");
>>> > return -EOPNOTSUPP;
>>> > }
>>> >--
>>> >1.7.3.4
>>> >
>>
>>James, feel free to pick up this patch. I don't have anything in my fcoe
>>tree right now that it would conflict with. I'll also put it in my tree
>>and resend if you don't put it into scsi-misc directly.
>
> What's the status of this? Maybe this should rather go thru net-next
Sure, I can take this. I'll look at it later.
^ permalink raw reply
* Re: [net-next-2.6] Latest GIT pulled into linux-next
From: David Miller @ 2011-03-12 19:00 UTC (permalink / raw)
To: sedat.dilek, sedat.dilek; +Cc: netdev
In-Reply-To: <AANLkTi=hna0mq5QTahDP8bHCq5_6ezs7PFeimpLuUe7S@mail.gmail.com>
There is nothing us networking folks can do about a block
driver build failure.
^ permalink raw reply
* (unknown),
From: Money Gram Transfer @ 2011-03-12 15:26 UTC (permalink / raw)
My working partner in relationship with
HSBC London has concluded that our working
partner has helped us to send you first payment of US$5,000 to you as
instructed by United Nation government and will
keep sending you $5000 twice a week until
the payment of (US$420,000) is completed
within six months and here is the information
MONEY TRANSFER REFERENCE:2116-3297
SENDER'S NAME: Mike Marx
AMOUNT: US$5000
To track your funds forward money gram
Transfer agent Mr Allan Davis
Your Name.__________________________
Phone number __________________________
Contact Allan Davis for the funds clearance
certificate necessary for the transfer of your funds
E-mail:moneygramtransfer01@webadictos.net
D/L: Tel:+44 7024018331
Please direct all enquiring to:
Mr Allan Davis
^ permalink raw reply
* Re: Bad checksums and lost packets with macvlan on dummy
From: Daniel Lezcano @ 2011-03-12 21:59 UTC (permalink / raw)
To: Patrick McHardy
Cc: Andrian Nord, lxc-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
Eric Dumazet, Linux Netdev List
In-Reply-To: <4D764030.8020202-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org>
Hi Patrick,
I noticed another problem with the macvlan driver.
In the function dev_forward_skb the test always succeed in the second
condition making the packet to be dropped.
...
if (unlikely(!(dev->flags & IFF_UP) ||
(skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
...
When tracing I have the following values:
skb->len = 2962
and
dev->mtu + dev->hard_header_len + VLAN_HLEN = 1518
Do you have any idea where that could be come from ?
Thanks
-- Daniel
On 03/08/2011 03:41 PM, Patrick McHardy wrote:
> Am 02.03.2011 19:33, schrieb Daniel Lezcano:
>> On 03/02/2011 07:03 PM, Patrick McHardy wrote:
>>> Am 02.03.2011 17:03, schrieb Daniel Lezcano:
>>>> On 03/02/2011 12:03 PM, Patrick McHardy wrote:
>>>>> Am 01.03.2011 21:04, schrieb Daniel Lezcano:
>>>>>> On 03/01/2011 05:51 PM, Patrick McHardy wrote:
>>>>>>>> Patrick, do you have any suggestions to fix this ?
>>>>>>> Since the frames are only looped back locally, I suppose the easiest
>>>>>>> fix would be to mark them with CHECKSUM_UNNECESSARY. Alternatively
>>>>>>> we need to complete the checksum manually, similar to what
>>>>>>> dev_hard_start_xmit() does.
>>>>>> That sounds very simple to fix, maybe too much simple :)
>>>>>>
>>>>>> I did the following change:
>>>>>>
>>>>>> --- linux-next.orig/drivers/net/macvlan.c
>>>>>> +++ linux-next/drivers/net/macvlan.c
>>>>>> @@ -222,6 +222,7 @@ static int macvlan_queue_xmit(struct sk_
>>>>>>
>>>>>> if (vlan->mode == MACVLAN_MODE_BRIDGE) {
>>>>>> const struct ethhdr *eth = (void *)skb->data;
>>>>>> + skb->ip_summed = CHECKSUM_UNNECESSARY;
>>>>>>
>>>>>> /* send to other bridge ports directly */
>>>>>> if (is_multicast_ether_addr(eth->h_dest)) {
>>>>>>
>>>>>>
>>>>>> and that fixed the problem. Do you think it is acceptable ?
>>>>> The only problem I see is if the packets are bridged to a
>>>>> different networking device (or redirected using the mirred
>>>>> action), in this case the checksum will not be completed.
>>>>> This would be a very strange setup though and probably wouldn't
>>>>> be using dummy as lower device, so I'm not sure we have to
>>>>> worry about this case.
>>>> I am not sure to get it, do you say the patch is correct ?
>>> Its correct with a short-coming that doesn't seem to matter.
>>>
>>>> If my understanding is correct, the packet will be flagged
>>>> CHECKSUM_UNNECESSARY only for the macvlan devices, right ?
>>> Only for packets bridged between macvlan devices. A setup like
>>> the following would cause problems:
>>>
>>> br0
>>> |
>>> .----------.
>>> | |
>>> macvlan0 macvlan1 eth0
>>> | |
>>> -------.-------
>>> dummy0
>>>
>>> In this case packets sent from macvlan0 will show up on
>>> eth0 with incorrect setups. However this setup doesn't
>>> seem realistic to me, you would simply use eth0 instead
>>> of dummy0.
>> Ok, I understand. thanks for the clarification.
>>
>>>> By the way, this problem occurs for any lower device with offloading
>>>> capabilities with a macvlan port in bridge mode.
>>> True. This doesn't affect outgoing packets since their checksum
>>> will be completed in dev_hard_start_xmit(), but it affects
>>> packets bridged between macvlans.
>> One last question. In the case of broadcast packets with maclvan in
>> bridge mode.
>> We will have the packets going through each macvlan port and also to the
>> lower-device, right ?
>> For the latter, don't we have a problem if the packet is flagged
>> CHECKSUM_UNNECESSARY ?
>>
>> Shouldn't we restore the ip_summed field before sending through
>> dev_queue_xmit ?
> Yes, that seems correct in order to have dev_hard_start_xmit() complete
> the checksum if necessary.
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
^ permalink raw reply
* Re: [Lxc-users] Bad checksums and lost packets with macvlan on dummy
From: Daniel Lezcano @ 2011-03-12 22:07 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Andrian Nord, lxc-users, Eric Dumazet, Linux Netdev List
In-Reply-To: <4D7BECCD.70004@free.fr>
On 03/12/2011 10:59 PM, Daniel Lezcano wrote:
>
> Hi Patrick,
>
> I noticed another problem with the macvlan driver.
>
> In the function dev_forward_skb the test always succeed in the second
> condition making the packet to be dropped.
>
> ...
>
> if (unlikely(!(dev->flags& IFF_UP) ||
> (skb->len> (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
>
> ...
>
> When tracing I have the following values:
>
> skb->len = 2962
> and
> dev->mtu + dev->hard_header_len + VLAN_HLEN = 1518
>
> Do you have any idea where that could be come from ?
Disabling TSO solves the problem. Is it possible the packets are not
fragmented to the mtu size as it is supposed to be done by the lower
device but as we are in bridge mode, we dev_forward_skb and the check is
expecting the packet to be mtu-compliant ?
> On 03/08/2011 03:41 PM, Patrick McHardy wrote:
>> Am 02.03.2011 19:33, schrieb Daniel Lezcano:
>>> On 03/02/2011 07:03 PM, Patrick McHardy wrote:
>>>> Am 02.03.2011 17:03, schrieb Daniel Lezcano:
>>>>> On 03/02/2011 12:03 PM, Patrick McHardy wrote:
>>>>>> Am 01.03.2011 21:04, schrieb Daniel Lezcano:
>>>>>>> On 03/01/2011 05:51 PM, Patrick McHardy wrote:
>>>>>>>>> Patrick, do you have any suggestions to fix this ?
>>>>>>>> Since the frames are only looped back locally, I suppose the easiest
>>>>>>>> fix would be to mark them with CHECKSUM_UNNECESSARY. Alternatively
>>>>>>>> we need to complete the checksum manually, similar to what
>>>>>>>> dev_hard_start_xmit() does.
>>>>>>> That sounds very simple to fix, maybe too much simple :)
>>>>>>>
>>>>>>> I did the following change:
>>>>>>>
>>>>>>> --- linux-next.orig/drivers/net/macvlan.c
>>>>>>> +++ linux-next/drivers/net/macvlan.c
>>>>>>> @@ -222,6 +222,7 @@ static int macvlan_queue_xmit(struct sk_
>>>>>>>
>>>>>>> if (vlan->mode == MACVLAN_MODE_BRIDGE) {
>>>>>>> const struct ethhdr *eth = (void *)skb->data;
>>>>>>> + skb->ip_summed = CHECKSUM_UNNECESSARY;
>>>>>>>
>>>>>>> /* send to other bridge ports directly */
>>>>>>> if (is_multicast_ether_addr(eth->h_dest)) {
>>>>>>>
>>>>>>>
>>>>>>> and that fixed the problem. Do you think it is acceptable ?
>>>>>> The only problem I see is if the packets are bridged to a
>>>>>> different networking device (or redirected using the mirred
>>>>>> action), in this case the checksum will not be completed.
>>>>>> This would be a very strange setup though and probably wouldn't
>>>>>> be using dummy as lower device, so I'm not sure we have to
>>>>>> worry about this case.
>>>>> I am not sure to get it, do you say the patch is correct ?
>>>> Its correct with a short-coming that doesn't seem to matter.
>>>>
>>>>> If my understanding is correct, the packet will be flagged
>>>>> CHECKSUM_UNNECESSARY only for the macvlan devices, right ?
>>>> Only for packets bridged between macvlan devices. A setup like
>>>> the following would cause problems:
>>>>
>>>> br0
>>>> |
>>>> .----------.
>>>> | |
>>>> macvlan0 macvlan1 eth0
>>>> | |
>>>> -------.-------
>>>> dummy0
>>>>
>>>> In this case packets sent from macvlan0 will show up on
>>>> eth0 with incorrect setups. However this setup doesn't
>>>> seem realistic to me, you would simply use eth0 instead
>>>> of dummy0.
>>> Ok, I understand. thanks for the clarification.
>>>
>>>>> By the way, this problem occurs for any lower device with offloading
>>>>> capabilities with a macvlan port in bridge mode.
>>>> True. This doesn't affect outgoing packets since their checksum
>>>> will be completed in dev_hard_start_xmit(), but it affects
>>>> packets bridged between macvlans.
>>> One last question. In the case of broadcast packets with maclvan in
>>> bridge mode.
>>> We will have the packets going through each macvlan port and also to the
>>> lower-device, right ?
>>> For the latter, don't we have a problem if the packet is flagged
>>> CHECKSUM_UNNECESSARY ?
>>>
>>> Shouldn't we restore the ip_summed field before sending through
>>> dev_queue_xmit ?
>> Yes, that seems correct in order to have dev_hard_start_xmit() complete
>> the checksum if necessary.
>
>
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> Lxc-users mailing list
> Lxc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
^ permalink raw reply
* Re: pull request: wireless-next-2.6 2011-03-11
From: David Miller @ 2011-03-12 22:40 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev
In-Reply-To: <20110311210614.GF14583@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Fri, 11 Mar 2011 16:06:14 -0500
> Welcome to this week's installment of updates from the wireless world
> intended for 2.6.39... :-) The biggest notables here are a bluetooth
> pull from Gustavo, a wl12xx pull from Luca, and a number of rt2x00
> updates, along with the usual smattering of various driver updates
> and small enhancements and fixes here and there.
>
> Please let me know if there are problems!
Pulled, thanks John.
^ permalink raw reply
* Re: [net-next-2.6 00/21][pull request] Intel Wired LAN Driver Updates
From: David Miller @ 2011-03-12 22:42 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips
In-Reply-To: <1299932428-3114-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sat, 12 Mar 2011 04:20:07 -0800
> The following series contains a version string fix and bump for ixgbevf,
> added functionality for i350 devices in igb, and cleanups and fixes in
> ixgbe (mainly DCB changes).
>
> The following are changes since commit 70d279a7e2a6e308530822ba2bf4134cc0f5c091:
> e1000e: bump version number
> and are available in the git repository at:
> master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6 master
Looks good, pulled, thanks Jeff.
^ permalink raw reply
* [PATCH 0/25] Kill stack space gaps due to flowi layout.
From: David Miller @ 2011-03-12 23:23 UTC (permalink / raw)
To: netdev
One thing we got wrong from the beginning was the layout of
struct flowi. It's suboptimal by design.
For ipv4, for example, huge gaps exist between the addressing
information and the "ports". This is because we put the
addressing information for all AF types side-by-side in a
union so there is a gap because the ipv6 addresses take up
more space.
There were also completely unused portions of struct flowi due
to padding.
So as a result we get less dense data accesses, and therefore
less successful store buffer compression and less cache locality.
Lucky for us, all code paths that touch the AF dependent portions
do so in an AF dependent context. Therefore we can lay things out
any way we like.
So these changes pack things together as tightly as possible for
each AF variant. And AF independent code is only allowed to
make references to the "common" area at the beginning of each
AF instance.
Performance improvement is measurable, even a routing cache hit
output route lookup is ~20 cycles faster on Niagara2. udpflood
tests are also faster by several seconds.
I tried to minimize the noise and churn by making ipv4 helpers
for various common cases of route lookups. But some code paths
want to do something very special (f.e. icmp) and I did not work
on such helpers for ipv6. That can be done at a later time.
And in fact, ipv6 is really an area ripe for consolidation of routing
lookups. The same flowlabel resolution sequence probably occurs 10
times in the tree.
And hey, even decnet got some love here.
What I'll do tonight is push this to net-next-2.6 and then respin
the routing cache deletion patches, since those obviously won't
apply any longer. :)
^ permalink raw reply
* [PATCH 1/25] ipv4: Create and use route lookup helpers.
From: David Miller @ 2011-03-12 23:24 UTC (permalink / raw)
To: netdev
The idea here is this minimizes the number of places one has to edit
in order to make changes to how flows are defined and used.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/infiniband/core/addr.c | 8 +-----
drivers/infiniband/hw/cxgb3/iwch_cm.c | 21 +++-----------
drivers/infiniband/hw/cxgb4/cm.c | 21 +++-----------
drivers/infiniband/hw/nes/nes_cm.c | 5 +---
drivers/net/bonding/bond_main.c | 12 +++-----
drivers/net/cnic.c | 16 +++-------
drivers/net/pptp.c | 45 ++++++++++++------------------
drivers/scsi/cxgbi/libcxgbi.c | 20 ++-----------
include/net/route.h | 48 ++++++++++++++++++++++++++++++++
net/atm/clip.c | 4 +--
net/bridge/br_netfilter.c | 7 +---
net/ipv4/af_inet.c | 20 +++-----------
net/ipv4/arp.c | 12 ++------
net/ipv4/igmp.c | 34 ++++++++++-------------
net/ipv4/ip_gre.c | 49 +++++++++++---------------------
net/ipv4/ip_output.c | 33 +++++++++-------------
net/ipv4/ipip.c | 36 +++++++++---------------
net/ipv4/ipmr.c | 24 ++++++----------
net/ipv6/ip6_tunnel.c | 19 ++++++-------
net/ipv6/sit.c | 31 +++++++++-----------
net/l2tp/l2tp_ip.c | 30 +++++++-------------
net/netfilter/ipvs/ip_vs_xmit.c | 14 +--------
net/rxrpc/ar-peer.c | 23 +++-------------
23 files changed, 206 insertions(+), 326 deletions(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 2d74993..1742f72 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -183,17 +183,11 @@ static int addr4_resolve(struct sockaddr_in *src_in,
{
__be32 src_ip = src_in->sin_addr.s_addr;
__be32 dst_ip = dst_in->sin_addr.s_addr;
- struct flowi fl;
struct rtable *rt;
struct neighbour *neigh;
int ret;
- memset(&fl, 0, sizeof fl);
- fl.nl_u.ip4_u.daddr = dst_ip;
- fl.nl_u.ip4_u.saddr = src_ip;
- fl.oif = addr->bound_dev_if;
-
- rt = ip_route_output_key(&init_net, &fl);
+ rt = ip_route_output(&init_net, dst_ip, src_ip, 0, addr->bound_dev_if);
if (IS_ERR(rt)) {
ret = PTR_ERR(rt);
goto out;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e0ccbc5..3216bca 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -338,23 +338,10 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip,
__be16 peer_port, u8 tos)
{
struct rtable *rt;
- struct flowi fl = {
- .oif = 0,
- .nl_u = {
- .ip4_u = {
- .daddr = peer_ip,
- .saddr = local_ip,
- .tos = tos}
- },
- .proto = IPPROTO_TCP,
- .uli_u = {
- .ports = {
- .sport = local_port,
- .dport = peer_port}
- }
- };
-
- rt = ip_route_output_flow(&init_net, &fl, NULL);
+
+ rt = ip_route_output_ports(&init_net, NULL, peer_ip, local_ip,
+ peer_port, local_port, IPPROTO_TCP,
+ tos, 0);
if (IS_ERR(rt))
return NULL;
return rt;
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 77b0eef..97a876a 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -315,23 +315,10 @@ static struct rtable *find_route(struct c4iw_dev *dev, __be32 local_ip,
__be16 peer_port, u8 tos)
{
struct rtable *rt;
- struct flowi fl = {
- .oif = 0,
- .nl_u = {
- .ip4_u = {
- .daddr = peer_ip,
- .saddr = local_ip,
- .tos = tos}
- },
- .proto = IPPROTO_TCP,
- .uli_u = {
- .ports = {
- .sport = local_port,
- .dport = peer_port}
- }
- };
-
- rt = ip_route_output_flow(&init_net, &fl, NULL);
+
+ rt = ip_route_output_ports(&init_net, NULL, peer_ip, local_ip,
+ peer_port, local_port, IPPROTO_TCP,
+ tos, 0);
if (IS_ERR(rt))
return NULL;
return rt;
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index e81599c..ef32915 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1104,15 +1104,12 @@ static inline int mini_cm_accelerated(struct nes_cm_core *cm_core,
static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpindex)
{
struct rtable *rt;
- struct flowi fl;
struct neighbour *neigh;
int rc = arpindex;
struct net_device *netdev;
struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
- memset(&fl, 0, sizeof fl);
- fl.nl_u.ip4_u.daddr = htonl(dst_ip);
- rt = ip_route_output_key(&init_net, &fl);
+ rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
if (IS_ERR(rt)) {
printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
__func__, dst_ip);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 68a5ce0..3ad4f50 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2676,7 +2676,6 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
__be32 *targets = bond->params.arp_targets;
struct vlan_entry *vlan;
struct net_device *vlan_dev;
- struct flowi fl;
struct rtable *rt;
for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
@@ -2695,15 +2694,12 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
* determine which VLAN interface would be used, so we
* can tag the ARP with the proper VLAN tag.
*/
- memset(&fl, 0, sizeof(fl));
- fl.fl4_dst = targets[i];
- fl.fl4_tos = RTO_ONLINK;
-
- rt = ip_route_output_key(dev_net(bond->dev), &fl);
+ rt = ip_route_output(dev_net(bond->dev), targets[i], 0,
+ RTO_ONLINK, 0);
if (IS_ERR(rt)) {
if (net_ratelimit()) {
pr_warning("%s: no route to arp_ip_target %pI4\n",
- bond->dev->name, &fl.fl4_dst);
+ bond->dev->name, &targets[i]);
}
continue;
}
@@ -2739,7 +2735,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
if (net_ratelimit()) {
pr_warning("%s: no path to arp_ip_target %pI4 via rt.dev %s\n",
- bond->dev->name, &fl.fl4_dst,
+ bond->dev->name, &targets[i],
rt->dst.dev ? rt->dst.dev->name : "NULL");
}
ip_rt_put(rt);
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 271a1f0..6583295 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -3407,20 +3407,14 @@ static int cnic_get_v4_route(struct sockaddr_in *dst_addr,
struct dst_entry **dst)
{
#if defined(CONFIG_INET)
- struct flowi fl;
- int err;
struct rtable *rt;
- memset(&fl, 0, sizeof(fl));
- fl.nl_u.ip4_u.daddr = dst_addr->sin_addr.s_addr;
-
- rt = ip_route_output_key(&init_net, &fl);
- err = 0;
- if (!IS_ERR(rt))
+ rt = ip_route_output(&init_net, dst_addr->sin_addr.s_addr, 0, 0, 0);
+ if (!IS_ERR(rt)) {
*dst = &rt->dst;
- else
- err = PTR_ERR(rt);
- return err;
+ return 0;
+ }
+ return PTR_ERR(rt);
#else
return -ENETUNREACH;
#endif
diff --git a/drivers/net/pptp.c b/drivers/net/pptp.c
index 1af549c..51dfcf8 100644
--- a/drivers/net/pptp.c
+++ b/drivers/net/pptp.c
@@ -189,18 +189,14 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
if (sk_pppox(po)->sk_state & PPPOX_DEAD)
goto tx_error;
- {
- struct flowi fl = { .oif = 0,
- .nl_u = {
- .ip4_u = {
- .daddr = opt->dst_addr.sin_addr.s_addr,
- .saddr = opt->src_addr.sin_addr.s_addr,
- .tos = RT_TOS(0) } },
- .proto = IPPROTO_GRE };
- rt = ip_route_output_key(&init_net, &fl);
- if (IS_ERR(rt))
- goto tx_error;
- }
+ rt = ip_route_output_ports(&init_net, NULL,
+ opt->dst_addr.sin_addr.s_addr,
+ opt->src_addr.sin_addr.s_addr,
+ 0, 0, IPPROTO_GRE,
+ RT_TOS(0), 0);
+ if (IS_ERR(rt))
+ goto tx_error;
+
tdev = rt->dst.dev;
max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(*iph) + sizeof(*hdr) + 2;
@@ -467,22 +463,17 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
po->chan.private = sk;
po->chan.ops = &pptp_chan_ops;
- {
- struct flowi fl = {
- .nl_u = {
- .ip4_u = {
- .daddr = opt->dst_addr.sin_addr.s_addr,
- .saddr = opt->src_addr.sin_addr.s_addr,
- .tos = RT_CONN_FLAGS(sk) } },
- .proto = IPPROTO_GRE };
- security_sk_classify_flow(sk, &fl);
- rt = ip_route_output_key(&init_net, &fl);
- if (IS_ERR(rt)) {
- error = -EHOSTUNREACH;
- goto end;
- }
- sk_setup_caps(sk, &rt->dst);
+ rt = ip_route_output_ports(&init_net, sk,
+ opt->dst_addr.sin_addr.s_addr,
+ opt->src_addr.sin_addr.s_addr,
+ 0, 0,
+ IPPROTO_GRE, RT_CONN_FLAGS(sk), 0);
+ if (IS_ERR(rt)) {
+ error = -EHOSTUNREACH;
+ goto end;
}
+ sk_setup_caps(sk, &rt->dst);
+
po->chan.mtu = dst_mtu(&rt->dst);
if (!po->chan.mtu)
po->chan.mtu = PPP_MTU;
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 889199a..a24dff9 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -451,26 +451,12 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev)
}
static struct rtable *find_route_ipv4(__be32 saddr, __be32 daddr,
- __be16 sport, __be16 dport, u8 tos)
+ __be16 sport, __be16 dport, u8 tos)
{
struct rtable *rt;
- struct flowi fl = {
- .oif = 0,
- .nl_u = {
- .ip4_u = {
- .daddr = daddr,
- .saddr = saddr,
- .tos = tos }
- },
- .proto = IPPROTO_TCP,
- .uli_u = {
- .ports = {
- .sport = sport,
- .dport = dport }
- }
- };
- rt = ip_route_output_flow(&init_net, &fl, NULL);
+ rt = ip_route_output_ports(&init_net, NULL, daddr, saddr,
+ dport, sport, IPPROTO_TCP, tos, 0);
if (IS_ERR(rt))
return NULL;
diff --git a/include/net/route.h b/include/net/route.h
index 9257f5f..f140f41 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -132,6 +132,54 @@ static inline struct rtable *ip_route_output_key(struct net *net, struct flowi *
return ip_route_output_flow(net, flp, NULL);
}
+static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
+ __be32 saddr, u8 tos, int oif)
+{
+ struct flowi fl = {
+ .oif = oif,
+ .fl4_dst = daddr,
+ .fl4_src = saddr,
+ .fl4_tos = tos,
+ };
+ return ip_route_output_key(net, &fl);
+}
+
+static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk,
+ __be32 daddr, __be32 saddr,
+ __be16 dport, __be16 sport,
+ __u8 proto, __u8 tos, int oif)
+{
+ struct flowi fl = {
+ .oif = oif,
+ .flags = sk ? inet_sk_flowi_flags(sk) : 0,
+ .mark = sk ? sk->sk_mark : 0,
+ .fl4_dst = daddr,
+ .fl4_src = saddr,
+ .fl4_tos = tos,
+ .proto = proto,
+ .fl_ip_dport = dport,
+ .fl_ip_sport = sport,
+ };
+ if (sk)
+ security_sk_classify_flow(sk, &fl);
+ return ip_route_output_flow(net, &fl, sk);
+}
+
+static inline struct rtable *ip_route_output_gre(struct net *net,
+ __be32 daddr, __be32 saddr,
+ __be32 gre_key, __u8 tos, int oif)
+{
+ struct flowi fl = {
+ .oif = oif,
+ .fl4_dst = daddr,
+ .fl4_src = saddr,
+ .fl4_tos = tos,
+ .proto = IPPROTO_GRE,
+ .fl_gre_key = gre_key,
+ };
+ return ip_route_output_key(net, &fl);
+}
+
extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
u8 tos, struct net_device *devin, bool noref);
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 810a129..1d4be60 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -502,8 +502,6 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
struct atmarp_entry *entry;
int error;
struct clip_vcc *clip_vcc;
- struct flowi fl = { .fl4_dst = ip,
- .fl4_tos = 1 };
struct rtable *rt;
if (vcc->push != clip_push) {
@@ -520,7 +518,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
unlink_clip_vcc(clip_vcc);
return 0;
}
- rt = ip_route_output_key(&init_net, &fl);
+ rt = ip_route_output(&init_net, ip, 0, 1, 0);
if (IS_ERR(rt))
return PTR_ERR(rt);
neigh = __neigh_lookup(&clip_tbl, &ip, rt->dst.dev, 1);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 45b57b1..f97af559 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -412,10 +412,6 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
if (dnat_took_place(skb)) {
if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) {
- struct flowi fl = {
- .fl4_dst = iph->daddr,
- .fl4_tos = RT_TOS(iph->tos),
- };
struct in_device *in_dev = __in_dev_get_rcu(dev);
/* If err equals -EHOSTUNREACH the error is due to a
@@ -428,7 +424,8 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
if (err != -EHOSTUNREACH || !in_dev || IN_DEV_FORWARD(in_dev))
goto free_skb;
- rt = ip_route_output_key(dev_net(dev), &fl);
+ rt = ip_route_output(dev_net(dev), iph->daddr, 0,
+ RT_TOS(iph->tos), 0);
if (!IS_ERR(rt)) {
/* - Bridged-and-DNAT'ed traffic doesn't
* require ip_forwarding. */
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 35a5020..807d83c 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1157,22 +1157,10 @@ int inet_sk_rebuild_header(struct sock *sk)
daddr = inet->inet_daddr;
if (inet->opt && inet->opt->srr)
daddr = inet->opt->faddr;
- {
- struct flowi fl = {
- .oif = sk->sk_bound_dev_if,
- .mark = sk->sk_mark,
- .fl4_dst = daddr,
- .fl4_src = inet->inet_saddr,
- .fl4_tos = RT_CONN_FLAGS(sk),
- .proto = sk->sk_protocol,
- .flags = inet_sk_flowi_flags(sk),
- .fl_ip_sport = inet->inet_sport,
- .fl_ip_dport = inet->inet_dport,
- };
-
- security_sk_classify_flow(sk, &fl);
- rt = ip_route_output_flow(sock_net(sk), &fl, sk);
- }
+ rt = ip_route_output_ports(sock_net(sk), sk, daddr, inet->inet_saddr,
+ inet->inet_dport, inet->inet_sport,
+ sk->sk_protocol, RT_CONN_FLAGS(sk),
+ sk->sk_bound_dev_if);
if (!IS_ERR(rt)) {
err = 0;
sk_setup_caps(sk, &rt->dst);
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index fa9988d..090d273 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -433,14 +433,12 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
{
- struct flowi fl = { .fl4_dst = sip,
- .fl4_src = tip };
struct rtable *rt;
int flag = 0;
/*unsigned long now; */
struct net *net = dev_net(dev);
- rt = ip_route_output_key(net, &fl);
+ rt = ip_route_output(net, sip, tip, 0, 0);
if (IS_ERR(rt))
return 1;
if (rt->dst.dev != dev) {
@@ -1062,9 +1060,7 @@ static int arp_req_set(struct net *net, struct arpreq *r,
if (r->arp_flags & ATF_PERM)
r->arp_flags |= ATF_COM;
if (dev == NULL) {
- struct flowi fl = { .fl4_dst = ip,
- .fl4_tos = RTO_ONLINK };
- struct rtable *rt = ip_route_output_key(net, &fl);
+ struct rtable *rt = ip_route_output(net, ip, 0, RTO_ONLINK, 0);
if (IS_ERR(rt))
return PTR_ERR(rt);
@@ -1185,9 +1181,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
if (dev == NULL) {
- struct flowi fl = { .fl4_dst = ip,
- .fl4_tos = RTO_ONLINK };
- struct rtable *rt = ip_route_output_key(net, &fl);
+ struct rtable *rt = ip_route_output(net, ip, 0, RTO_ONLINK, 0);
if (IS_ERR(rt))
return PTR_ERR(rt);
dev = rt->dst.dev;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 12b65cc..1fd3d9c 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -321,15 +321,12 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
}
igmp_skb_size(skb) = size;
- {
- struct flowi fl = { .oif = dev->ifindex,
- .fl4_dst = IGMPV3_ALL_MCR,
- .proto = IPPROTO_IGMP };
- rt = ip_route_output_key(net, &fl);
- if (IS_ERR(rt)) {
- kfree_skb(skb);
- return NULL;
- }
+ rt = ip_route_output_ports(net, NULL, IGMPV3_ALL_MCR, 0,
+ 0, 0,
+ IPPROTO_IGMP, 0, dev->ifindex);
+ if (IS_ERR(rt)) {
+ kfree_skb(skb);
+ return NULL;
}
if (rt->rt_src == 0) {
kfree_skb(skb);
@@ -667,14 +664,12 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
else
dst = group;
- {
- struct flowi fl = { .oif = dev->ifindex,
- .fl4_dst = dst,
- .proto = IPPROTO_IGMP };
- rt = ip_route_output_key(net, &fl);
- if (IS_ERR(rt))
- return -1;
- }
+ rt = ip_route_output_ports(net, NULL, dst, 0,
+ 0, 0,
+ IPPROTO_IGMP, 0, dev->ifindex);
+ if (IS_ERR(rt))
+ return -1;
+
if (rt->rt_src == 0) {
ip_rt_put(rt);
return -1;
@@ -1441,7 +1436,6 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
/* RTNL is locked */
static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
{
- struct flowi fl = { .fl4_dst = imr->imr_multiaddr.s_addr };
struct net_device *dev = NULL;
struct in_device *idev = NULL;
@@ -1456,7 +1450,9 @@ static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
}
if (!dev) {
- struct rtable *rt = ip_route_output_key(net, &fl);
+ struct rtable *rt = ip_route_output(net,
+ imr->imr_multiaddr.s_addr,
+ 0, 0, 0);
if (!IS_ERR(rt)) {
dev = rt->dst.dev;
ip_rt_put(rt);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 7146595..da5941f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -769,20 +769,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
tos = ipv6_get_dsfield((struct ipv6hdr *)old_iph);
}
- {
- struct flowi fl = {
- .oif = tunnel->parms.link,
- .fl4_dst = dst,
- .fl4_src = tiph->saddr,
- .fl4_tos = RT_TOS(tos),
- .proto = IPPROTO_GRE,
- .fl_gre_key = tunnel->parms.o_key
- };
- rt = ip_route_output_key(dev_net(dev), &fl);
- if (IS_ERR(rt)) {
- dev->stats.tx_carrier_errors++;
- goto tx_error;
- }
+ rt = ip_route_output_gre(dev_net(dev), dst, tiph->saddr,
+ tunnel->parms.o_key, RT_TOS(tos),
+ tunnel->parms.link);
+ if (IS_ERR(rt)) {
+ dev->stats.tx_carrier_errors++;
+ goto tx_error;
}
tdev = rt->dst.dev;
@@ -946,15 +938,11 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
/* Guess output device to choose reasonable mtu and needed_headroom */
if (iph->daddr) {
- struct flowi fl = {
- .oif = tunnel->parms.link,
- .fl4_dst = iph->daddr,
- .fl4_src = iph->saddr,
- .fl4_tos = RT_TOS(iph->tos),
- .proto = IPPROTO_GRE,
- .fl_gre_key = tunnel->parms.o_key
- };
- struct rtable *rt = ip_route_output_key(dev_net(dev), &fl);
+ struct rtable *rt = ip_route_output_gre(dev_net(dev),
+ iph->daddr, iph->saddr,
+ tunnel->parms.o_key,
+ RT_TOS(iph->tos),
+ tunnel->parms.link);
if (!IS_ERR(rt)) {
tdev = rt->dst.dev;
@@ -1208,15 +1196,12 @@ static int ipgre_open(struct net_device *dev)
struct ip_tunnel *t = netdev_priv(dev);
if (ipv4_is_multicast(t->parms.iph.daddr)) {
- struct flowi fl = {
- .oif = t->parms.link,
- .fl4_dst = t->parms.iph.daddr,
- .fl4_src = t->parms.iph.saddr,
- .fl4_tos = RT_TOS(t->parms.iph.tos),
- .proto = IPPROTO_GRE,
- .fl_gre_key = t->parms.o_key
- };
- struct rtable *rt = ip_route_output_key(dev_net(dev), &fl);
+ struct rtable *rt = ip_route_output_gre(dev_net(dev),
+ t->parms.iph.daddr,
+ t->parms.iph.saddr,
+ t->parms.o_key,
+ RT_TOS(t->parms.iph.tos),
+ t->parms.link);
if (IS_ERR(rt))
return -EADDRNOTAVAIL;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 171f483..916152d 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -339,26 +339,19 @@ int ip_queue_xmit(struct sk_buff *skb)
if(opt && opt->srr)
daddr = opt->faddr;
- {
- struct flowi fl = { .oif = sk->sk_bound_dev_if,
- .mark = sk->sk_mark,
- .fl4_dst = daddr,
- .fl4_src = inet->inet_saddr,
- .fl4_tos = RT_CONN_FLAGS(sk),
- .proto = sk->sk_protocol,
- .flags = inet_sk_flowi_flags(sk),
- .fl_ip_sport = inet->inet_sport,
- .fl_ip_dport = inet->inet_dport };
-
- /* If this fails, retransmit mechanism of transport layer will
- * keep trying until route appears or the connection times
- * itself out.
- */
- security_sk_classify_flow(sk, &fl);
- rt = ip_route_output_flow(sock_net(sk), &fl, sk);
- if (IS_ERR(rt))
- goto no_route;
- }
+ /* If this fails, retransmit mechanism of transport layer will
+ * keep trying until route appears or the connection times
+ * itself out.
+ */
+ rt = ip_route_output_ports(sock_net(sk), sk,
+ daddr, inet->inet_saddr,
+ inet->inet_dport,
+ inet->inet_sport,
+ sk->sk_protocol,
+ RT_CONN_FLAGS(sk),
+ sk->sk_bound_dev_if);
+ if (IS_ERR(rt))
+ goto no_route;
sk_setup_caps(sk, &rt->dst);
}
skb_dst_set_noref(skb, &rt->dst);
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 65008f4..bfc17c5 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -460,20 +460,14 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
goto tx_error_icmp;
}
- {
- struct flowi fl = {
- .oif = tunnel->parms.link,
- .fl4_dst = dst,
- .fl4_src= tiph->saddr,
- .fl4_tos = RT_TOS(tos),
- .proto = IPPROTO_IPIP
- };
-
- rt = ip_route_output_key(dev_net(dev), &fl);
- if (IS_ERR(rt)) {
- dev->stats.tx_carrier_errors++;
- goto tx_error_icmp;
- }
+ rt = ip_route_output_ports(dev_net(dev), NULL,
+ dst, tiph->saddr,
+ 0, 0,
+ IPPROTO_IPIP, RT_TOS(tos),
+ tunnel->parms.link);
+ if (IS_ERR(rt)) {
+ dev->stats.tx_carrier_errors++;
+ goto tx_error_icmp;
}
tdev = rt->dst.dev;
@@ -584,14 +578,12 @@ static void ipip_tunnel_bind_dev(struct net_device *dev)
iph = &tunnel->parms.iph;
if (iph->daddr) {
- struct flowi fl = {
- .oif = tunnel->parms.link,
- .fl4_dst = iph->daddr,
- .fl4_src = iph->saddr,
- .fl4_tos = RT_TOS(iph->tos),
- .proto = IPPROTO_IPIP
- };
- struct rtable *rt = ip_route_output_key(dev_net(dev), &fl);
+ struct rtable *rt = ip_route_output_ports(dev_net(dev), NULL,
+ iph->daddr, iph->saddr,
+ 0, 0,
+ IPPROTO_IPIP,
+ RT_TOS(iph->tos),
+ tunnel->parms.link);
if (!IS_ERR(rt)) {
tdev = rt->dst.dev;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 74909ba..594a300 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1611,25 +1611,19 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,
#endif
if (vif->flags & VIFF_TUNNEL) {
- struct flowi fl = {
- .oif = vif->link,
- .fl4_dst = vif->remote,
- .fl4_src = vif->local,
- .fl4_tos = RT_TOS(iph->tos),
- .proto = IPPROTO_IPIP
- };
- rt = ip_route_output_key(net, &fl);
+ rt = ip_route_output_ports(net, NULL,
+ vif->remote, vif->local,
+ 0, 0,
+ IPPROTO_IPIP,
+ RT_TOS(iph->tos), vif->link);
if (IS_ERR(rt))
goto out_free;
encap = sizeof(struct iphdr);
} else {
- struct flowi fl = {
- .oif = vif->link,
- .fl4_dst = iph->daddr,
- .fl4_tos = RT_TOS(iph->tos),
- .proto = IPPROTO_IPIP
- };
- rt = ip_route_output_key(net, &fl);
+ rt = ip_route_output_ports(net, NULL, iph->daddr, 0,
+ 0, 0,
+ IPPROTO_IPIP,
+ RT_TOS(iph->tos), vif->link);
if (IS_ERR(rt))
goto out_free;
}
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ea8d5e8..f199b84 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -536,7 +536,6 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
int err;
struct sk_buff *skb2;
struct iphdr *eiph;
- struct flowi fl;
struct rtable *rt;
err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code,
@@ -578,11 +577,10 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
eiph = ip_hdr(skb2);
/* Try to guess incoming interface */
- memset(&fl, 0, sizeof(fl));
- fl.fl4_dst = eiph->saddr;
- fl.fl4_tos = RT_TOS(eiph->tos);
- fl.proto = IPPROTO_IPIP;
- rt = ip_route_output_key(dev_net(skb->dev), &fl);
+ rt = ip_route_output_ports(dev_net(skb->dev), NULL,
+ eiph->saddr, 0,
+ 0, 0,
+ IPPROTO_IPIP, RT_TOS(eiph->tos), 0);
if (IS_ERR(rt))
goto out;
@@ -592,10 +590,11 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if (rt->rt_flags & RTCF_LOCAL) {
ip_rt_put(rt);
rt = NULL;
- fl.fl4_dst = eiph->daddr;
- fl.fl4_src = eiph->saddr;
- fl.fl4_tos = eiph->tos;
- rt = ip_route_output_key(dev_net(skb->dev), &fl);
+ rt = ip_route_output_ports(dev_net(skb->dev), NULL,
+ eiph->daddr, eiph->saddr,
+ 0, 0,
+ IPPROTO_IPIP,
+ RT_TOS(eiph->tos), 0);
if (IS_ERR(rt) ||
rt->dst.dev->type != ARPHRD_TUNNEL) {
if (!IS_ERR(rt))
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3534cea..43b3337 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -732,17 +732,14 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
dst = addr6->s6_addr32[3];
}
- {
- struct flowi fl = { .fl4_dst = dst,
- .fl4_src = tiph->saddr,
- .fl4_tos = RT_TOS(tos),
- .oif = tunnel->parms.link,
- .proto = IPPROTO_IPV6 };
- rt = ip_route_output_key(dev_net(dev), &fl);
- if (IS_ERR(rt)) {
- dev->stats.tx_carrier_errors++;
- goto tx_error_icmp;
- }
+ rt = ip_route_output_ports(dev_net(dev), NULL,
+ dst, tiph->saddr,
+ 0, 0,
+ IPPROTO_IPV6, RT_TOS(tos),
+ tunnel->parms.link);
+ if (IS_ERR(rt)) {
+ dev->stats.tx_carrier_errors++;
+ goto tx_error_icmp;
}
if (rt->rt_type != RTN_UNICAST) {
ip_rt_put(rt);
@@ -858,12 +855,12 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
iph = &tunnel->parms.iph;
if (iph->daddr) {
- struct flowi fl = { .fl4_dst = iph->daddr,
- .fl4_src = iph->saddr,
- .fl4_tos = RT_TOS(iph->tos),
- .oif = tunnel->parms.link,
- .proto = IPPROTO_IPV6 };
- struct rtable *rt = ip_route_output_key(dev_net(dev), &fl);
+ struct rtable *rt = ip_route_output_ports(dev_net(dev), NULL,
+ iph->daddr, iph->saddr,
+ 0, 0,
+ IPPROTO_IPV6,
+ RT_TOS(iph->tos),
+ tunnel->parms.link);
if (!IS_ERR(rt)) {
tdev = rt->dst.dev;
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 2a698ff..fce9bd3 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -475,25 +475,17 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
if (opt && opt->srr)
daddr = opt->faddr;
- {
- struct flowi fl = { .oif = sk->sk_bound_dev_if,
- .fl4_dst = daddr,
- .fl4_src = inet->inet_saddr,
- .fl4_tos = RT_CONN_FLAGS(sk),
- .proto = sk->sk_protocol,
- .flags = inet_sk_flowi_flags(sk),
- .fl_ip_sport = inet->inet_sport,
- .fl_ip_dport = inet->inet_dport };
-
- /* If this fails, retransmit mechanism of transport layer will
- * keep trying until route appears or the connection times
- * itself out.
- */
- security_sk_classify_flow(sk, &fl);
- rt = ip_route_output_flow(sock_net(sk), &fl, sk);
- if (IS_ERR(rt))
- goto no_route;
- }
+ /* If this fails, retransmit mechanism of transport layer will
+ * keep trying until route appears or the connection times
+ * itself out.
+ */
+ rt = ip_route_output_ports(sock_net(sk), sk,
+ daddr, inet->inet_saddr,
+ inet->inet_dport, inet->inet_sport,
+ sk->sk_protocol, RT_CONN_FLAGS(sk),
+ sk->sk_bound_dev_if);
+ if (IS_ERR(rt))
+ goto no_route;
sk_setup_caps(sk, &rt->dst);
}
skb_dst_set(skb, dst_clone(&rt->dst));
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index 878f6dd..faf381d 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -98,12 +98,7 @@ __ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,
spin_lock(&dest->dst_lock);
if (!(rt = (struct rtable *)
__ip_vs_dst_check(dest, rtos))) {
- struct flowi fl = {
- .fl4_dst = dest->addr.ip,
- .fl4_tos = rtos,
- };
-
- rt = ip_route_output_key(net, &fl);
+ rt = ip_route_output(net, dest->addr.ip, 0, rtos, 0);
if (IS_ERR(rt)) {
spin_unlock(&dest->dst_lock);
IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n",
@@ -117,12 +112,7 @@ __ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,
}
spin_unlock(&dest->dst_lock);
} else {
- struct flowi fl = {
- .fl4_dst = daddr,
- .fl4_tos = rtos,
- };
-
- rt = ip_route_output_key(net, &fl);
+ rt = ip_route_output(net, daddr, 0, rtos, 0);
if (IS_ERR(rt)) {
IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n",
&daddr);
diff --git a/net/rxrpc/ar-peer.c b/net/rxrpc/ar-peer.c
index 3620c56..55b93dc 100644
--- a/net/rxrpc/ar-peer.c
+++ b/net/rxrpc/ar-peer.c
@@ -36,28 +36,13 @@ static void rxrpc_destroy_peer(struct work_struct *work);
static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer)
{
struct rtable *rt;
- struct flowi fl;
peer->if_mtu = 1500;
- memset(&fl, 0, sizeof(fl));
-
- switch (peer->srx.transport.family) {
- case AF_INET:
- fl.oif = 0;
- fl.proto = IPPROTO_UDP,
- fl.fl4_dst = peer->srx.transport.sin.sin_addr.s_addr;
- fl.fl4_src = 0;
- fl.fl4_tos = 0;
- /* assume AFS.CM talking to AFS.FS */
- fl.fl_ip_sport = htons(7001);
- fl.fl_ip_dport = htons(7000);
- break;
- default:
- BUG();
- }
-
- rt = ip_route_output_key(&init_net, &fl);
+ rt = ip_route_output_ports(&init_net, NULL,
+ peer->srx.transport.sin.sin_addr.s_addr, 0,
+ htons(7000), htons(7001),
+ IPPROTO_UDP, 0, 0);
if (IS_ERR(rt)) {
_leave(" [route err %ld]", PTR_ERR(rt));
return;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/25] net: Remove unnecessary padding in struct flowi
From: David Miller @ 2011-03-12 23:25 UTC (permalink / raw)
To: netdev
Move tos, scope, proto, and flags to the beginning of
the structure.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/flow.h | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/net/flow.h b/include/net/flow.h
index fd04138..a661fd6 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -14,13 +14,19 @@ struct flowi {
int oif;
int iif;
__u32 mark;
+ __u8 tos;
+ __u8 scope;
+ __u8 proto;
+ __u8 flags;
+#define FLOWI_FLAG_ANYSRC 0x01
+#define FLOWI_FLAG_PRECOW_METRICS 0x02
+#define FLOWI_FLAG_CAN_SLEEP 0x04
+ __u32 secid;
union {
struct {
__be32 daddr;
__be32 saddr;
- __u8 tos;
- __u8 scope;
} ip4_u;
struct {
@@ -43,14 +49,9 @@ struct flowi {
#define fl6_flowlabel nl_u.ip6_u.flowlabel
#define fl4_dst nl_u.ip4_u.daddr
#define fl4_src nl_u.ip4_u.saddr
-#define fl4_tos nl_u.ip4_u.tos
-#define fl4_scope nl_u.ip4_u.scope
+#define fl4_tos tos
+#define fl4_scope scope
- __u8 proto;
- __u8 flags;
-#define FLOWI_FLAG_ANYSRC 0x01
-#define FLOWI_FLAG_PRECOW_METRICS 0x02
-#define FLOWI_FLAG_CAN_SLEEP 0x04
union {
struct {
__be16 sport;
@@ -81,7 +82,6 @@ struct flowi {
#define fl_ipsec_spi uli_u.spi
#define fl_mh_type uli_u.mht.type
#define fl_gre_key uli_u.gre_key
- __u32 secid; /* used by xfrm; see secid.txt */
} __attribute__((__aligned__(BITS_PER_LONG/8)));
#define FLOW_DIR_IN 0
--
1.7.4.1
^ permalink raw reply related
* [PATCH 3/25] xfrm: Eliminate "fl" and "pol" args to xfrm_bundle_ok().
From: David Miller @ 2011-03-12 23:25 UTC (permalink / raw)
To: netdev
There is only one caller of xfrm_bundle_ok(), and that always passes these
parameters as NULL.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/xfrm/xfrm_policy.c | 22 +++-------------------
1 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b1932a6..9e4aacd 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -50,8 +50,7 @@ static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
static void xfrm_init_pmtu(struct dst_entry *dst);
static int stale_bundle(struct dst_entry *dst);
-static int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
- const struct flowi *fl, int family);
+static int xfrm_bundle_ok(struct xfrm_dst *xdst, int family);
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
@@ -2223,7 +2222,7 @@ static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie)
static int stale_bundle(struct dst_entry *dst)
{
- return !xfrm_bundle_ok(NULL, (struct xfrm_dst *)dst, NULL, AF_UNSPEC);
+ return !xfrm_bundle_ok((struct xfrm_dst *)dst, AF_UNSPEC);
}
void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
@@ -2295,8 +2294,7 @@ static void xfrm_init_pmtu(struct dst_entry *dst)
* still valid.
*/
-static int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first,
- const struct flowi *fl, int family)
+static int xfrm_bundle_ok(struct xfrm_dst *first, int family)
{
struct dst_entry *dst = &first->u.dst;
struct xfrm_dst *last;
@@ -2305,26 +2303,12 @@ static int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first,
if (!dst_check(dst->path, ((struct xfrm_dst *)dst)->path_cookie) ||
(dst->dev && !netif_running(dst->dev)))
return 0;
-#ifdef CONFIG_XFRM_SUB_POLICY
- if (fl) {
- if (first->origin && !flow_cache_uli_match(first->origin, fl))
- return 0;
- if (first->partner &&
- !xfrm_selector_match(first->partner, fl, family))
- return 0;
- }
-#endif
last = NULL;
do {
struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
- if (fl && !xfrm_selector_match(&dst->xfrm->sel, fl, family))
- return 0;
- if (fl && pol &&
- !security_xfrm_state_pol_flow_match(dst->xfrm, pol, fl))
- return 0;
if (dst->xfrm->km.state != XFRM_STATE_VALID)
return 0;
if (xdst->xfrm_genid != dst->xfrm->genid)
--
1.7.4.1
^ permalink raw reply related
* [PATCH 4/25] net: Put flowi_* prefix on AF independent members of struct flowi
From: David Miller @ 2011-03-12 23:25 UTC (permalink / raw)
To: netdev
I intend to turn struct flowi into a union of AF specific flowi
structs. There will be a common structure that each variant includes
first, much like struct sock_common.
This is the first step to move in that direction.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/infiniband/core/addr.c | 2 +-
drivers/net/cnic.c | 2 +-
include/net/dn_route.h | 4 +-
include/net/flow.h | 22 ++++----
include/net/route.h | 36 +++++++-------
include/net/xfrm.h | 4 +-
net/core/fib_rules.c | 6 +-
net/dccp/ipv4.c | 17 ++++---
net/dccp/ipv6.c | 20 ++++----
net/decnet/af_decnet.c | 4 +-
net/decnet/dn_fib.c | 4 +-
net/decnet/dn_nsp_out.c | 4 +-
net/decnet/dn_route.c | 96 ++++++++++++++++++++------------------
net/ipv4/fib_frontend.c | 12 ++--
net/ipv4/fib_semantics.c | 2 +-
net/ipv4/fib_trie.c | 2 +-
net/ipv4/icmp.c | 12 +++--
net/ipv4/inet_connection_sock.c | 22 +++++----
net/ipv4/ip_output.c | 18 ++++---
net/ipv4/ipmr.c | 12 ++--
net/ipv4/netfilter.c | 6 +-
net/ipv4/raw.c | 10 ++--
net/ipv4/route.c | 72 ++++++++++++++--------------
net/ipv4/syncookies.c | 20 ++++----
net/ipv4/udp.c | 21 ++++----
net/ipv4/xfrm4_policy.c | 10 ++--
net/ipv4/xfrm4_state.c | 4 +-
net/ipv6/af_inet6.c | 6 +-
net/ipv6/datagram.c | 20 ++++----
net/ipv6/icmp.c | 24 +++++-----
net/ipv6/inet6_connection_sock.c | 12 ++--
net/ipv6/ip6_flowlabel.c | 2 +-
net/ipv6/ip6_output.c | 10 ++--
net/ipv6/ip6_tunnel.c | 8 ++--
net/ipv6/ip6mr.c | 22 ++++----
net/ipv6/ipv6_sockglue.c | 4 +-
net/ipv6/mip6.c | 6 +-
net/ipv6/netfilter.c | 4 +-
net/ipv6/netfilter/ip6t_REJECT.c | 2 +-
net/ipv6/raw.c | 20 ++++----
net/ipv6/route.c | 20 ++++----
net/ipv6/syncookies.c | 6 +-
net/ipv6/tcp_ipv6.c | 22 ++++----
net/ipv6/udp.c | 20 ++++----
net/ipv6/xfrm6_policy.c | 10 ++--
net/ipv6/xfrm6_state.c | 4 +-
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/ipvs/ip_vs_xmit.c | 2 +-
net/netfilter/xt_TEE.c | 4 +-
net/sctp/ipv6.c | 8 ++--
net/sctp/protocol.c | 4 +-
net/xfrm/xfrm_policy.c | 18 ++++----
net/xfrm/xfrm_state.c | 2 +-
security/security.c | 4 +-
security/selinux/hooks.c | 2 +-
security/selinux/xfrm.c | 4 +-
56 files changed, 365 insertions(+), 351 deletions(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 1742f72..3c2b309 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -239,7 +239,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
memset(&fl, 0, sizeof fl);
ipv6_addr_copy(&fl.fl6_dst, &dst_in->sin6_addr);
ipv6_addr_copy(&fl.fl6_src, &src_in->sin6_addr);
- fl.oif = addr->bound_dev_if;
+ fl.flowi_oif = addr->bound_dev_if;
dst = ip6_route_output(&init_net, NULL, &fl);
if ((ret = dst->error))
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 6583295..c8922f6 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -3429,7 +3429,7 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
memset(&fl, 0, sizeof(fl));
ipv6_addr_copy(&fl.fl6_dst, &dst_addr->sin6_addr);
if (ipv6_addr_type(&fl.fl6_dst) & IPV6_ADDR_LINKLOCAL)
- fl.oif = dst_addr->sin6_scope_id;
+ fl.flowi_oif = dst_addr->sin6_scope_id;
*dst = ip6_route_output(&init_net, NULL, &fl);
if (*dst)
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 9b185df..1f59005 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -82,12 +82,12 @@ struct dn_route {
static inline bool dn_is_input_route(struct dn_route *rt)
{
- return rt->fl.iif != 0;
+ return rt->fl.flowi_iif != 0;
}
static inline bool dn_is_output_route(struct dn_route *rt)
{
- return rt->fl.iif == 0;
+ return rt->fl.flowi_iif == 0;
}
extern void dn_route_init(void);
diff --git a/include/net/flow.h b/include/net/flow.h
index a661fd6..8c4dbd0 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -11,17 +11,17 @@
#include <asm/atomic.h>
struct flowi {
- int oif;
- int iif;
- __u32 mark;
- __u8 tos;
- __u8 scope;
- __u8 proto;
- __u8 flags;
+ int flowi_oif;
+ int flowi_iif;
+ __u32 flowi_mark;
+ __u8 flowi_tos;
+ __u8 flowi_scope;
+ __u8 flowi_proto;
+ __u8 flowi_flags;
#define FLOWI_FLAG_ANYSRC 0x01
#define FLOWI_FLAG_PRECOW_METRICS 0x02
#define FLOWI_FLAG_CAN_SLEEP 0x04
- __u32 secid;
+ __u32 flowi_secid;
union {
struct {
@@ -49,8 +49,8 @@ struct flowi {
#define fl6_flowlabel nl_u.ip6_u.flowlabel
#define fl4_dst nl_u.ip4_u.daddr
#define fl4_src nl_u.ip4_u.saddr
-#define fl4_tos tos
-#define fl4_scope scope
+#define fl4_tos flowi_tos
+#define fl4_scope flowi_scope
union {
struct {
@@ -116,7 +116,7 @@ extern atomic_t flow_cache_genid;
static inline int flow_cache_uli_match(const struct flowi *fl1,
const struct flowi *fl2)
{
- return (fl1->proto == fl2->proto &&
+ return (fl1->flowi_proto == fl2->flowi_proto &&
!memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u)));
}
diff --git a/include/net/route.h b/include/net/route.h
index f140f41..3d814f8 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -136,7 +136,7 @@ static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
__be32 saddr, u8 tos, int oif)
{
struct flowi fl = {
- .oif = oif,
+ .flowi_oif = oif,
.fl4_dst = daddr,
.fl4_src = saddr,
.fl4_tos = tos,
@@ -150,13 +150,13 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct sock
__u8 proto, __u8 tos, int oif)
{
struct flowi fl = {
- .oif = oif,
- .flags = sk ? inet_sk_flowi_flags(sk) : 0,
- .mark = sk ? sk->sk_mark : 0,
+ .flowi_oif = oif,
+ .flowi_flags = sk ? inet_sk_flowi_flags(sk) : 0,
+ .flowi_mark = sk ? sk->sk_mark : 0,
.fl4_dst = daddr,
.fl4_src = saddr,
.fl4_tos = tos,
- .proto = proto,
+ .flowi_proto = proto,
.fl_ip_dport = dport,
.fl_ip_sport = sport,
};
@@ -170,11 +170,11 @@ static inline struct rtable *ip_route_output_gre(struct net *net,
__be32 gre_key, __u8 tos, int oif)
{
struct flowi fl = {
- .oif = oif,
+ .flowi_oif = oif,
.fl4_dst = daddr,
.fl4_src = saddr,
.fl4_tos = tos,
- .proto = IPPROTO_GRE,
+ .flowi_proto = IPPROTO_GRE,
.fl_gre_key = gre_key,
};
return ip_route_output_key(net, &fl);
@@ -228,23 +228,23 @@ static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
__be16 sport, __be16 dport,
struct sock *sk, bool can_sleep)
{
- struct flowi fl = { .oif = oif,
- .mark = sk->sk_mark,
+ struct flowi fl = { .flowi_oif = oif,
+ .flowi_mark = sk->sk_mark,
.fl4_dst = dst,
.fl4_src = src,
.fl4_tos = tos,
- .proto = protocol,
+ .flowi_proto = protocol,
.fl_ip_sport = sport,
.fl_ip_dport = dport };
struct net *net = sock_net(sk);
struct rtable *rt;
if (inet_sk(sk)->transparent)
- fl.flags |= FLOWI_FLAG_ANYSRC;
+ fl.flowi_flags |= FLOWI_FLAG_ANYSRC;
if (protocol == IPPROTO_TCP)
- fl.flags |= FLOWI_FLAG_PRECOW_METRICS;
+ fl.flowi_flags |= FLOWI_FLAG_PRECOW_METRICS;
if (can_sleep)
- fl.flags |= FLOWI_FLAG_CAN_SLEEP;
+ fl.flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
if (!dst || !src) {
rt = __ip_route_output_key(net, &fl);
@@ -264,19 +264,19 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
__be16 dport, struct sock *sk)
{
if (sport != orig_sport || dport != orig_dport) {
- struct flowi fl = { .oif = rt->rt_oif,
- .mark = rt->rt_mark,
+ struct flowi fl = { .flowi_oif = rt->rt_oif,
+ .flowi_mark = rt->rt_mark,
.fl4_dst = rt->rt_key_dst,
.fl4_src = rt->rt_key_src,
.fl4_tos = rt->rt_tos,
- .proto = protocol,
+ .flowi_proto = protocol,
.fl_ip_sport = sport,
.fl_ip_dport = dport };
if (inet_sk(sk)->transparent)
- fl.flags |= FLOWI_FLAG_ANYSRC;
+ fl.flowi_flags |= FLOWI_FLAG_ANYSRC;
if (protocol == IPPROTO_TCP)
- fl.flags |= FLOWI_FLAG_PRECOW_METRICS;
+ fl.flowi_flags |= FLOWI_FLAG_PRECOW_METRICS;
ip_rt_put(rt);
security_sk_classify_flow(sk, &fl);
return ip_route_output_flow(sock_net(sk), &fl, sk);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d5dcf39..d5a12d1 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -803,7 +803,7 @@ static __inline__
__be16 xfrm_flowi_sport(const struct flowi *fl)
{
__be16 port;
- switch(fl->proto) {
+ switch(fl->flowi_proto) {
case IPPROTO_TCP:
case IPPROTO_UDP:
case IPPROTO_UDPLITE:
@@ -830,7 +830,7 @@ static __inline__
__be16 xfrm_flowi_dport(const struct flowi *fl)
{
__be16 port;
- switch(fl->proto) {
+ switch(fl->flowi_proto) {
case IPPROTO_TCP:
case IPPROTO_UDP:
case IPPROTO_UDPLITE:
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index a20e5d3..8248ebb 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -181,13 +181,13 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
{
int ret = 0;
- if (rule->iifindex && (rule->iifindex != fl->iif))
+ if (rule->iifindex && (rule->iifindex != fl->flowi_iif))
goto out;
- if (rule->oifindex && (rule->oifindex != fl->oif))
+ if (rule->oifindex && (rule->oifindex != fl->flowi_oif))
goto out;
- if ((rule->mark ^ fl->mark) & rule->mark_mask)
+ if ((rule->mark ^ fl->flowi_mark) & rule->mark_mask)
goto out;
ret = ops->match(rule, fl, flags);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 7882377..09a0991 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -465,14 +465,15 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
struct sk_buff *skb)
{
struct rtable *rt;
- struct flowi fl = { .oif = skb_rtable(skb)->rt_iif,
- .fl4_dst = ip_hdr(skb)->saddr,
- .fl4_src = ip_hdr(skb)->daddr,
- .fl4_tos = RT_CONN_FLAGS(sk),
- .proto = sk->sk_protocol,
- .fl_ip_sport = dccp_hdr(skb)->dccph_dport,
- .fl_ip_dport = dccp_hdr(skb)->dccph_sport
- };
+ struct flowi fl = {
+ .flowi_oif = skb_rtable(skb)->rt_iif,
+ .fl4_dst = ip_hdr(skb)->saddr,
+ .fl4_src = ip_hdr(skb)->daddr,
+ .fl4_tos = RT_CONN_FLAGS(sk),
+ .flowi_proto = sk->sk_protocol,
+ .fl_ip_sport = dccp_hdr(skb)->dccph_dport,
+ .fl_ip_dport = dccp_hdr(skb)->dccph_sport,
+ };
security_skb_classify_flow(skb, &fl);
rt = ip_route_output_flow(net, &fl, sk);
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 5efc57f..5209ee7 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -154,10 +154,10 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
for now.
*/
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_DCCP;
+ fl.flowi_proto = IPPROTO_DCCP;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
- fl.oif = sk->sk_bound_dev_if;
+ fl.flowi_oif = sk->sk_bound_dev_if;
fl.fl_ip_dport = inet->inet_dport;
fl.fl_ip_sport = inet->inet_sport;
security_sk_classify_flow(sk, &fl);
@@ -248,11 +248,11 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
struct dst_entry *dst;
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_DCCP;
+ fl.flowi_proto = IPPROTO_DCCP;
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
fl.fl6_flowlabel = 0;
- fl.oif = ireq6->iif;
+ fl.flowi_oif = ireq6->iif;
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_rsk(req)->loc_port;
security_req_classify_flow(req, &fl);
@@ -321,8 +321,8 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
- fl.proto = IPPROTO_DCCP;
- fl.oif = inet6_iif(rxskb);
+ fl.flowi_proto = IPPROTO_DCCP;
+ fl.flowi_oif = inet6_iif(rxskb);
fl.fl_ip_dport = dccp_hdr(skb)->dccph_dport;
fl.fl_ip_sport = dccp_hdr(skb)->dccph_sport;
security_skb_classify_flow(rxskb, &fl);
@@ -530,11 +530,11 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
struct flowi fl;
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_DCCP;
+ fl.flowi_proto = IPPROTO_DCCP;
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
final_p = fl6_update_dst(&fl, opt, &final);
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
- fl.oif = sk->sk_bound_dev_if;
+ fl.flowi_oif = sk->sk_bound_dev_if;
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_rsk(req)->loc_port;
security_sk_classify_flow(sk, &fl);
@@ -953,10 +953,10 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
if (!ipv6_addr_any(&np->rcv_saddr))
saddr = &np->rcv_saddr;
- fl.proto = IPPROTO_DCCP;
+ fl.flowi_proto = IPPROTO_DCCP;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr);
- fl.oif = sk->sk_bound_dev_if;
+ fl.flowi_oif = sk->sk_bound_dev_if;
fl.fl_ip_dport = usin->sin6_port;
fl.fl_ip_sport = inet->inet_sport;
security_sk_classify_flow(sk, &fl);
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 2af15b1..aafd15a 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -948,11 +948,11 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
err = -EHOSTUNREACH;
memset(&fl, 0, sizeof(fl));
- fl.oif = sk->sk_bound_dev_if;
+ fl.flowi_oif = sk->sk_bound_dev_if;
fl.fld_dst = dn_saddr2dn(&scp->peer);
fl.fld_src = dn_saddr2dn(&scp->addr);
dn_sk_ports_copy(&fl, scp);
- fl.proto = DNPROTO_NSP;
+ fl.flowi_proto = DNPROTO_NSP;
if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, flags) < 0)
goto out;
sk->sk_route_caps = sk->sk_dst_cache->dev->features;
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 0ef0a81..4dfffa0 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -223,7 +223,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
memset(&fl, 0, sizeof(fl));
fl.fld_dst = nh->nh_gw;
- fl.oif = nh->nh_oif;
+ fl.flowi_oif = nh->nh_oif;
fl.fld_scope = r->rtm_scope + 1;
if (fl.fld_scope < RT_SCOPE_LINK)
@@ -424,7 +424,7 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi *
for_nexthops(fi) {
if (nh->nh_flags & RTNH_F_DEAD)
continue;
- if (!fl->oif || fl->oif == nh->nh_oif)
+ if (!fl->flowi_oif || fl->flowi_oif == nh->nh_oif)
break;
}
if (nhsel < fi->fib_nhs) {
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index 2ef1152..b3d6674 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -92,11 +92,11 @@ try_again:
}
memset(&fl, 0, sizeof(fl));
- fl.oif = sk->sk_bound_dev_if;
+ fl.flowi_oif = sk->sk_bound_dev_if;
fl.fld_src = dn_saddr2dn(&scp->addr);
fl.fld_dst = dn_saddr2dn(&scp->peer);
dn_sk_ports_copy(&fl, scp);
- fl.proto = DNPROTO_NSP;
+ fl.flowi_proto = DNPROTO_NSP;
if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, 0) == 0) {
dst = sk_dst_get(sk);
sk->sk_route_caps = dst->dev->features;
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 484fdbf..d74d34b 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -286,10 +286,10 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
{
return ((fl1->fld_dst ^ fl2->fld_dst) |
(fl1->fld_src ^ fl2->fld_src) |
- (fl1->mark ^ fl2->mark) |
+ (fl1->flowi_mark ^ fl2->flowi_mark) |
(fl1->fld_scope ^ fl2->fld_scope) |
- (fl1->oif ^ fl2->oif) |
- (fl1->iif ^ fl2->iif)) == 0;
+ (fl1->flowi_oif ^ fl2->flowi_oif) |
+ (fl1->flowi_iif ^ fl2->flowi_iif)) == 0;
}
static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route **rp)
@@ -905,12 +905,14 @@ static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_re
static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard)
{
- struct flowi fl = { .fld_dst = oldflp->fld_dst,
- .fld_src = oldflp->fld_src,
- .fld_scope = RT_SCOPE_UNIVERSE,
- .mark = oldflp->mark,
- .iif = init_net.loopback_dev->ifindex,
- .oif = oldflp->oif };
+ struct flowi fl = {
+ .fld_dst = oldflp->fld_dst,
+ .fld_src = oldflp->fld_src,
+ .fld_scope = RT_SCOPE_UNIVERSE,
+ .flowi_mark = oldflp->flowi_mark,
+ .flowi_iif = init_net.loopback_dev->ifindex,
+ .flowi_oif = oldflp->flowi_oif,
+ };
struct dn_route *rt = NULL;
struct net_device *dev_out = NULL, *dev;
struct neighbour *neigh = NULL;
@@ -926,11 +928,11 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
"dn_route_output_slow: dst=%04x src=%04x mark=%d"
" iif=%d oif=%d\n", le16_to_cpu(oldflp->fld_dst),
le16_to_cpu(oldflp->fld_src),
- oldflp->mark, init_net.loopback_dev->ifindex, oldflp->oif);
+ oldflp->flowi_mark, init_net.loopback_dev->ifindex, oldflp->flowi_oif);
/* If we have an output interface, verify its a DECnet device */
- if (oldflp->oif) {
- dev_out = dev_get_by_index(&init_net, oldflp->oif);
+ if (oldflp->flowi_oif) {
+ dev_out = dev_get_by_index(&init_net, oldflp->flowi_oif);
err = -ENODEV;
if (dev_out && dev_out->dn_ptr == NULL) {
dev_put(dev_out);
@@ -988,7 +990,7 @@ source_ok:
if (!fl.fld_dst)
goto out;
}
- fl.oif = init_net.loopback_dev->ifindex;
+ fl.flowi_oif = init_net.loopback_dev->ifindex;
res.type = RTN_LOCAL;
goto make_route;
}
@@ -998,7 +1000,7 @@ source_ok:
"dn_route_output_slow: initial checks complete."
" dst=%o4x src=%04x oif=%d try_hard=%d\n",
le16_to_cpu(fl.fld_dst), le16_to_cpu(fl.fld_src),
- fl.oif, try_hard);
+ fl.flowi_oif, try_hard);
/*
* N.B. If the kernel is compiled without router support then
@@ -1023,8 +1025,8 @@ source_ok:
if (!try_hard) {
neigh = neigh_lookup_nodev(&dn_neigh_table, &init_net, &fl.fld_dst);
if (neigh) {
- if ((oldflp->oif &&
- (neigh->dev->ifindex != oldflp->oif)) ||
+ if ((oldflp->flowi_oif &&
+ (neigh->dev->ifindex != oldflp->flowi_oif)) ||
(oldflp->fld_src &&
(!dn_dev_islocal(neigh->dev,
oldflp->fld_src)))) {
@@ -1078,7 +1080,7 @@ select_source:
if (fl.fld_src == 0 && res.type != RTN_LOCAL)
goto e_addr;
}
- fl.oif = dev_out->ifindex;
+ fl.flowi_oif = dev_out->ifindex;
goto make_route;
}
free_res = 1;
@@ -1093,14 +1095,14 @@ select_source:
dev_put(dev_out);
dev_out = init_net.loopback_dev;
dev_hold(dev_out);
- fl.oif = dev_out->ifindex;
+ fl.flowi_oif = dev_out->ifindex;
if (res.fi)
dn_fib_info_put(res.fi);
res.fi = NULL;
goto make_route;
}
- if (res.fi->fib_nhs > 1 && fl.oif == 0)
+ if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0)
dn_fib_select_multipath(&fl, &res);
/*
@@ -1115,7 +1117,7 @@ select_source:
dev_put(dev_out);
dev_out = DN_FIB_RES_DEV(res);
dev_hold(dev_out);
- fl.oif = dev_out->ifindex;
+ fl.flowi_oif = dev_out->ifindex;
gateway = DN_FIB_RES_GW(res);
make_route:
@@ -1131,9 +1133,9 @@ make_route:
rt->fl.fld_src = oldflp->fld_src;
rt->fl.fld_dst = oldflp->fld_dst;
- rt->fl.oif = oldflp->oif;
- rt->fl.iif = 0;
- rt->fl.mark = oldflp->mark;
+ rt->fl.flowi_oif = oldflp->flowi_oif;
+ rt->fl.flowi_iif = 0;
+ rt->fl.flowi_mark = oldflp->flowi_mark;
rt->rt_saddr = fl.fld_src;
rt->rt_daddr = fl.fld_dst;
@@ -1201,9 +1203,9 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
rt = rcu_dereference_bh(rt->dst.dn_next)) {
if ((flp->fld_dst == rt->fl.fld_dst) &&
(flp->fld_src == rt->fl.fld_src) &&
- (flp->mark == rt->fl.mark) &&
+ (flp->flowi_mark == rt->fl.flowi_mark) &&
dn_is_output_route(rt) &&
- (rt->fl.oif == flp->oif)) {
+ (rt->fl.flowi_oif == flp->flowi_oif)) {
dst_use(&rt->dst, jiffies);
rcu_read_unlock_bh();
*pprt = &rt->dst;
@@ -1221,7 +1223,7 @@ static int dn_route_output_key(struct dst_entry **pprt, struct flowi *flp, int f
int err;
err = __dn_route_output_key(pprt, flp, flags);
- if (err == 0 && flp->proto) {
+ if (err == 0 && flp->flowi_proto) {
*pprt = xfrm_lookup(&init_net, *pprt, flp, NULL, 0);
if (IS_ERR(*pprt)) {
err = PTR_ERR(*pprt);
@@ -1236,9 +1238,9 @@ int dn_route_output_sock(struct dst_entry **pprt, struct flowi *fl, struct sock
int err;
err = __dn_route_output_key(pprt, fl, flags & MSG_TRYHARD);
- if (err == 0 && fl->proto) {
+ if (err == 0 && fl->flowi_proto) {
if (!(flags & MSG_DONTWAIT))
- fl->flags |= FLOWI_FLAG_CAN_SLEEP;
+ fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
*pprt = xfrm_lookup(&init_net, *pprt, fl, sk, 0);
if (IS_ERR(*pprt)) {
err = PTR_ERR(*pprt);
@@ -1260,11 +1262,13 @@ static int dn_route_input_slow(struct sk_buff *skb)
int flags = 0;
__le16 gateway = 0;
__le16 local_src = 0;
- struct flowi fl = { .fld_dst = cb->dst,
- .fld_src = cb->src,
- .fld_scope = RT_SCOPE_UNIVERSE,
- .mark = skb->mark,
- .iif = skb->dev->ifindex };
+ struct flowi fl = {
+ .fld_dst = cb->dst,
+ .fld_src = cb->src,
+ .fld_scope = RT_SCOPE_UNIVERSE,
+ .flowi_mark = skb->mark,
+ .flowi_iif = skb->dev->ifindex,
+ };
struct dn_fib_res res = { .fi = NULL, .type = RTN_UNREACHABLE };
int err = -EINVAL;
int free_res = 0;
@@ -1343,7 +1347,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
if (dn_db->parms.forwarding == 0)
goto e_inval;
- if (res.fi->fib_nhs > 1 && fl.oif == 0)
+ if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0)
dn_fib_select_multipath(&fl, &res);
/*
@@ -1408,9 +1412,9 @@ make_route:
rt->fl.fld_src = cb->src;
rt->fl.fld_dst = cb->dst;
- rt->fl.oif = 0;
- rt->fl.iif = in_dev->ifindex;
- rt->fl.mark = fl.mark;
+ rt->fl.flowi_oif = 0;
+ rt->fl.flowi_iif = in_dev->ifindex;
+ rt->fl.flowi_mark = fl.flowi_mark;
rt->dst.flags = DST_HOST;
rt->dst.neighbour = neigh;
@@ -1482,9 +1486,9 @@ static int dn_route_input(struct sk_buff *skb)
rt = rcu_dereference(rt->dst.dn_next)) {
if ((rt->fl.fld_src == cb->src) &&
(rt->fl.fld_dst == cb->dst) &&
- (rt->fl.oif == 0) &&
- (rt->fl.mark == skb->mark) &&
- (rt->fl.iif == cb->iif)) {
+ (rt->fl.flowi_oif == 0) &&
+ (rt->fl.flowi_mark == skb->mark) &&
+ (rt->fl.flowi_iif == cb->iif)) {
dst_use(&rt->dst, jiffies);
rcu_read_unlock();
skb_dst_set(skb, (struct dst_entry *)rt);
@@ -1541,7 +1545,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
rt->dst.error) < 0)
goto rtattr_failure;
if (dn_is_input_route(rt))
- RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif);
+ RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.flowi_iif);
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
return skb->len;
@@ -1570,7 +1574,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
return -EINVAL;
memset(&fl, 0, sizeof(fl));
- fl.proto = DNPROTO_NSP;
+ fl.flowi_proto = DNPROTO_NSP;
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (skb == NULL)
@@ -1583,11 +1587,11 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
if (rta[RTA_DST-1])
memcpy(&fl.fld_dst, RTA_DATA(rta[RTA_DST-1]), 2);
if (rta[RTA_IIF-1])
- memcpy(&fl.iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int));
+ memcpy(&fl.flowi_iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int));
- if (fl.iif) {
+ if (fl.flowi_iif) {
struct net_device *dev;
- if ((dev = dev_get_by_index(&init_net, fl.iif)) == NULL) {
+ if ((dev = dev_get_by_index(&init_net, fl.flowi_iif)) == NULL) {
kfree_skb(skb);
return -ENODEV;
}
@@ -1611,7 +1615,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
int oif = 0;
if (rta[RTA_OIF - 1])
memcpy(&oif, RTA_DATA(rta[RTA_OIF - 1]), sizeof(int));
- fl.oif = oif;
+ fl.flowi_oif = oif;
err = dn_route_output_key((struct dst_entry **)&rt, &fl, 0);
}
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index fe10bcd..7610528 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -200,9 +200,9 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
int ret;
struct net *net;
- fl.oif = 0;
- fl.iif = oif;
- fl.mark = mark;
+ fl.flowi_oif = 0;
+ fl.flowi_iif = oif;
+ fl.flowi_mark = mark;
fl.fl4_dst = src;
fl.fl4_src = dst;
fl.fl4_tos = tos;
@@ -215,7 +215,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
rpf = IN_DEV_RPFILTER(in_dev);
accept_local = IN_DEV_ACCEPT_LOCAL(in_dev);
if (mark && !IN_DEV_SRC_VMARK(in_dev))
- fl.mark = 0;
+ fl.flowi_mark = 0;
}
if (in_dev == NULL)
@@ -253,7 +253,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
goto last_resort;
if (rpf == 1)
goto e_rpf;
- fl.oif = dev->ifindex;
+ fl.flowi_oif = dev->ifindex;
ret = 0;
if (fib_lookup(net, &fl, &res) == 0) {
@@ -797,7 +797,7 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb)
struct fib_result res;
struct flowi fl = {
- .mark = frn->fl_mark,
+ .flowi_mark = frn->fl_mark,
.fl4_dst = frn->fl_addr,
.fl4_tos = frn->fl_tos,
.fl4_scope = frn->fl_scope,
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index b5d523b..79179ad 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -563,7 +563,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
struct flowi fl = {
.fl4_dst = nh->nh_gw,
.fl4_scope = cfg->fc_scope + 1,
- .oif = nh->nh_oif,
+ .flowi_oif = nh->nh_oif,
};
/* It is not necessary, but requires a bit of thinking */
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index a4109a5..d5ff80e 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1379,7 +1379,7 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
if (nh->nh_flags & RTNH_F_DEAD)
continue;
- if (flp->oif && flp->oif != nh->nh_oif)
+ if (flp->flowi_oif && flp->flowi_oif != nh->nh_oif)
continue;
#ifdef CONFIG_IP_FIB_TRIE_STATS
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 1771ce6..3fde7f2 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -353,10 +353,12 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
daddr = icmp_param->replyopts.faddr;
}
{
- struct flowi fl = { .fl4_dst= daddr,
- .fl4_src = rt->rt_spec_dst,
- .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
- .proto = IPPROTO_ICMP };
+ struct flowi fl = {
+ .fl4_dst = daddr,
+ .fl4_src = rt->rt_spec_dst,
+ .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
+ .flowi_proto = IPPROTO_ICMP,
+ };
security_skb_classify_flow(skb, &fl);
rt = ip_route_output_key(net, &fl);
if (IS_ERR(rt))
@@ -381,7 +383,7 @@ static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in,
param->replyopts.faddr : iph->saddr),
.fl4_src = saddr,
.fl4_tos = RT_TOS(tos),
- .proto = IPPROTO_ICMP,
+ .flowi_proto = IPPROTO_ICMP,
.fl_icmp_type = type,
.fl_icmp_code = code,
};
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index e4e301a..9708170 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -356,16 +356,18 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
struct rtable *rt;
const struct inet_request_sock *ireq = inet_rsk(req);
struct ip_options *opt = inet_rsk(req)->opt;
- struct flowi fl = { .oif = sk->sk_bound_dev_if,
- .mark = sk->sk_mark,
- .fl4_dst = ((opt && opt->srr) ?
- opt->faddr : ireq->rmt_addr),
- .fl4_src = ireq->loc_addr,
- .fl4_tos = RT_CONN_FLAGS(sk),
- .proto = sk->sk_protocol,
- .flags = inet_sk_flowi_flags(sk),
- .fl_ip_sport = inet_sk(sk)->inet_sport,
- .fl_ip_dport = ireq->rmt_port };
+ struct flowi fl = {
+ .flowi_oif = sk->sk_bound_dev_if,
+ .flowi_mark = sk->sk_mark,
+ .fl4_dst = ((opt && opt->srr) ?
+ opt->faddr : ireq->rmt_addr),
+ .fl4_src = ireq->loc_addr,
+ .fl4_tos = RT_CONN_FLAGS(sk),
+ .flowi_proto = sk->sk_protocol,
+ .flowi_flags = inet_sk_flowi_flags(sk),
+ .fl_ip_sport = inet_sk(sk)->inet_sport,
+ .fl_ip_dport = ireq->rmt_port,
+ };
struct net *net = sock_net(sk);
security_req_classify_flow(req, &fl);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 916152d..e35ca40 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1474,14 +1474,16 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
}
{
- struct flowi fl = { .oif = arg->bound_dev_if,
- .fl4_dst = daddr,
- .fl4_src = rt->rt_spec_dst,
- .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
- .fl_ip_sport = tcp_hdr(skb)->dest,
- .fl_ip_dport = tcp_hdr(skb)->source,
- .proto = sk->sk_protocol,
- .flags = ip_reply_arg_flowi_flags(arg) };
+ struct flowi fl = {
+ .flowi_oif = arg->bound_dev_if,
+ .fl4_dst = daddr,
+ .fl4_src = rt->rt_spec_dst,
+ .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
+ .fl_ip_sport = tcp_hdr(skb)->dest,
+ .fl_ip_dport = tcp_hdr(skb)->source,
+ .flowi_proto = sk->sk_protocol,
+ .flowi_flags = ip_reply_arg_flowi_flags(arg),
+ };
security_skb_classify_flow(skb, &fl);
rt = ip_route_output_key(sock_net(sk), &fl);
if (IS_ERR(rt))
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 594a300..3b72b0a 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -436,9 +436,9 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
struct net *net = dev_net(dev);
struct mr_table *mrt;
struct flowi fl = {
- .oif = dev->ifindex,
- .iif = skb->skb_iif,
- .mark = skb->mark,
+ .flowi_oif = dev->ifindex,
+ .flowi_iif = skb->skb_iif,
+ .flowi_mark = skb->mark,
};
int err;
@@ -1793,9 +1793,9 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct rtable *rt)
.fl4_dst = rt->rt_key_dst,
.fl4_src = rt->rt_key_src,
.fl4_tos = rt->rt_tos,
- .oif = rt->rt_oif,
- .iif = rt->rt_iif,
- .mark = rt->rt_mark,
+ .flowi_oif = rt->rt_oif,
+ .flowi_iif = rt->rt_iif,
+ .flowi_mark = rt->rt_mark,
};
struct mr_table *mrt;
int err;
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 67bf709..6f40ba5 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -35,9 +35,9 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
if (type == RTN_LOCAL)
fl.fl4_src = iph->saddr;
fl.fl4_tos = RT_TOS(iph->tos);
- fl.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
- fl.mark = skb->mark;
- fl.flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;
+ fl.flowi_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
+ fl.flowi_mark = skb->mark;
+ fl.flowi_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;
rt = ip_route_output_key(net, &fl);
if (IS_ERR(rt))
return -1;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 467d570..b42b7cd 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -418,7 +418,7 @@ static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
if (!iov)
continue;
- switch (fl->proto) {
+ switch (fl->flowi_proto) {
case IPPROTO_ICMP:
/* check if one-byte field is readable or not. */
if (iov->iov_base && iov->iov_len < 1)
@@ -548,14 +548,14 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
}
{
- struct flowi fl = { .oif = ipc.oif,
- .mark = sk->sk_mark,
+ struct flowi fl = { .flowi_oif = ipc.oif,
+ .flowi_mark = sk->sk_mark,
.fl4_dst = daddr,
.fl4_src = saddr,
.fl4_tos = tos,
- .proto = inet->hdrincl ? IPPROTO_RAW :
+ .flowi_proto = inet->hdrincl ? IPPROTO_RAW :
sk->sk_protocol,
- .flags = FLOWI_FLAG_CAN_SLEEP,
+ .flowi_flags = FLOWI_FLAG_CAN_SLEEP,
};
if (!inet->hdrincl) {
err = raw_probe_proto_opt(&fl, msg);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 9c17e32..c9aa4f9 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1701,9 +1701,9 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt)
.fl4_dst = rt->rt_key_dst,
.fl4_src = rt->rt_key_src,
.fl4_tos = rt->rt_tos,
- .oif = rt->rt_oif,
- .iif = rt->rt_iif,
- .mark = rt->rt_mark,
+ .flowi_oif = rt->rt_oif,
+ .flowi_iif = rt->rt_iif,
+ .flowi_mark = rt->rt_mark,
};
rcu_read_lock();
@@ -1766,7 +1766,7 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi *oldflp,
/* If a peer entry exists for this destination, we must hook
* it up in order to get at cached metrics.
*/
- if (oldflp && (oldflp->flags & FLOWI_FLAG_PRECOW_METRICS))
+ if (oldflp && (oldflp->flowi_flags & FLOWI_FLAG_PRECOW_METRICS))
create = 1;
rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
@@ -2057,9 +2057,9 @@ static int ip_mkroute_input(struct sk_buff *skb,
return err;
/* put it into the cache */
- hash = rt_hash(daddr, saddr, fl->iif,
+ hash = rt_hash(daddr, saddr, fl->flowi_iif,
rt_genid(dev_net(rth->dst.dev)));
- rth = rt_intern_hash(hash, rth, skb, fl->iif);
+ rth = rt_intern_hash(hash, rth, skb, fl->flowi_iif);
if (IS_ERR(rth))
return PTR_ERR(rth);
return 0;
@@ -2118,9 +2118,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
/*
* Now we are ready to route packet.
*/
- fl.oif = 0;
- fl.iif = dev->ifindex;
- fl.mark = skb->mark;
+ fl.flowi_oif = 0;
+ fl.flowi_iif = dev->ifindex;
+ fl.flowi_mark = skb->mark;
fl.fl4_dst = daddr;
fl.fl4_src = saddr;
fl.fl4_tos = tos;
@@ -2205,8 +2205,8 @@ local_input:
rth->rt_flags &= ~RTCF_LOCAL;
}
rth->rt_type = res.type;
- hash = rt_hash(daddr, saddr, fl.iif, rt_genid(net));
- rth = rt_intern_hash(hash, rth, skb, fl.iif);
+ hash = rt_hash(daddr, saddr, fl.flowi_iif, rt_genid(net));
+ rth = rt_intern_hash(hash, rth, skb, fl.flowi_iif);
err = 0;
if (IS_ERR(rth))
err = PTR_ERR(rth);
@@ -2369,7 +2369,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
} else if (type == RTN_MULTICAST) {
flags |= RTCF_MULTICAST | RTCF_LOCAL;
if (!ip_check_mc_rcu(in_dev, oldflp->fl4_dst, oldflp->fl4_src,
- oldflp->proto))
+ oldflp->flowi_proto))
flags &= ~RTCF_LOCAL;
/* If multicast route do not exist use
* default one, but do not gateway in this case.
@@ -2387,8 +2387,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_key_dst = oldflp->fl4_dst;
rth->rt_tos = tos;
rth->rt_key_src = oldflp->fl4_src;
- rth->rt_oif = oldflp->oif;
- rth->rt_mark = oldflp->mark;
+ rth->rt_oif = oldflp->flowi_oif;
+ rth->rt_mark = oldflp->flowi_mark;
rth->rt_dst = fl->fl4_dst;
rth->rt_src = fl->fl4_src;
rth->rt_iif = 0;
@@ -2452,9 +2452,9 @@ static struct rtable *ip_route_output_slow(struct net *net,
res.r = NULL;
#endif
- fl.oif = oldflp->oif;
- fl.iif = net->loopback_dev->ifindex;
- fl.mark = oldflp->mark;
+ fl.flowi_oif = oldflp->flowi_oif;
+ fl.flowi_iif = net->loopback_dev->ifindex;
+ fl.flowi_mark = oldflp->flowi_mark;
fl.fl4_dst = oldflp->fl4_dst;
fl.fl4_src = oldflp->fl4_src;
fl.fl4_tos = tos & IPTOS_RT_MASK;
@@ -2477,7 +2477,7 @@ static struct rtable *ip_route_output_slow(struct net *net,
of another iface. --ANK
*/
- if (oldflp->oif == 0 &&
+ if (oldflp->flowi_oif == 0 &&
(ipv4_is_multicast(oldflp->fl4_dst) ||
ipv4_is_lbcast(oldflp->fl4_dst))) {
/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
@@ -2500,11 +2500,11 @@ static struct rtable *ip_route_output_slow(struct net *net,
Luckily, this hack is good workaround.
*/
- fl.oif = dev_out->ifindex;
+ fl.flowi_oif = dev_out->ifindex;
goto make_route;
}
- if (!(oldflp->flags & FLOWI_FLAG_ANYSRC)) {
+ if (!(oldflp->flowi_flags & FLOWI_FLAG_ANYSRC)) {
/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
if (!__ip_dev_find(net, oldflp->fl4_src, false))
goto out;
@@ -2512,8 +2512,8 @@ static struct rtable *ip_route_output_slow(struct net *net,
}
- if (oldflp->oif) {
- dev_out = dev_get_by_index_rcu(net, oldflp->oif);
+ if (oldflp->flowi_oif) {
+ dev_out = dev_get_by_index_rcu(net, oldflp->flowi_oif);
rth = ERR_PTR(-ENODEV);
if (dev_out == NULL)
goto out;
@@ -2545,7 +2545,7 @@ static struct rtable *ip_route_output_slow(struct net *net,
if (!fl.fl4_dst)
fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK);
dev_out = net->loopback_dev;
- fl.oif = net->loopback_dev->ifindex;
+ fl.flowi_oif = net->loopback_dev->ifindex;
res.type = RTN_LOCAL;
flags |= RTCF_LOCAL;
goto make_route;
@@ -2553,7 +2553,7 @@ static struct rtable *ip_route_output_slow(struct net *net,
if (fib_lookup(net, &fl, &res)) {
res.fi = NULL;
- if (oldflp->oif) {
+ if (oldflp->flowi_oif) {
/* Apparently, routing tables are wrong. Assume,
that the destination is on link.
@@ -2590,25 +2590,25 @@ static struct rtable *ip_route_output_slow(struct net *net,
fl.fl4_src = fl.fl4_dst;
}
dev_out = net->loopback_dev;
- fl.oif = dev_out->ifindex;
+ fl.flowi_oif = dev_out->ifindex;
res.fi = NULL;
flags |= RTCF_LOCAL;
goto make_route;
}
#ifdef CONFIG_IP_ROUTE_MULTIPATH
- if (res.fi->fib_nhs > 1 && fl.oif == 0)
+ if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0)
fib_select_multipath(&res);
else
#endif
- if (!res.prefixlen && res.type == RTN_UNICAST && !fl.oif)
+ if (!res.prefixlen && res.type == RTN_UNICAST && !fl.flowi_oif)
fib_select_default(&res);
if (!fl.fl4_src)
fl.fl4_src = FIB_RES_PREFSRC(res);
dev_out = FIB_RES_DEV(res);
- fl.oif = dev_out->ifindex;
+ fl.flowi_oif = dev_out->ifindex;
make_route:
@@ -2616,9 +2616,9 @@ make_route:
if (!IS_ERR(rth)) {
unsigned int hash;
- hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif,
+ hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->flowi_oif,
rt_genid(dev_net(dev_out)));
- rth = rt_intern_hash(hash, rth, NULL, oldflp->oif);
+ rth = rt_intern_hash(hash, rth, NULL, oldflp->flowi_oif);
}
out:
@@ -2634,7 +2634,7 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *flp)
if (!rt_caching(net))
goto slow_output;
- hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net));
+ hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->flowi_oif, rt_genid(net));
rcu_read_lock_bh();
for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth;
@@ -2642,8 +2642,8 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *flp)
if (rth->rt_key_dst == flp->fl4_dst &&
rth->rt_key_src == flp->fl4_src &&
rt_is_output_route(rth) &&
- rth->rt_oif == flp->oif &&
- rth->rt_mark == flp->mark &&
+ rth->rt_oif == flp->flowi_oif &&
+ rth->rt_mark == flp->flowi_mark &&
!((rth->rt_tos ^ flp->fl4_tos) &
(IPTOS_RT_MASK | RTO_ONLINK)) &&
net_eq(dev_net(rth->dst.dev), net) &&
@@ -2741,7 +2741,7 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi *flp,
if (IS_ERR(rt))
return rt;
- if (flp->proto) {
+ if (flp->flowi_proto) {
if (!flp->fl4_src)
flp->fl4_src = rt->rt_src;
if (!flp->fl4_dst)
@@ -2917,8 +2917,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
.fl4_dst = dst,
.fl4_src = src,
.fl4_tos = rtm->rtm_tos,
- .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0,
- .mark = mark,
+ .flowi_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0,
+ .flowi_mark = mark,
};
rt = ip_route_output_key(net, &fl);
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 0ad6ddf..98d47dc 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -345,15 +345,17 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
* no easy way to do this.
*/
{
- struct flowi fl = { .mark = sk->sk_mark,
- .fl4_dst = ((opt && opt->srr) ?
- opt->faddr : ireq->rmt_addr),
- .fl4_src = ireq->loc_addr,
- .fl4_tos = RT_CONN_FLAGS(sk),
- .proto = IPPROTO_TCP,
- .flags = inet_sk_flowi_flags(sk),
- .fl_ip_sport = th->dest,
- .fl_ip_dport = th->source };
+ struct flowi fl = {
+ .flowi_mark = sk->sk_mark,
+ .fl4_dst = ((opt && opt->srr) ?
+ opt->faddr : ireq->rmt_addr),
+ .fl4_src = ireq->loc_addr,
+ .fl4_tos = RT_CONN_FLAGS(sk),
+ .flowi_proto = IPPROTO_TCP,
+ .flowi_flags = inet_sk_flowi_flags(sk),
+ .fl_ip_sport = th->dest,
+ .fl_ip_dport = th->source,
+ };
security_req_classify_flow(req, &fl);
rt = ip_route_output_key(sock_net(sk), &fl);
if (IS_ERR(rt)) {
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c9a73e5..e10f62e 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -908,16 +908,17 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
rt = (struct rtable *)sk_dst_check(sk, 0);
if (rt == NULL) {
- struct flowi fl = { .oif = ipc.oif,
- .mark = sk->sk_mark,
- .fl4_dst = faddr,
- .fl4_src = saddr,
- .fl4_tos = tos,
- .proto = sk->sk_protocol,
- .flags = (inet_sk_flowi_flags(sk) |
- FLOWI_FLAG_CAN_SLEEP),
- .fl_ip_sport = inet->inet_sport,
- .fl_ip_dport = dport
+ struct flowi fl = {
+ .flowi_oif = ipc.oif,
+ .flowi_mark = sk->sk_mark,
+ .fl4_dst = faddr,
+ .fl4_src = saddr,
+ .fl4_tos = tos,
+ .flowi_proto = sk->sk_protocol,
+ .flowi_flags = (inet_sk_flowi_flags(sk) |
+ FLOWI_FLAG_CAN_SLEEP),
+ .fl_ip_sport = inet->inet_sport,
+ .fl_ip_dport = dport,
};
struct net *net = sock_net(sk);
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index c70c42e..4294f12 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -73,9 +73,9 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
rt->rt_key_dst = fl->fl4_dst;
rt->rt_key_src = fl->fl4_src;
rt->rt_tos = fl->fl4_tos;
- rt->rt_iif = fl->iif;
- rt->rt_oif = fl->oif;
- rt->rt_mark = fl->mark;
+ rt->rt_iif = fl->flowi_iif;
+ rt->rt_oif = fl->flowi_oif;
+ rt->rt_mark = fl->flowi_mark;
xdst->u.dst.dev = dev;
dev_hold(dev);
@@ -104,7 +104,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
memset(fl, 0, sizeof(struct flowi));
- fl->mark = skb->mark;
+ fl->flowi_mark = skb->mark;
if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) {
switch (iph->protocol) {
@@ -173,7 +173,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
break;
}
}
- fl->proto = iph->protocol;
+ fl->flowi_proto = iph->protocol;
fl->fl4_dst = reverse ? iph->saddr : iph->daddr;
fl->fl4_src = reverse ? iph->daddr : iph->saddr;
fl->fl4_tos = iph->tos;
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index 983eff2..d231434 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -32,8 +32,8 @@ __xfrm4_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl)
sel->family = AF_INET;
sel->prefixlen_d = 32;
sel->prefixlen_s = 32;
- sel->proto = fl->proto;
- sel->ifindex = fl->oif;
+ sel->proto = fl->flowi_proto;
+ sel->ifindex = fl->flowi_oif;
}
static void
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index a88b2e9..35b0be0 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -655,12 +655,12 @@ int inet6_sk_rebuild_header(struct sock *sk)
struct flowi fl;
memset(&fl, 0, sizeof(fl));
- fl.proto = sk->sk_protocol;
+ fl.flowi_proto = sk->sk_protocol;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
fl.fl6_flowlabel = np->flow_label;
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = inet->inet_dport;
fl.fl_ip_sport = inet->inet_sport;
security_sk_classify_flow(sk, &fl);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index be3a781..6c24b26 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -146,16 +146,16 @@ ipv4_connected:
* destination cache for it.
*/
- fl.proto = sk->sk_protocol;
+ fl.flowi_proto = sk->sk_protocol;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = inet->inet_dport;
fl.fl_ip_sport = inet->inet_sport;
- if (!fl.oif && (addr_type&IPV6_ADDR_MULTICAST))
- fl.oif = np->mcast_oif;
+ if (!fl.flowi_oif && (addr_type&IPV6_ADDR_MULTICAST))
+ fl.flowi_oif = np->mcast_oif;
security_sk_classify_flow(sk, &fl);
@@ -299,7 +299,7 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu)
mtu_info->ip6m_addr.sin6_family = AF_INET6;
mtu_info->ip6m_addr.sin6_port = 0;
mtu_info->ip6m_addr.sin6_flowinfo = 0;
- mtu_info->ip6m_addr.sin6_scope_id = fl->oif;
+ mtu_info->ip6m_addr.sin6_scope_id = fl->flowi_oif;
ipv6_addr_copy(&mtu_info->ip6m_addr.sin6_addr, &ipv6_hdr(skb)->daddr);
__skb_pull(skb, skb_tail_pointer(skb) - skb->data);
@@ -629,16 +629,16 @@ int datagram_send_ctl(struct net *net,
src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
if (src_info->ipi6_ifindex) {
- if (fl->oif && src_info->ipi6_ifindex != fl->oif)
+ if (fl->flowi_oif && src_info->ipi6_ifindex != fl->flowi_oif)
return -EINVAL;
- fl->oif = src_info->ipi6_ifindex;
+ fl->flowi_oif = src_info->ipi6_ifindex;
}
addr_type = __ipv6_addr_type(&src_info->ipi6_addr);
rcu_read_lock();
- if (fl->oif) {
- dev = dev_get_by_index_rcu(net, fl->oif);
+ if (fl->flowi_oif) {
+ dev = dev_get_by_index_rcu(net, fl->flowi_oif);
if (!dev) {
rcu_read_unlock();
return -ENODEV;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 5566595..9e123e0 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -235,7 +235,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
sizeof(struct icmp6hdr), skb->csum);
icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
&fl->fl6_dst,
- len, fl->proto,
+ len, fl->flowi_proto,
skb->csum);
} else {
__wsum tmp_csum = 0;
@@ -248,7 +248,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
sizeof(struct icmp6hdr), tmp_csum);
icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
&fl->fl6_dst,
- len, fl->proto,
+ len, fl->flowi_proto,
tmp_csum);
}
ip6_push_pending_frames(sk);
@@ -443,11 +443,11 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
mip6_addr_swap(skb);
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_ICMPV6;
+ fl.flowi_proto = IPPROTO_ICMPV6;
ipv6_addr_copy(&fl.fl6_dst, &hdr->saddr);
if (saddr)
ipv6_addr_copy(&fl.fl6_src, saddr);
- fl.oif = iif;
+ fl.flowi_oif = iif;
fl.fl_icmp_type = type;
fl.fl_icmp_code = code;
security_skb_classify_flow(skb, &fl);
@@ -465,8 +465,8 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
tmp_hdr.icmp6_cksum = 0;
tmp_hdr.icmp6_pointer = htonl(info);
- if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
- fl.oif = np->mcast_oif;
+ if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst))
+ fl.flowi_oif = np->mcast_oif;
dst = icmpv6_route_lookup(net, skb, sk, &fl);
if (IS_ERR(dst))
@@ -539,11 +539,11 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
tmp_hdr.icmp6_type = ICMPV6_ECHO_REPLY;
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_ICMPV6;
+ fl.flowi_proto = IPPROTO_ICMPV6;
ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
if (saddr)
ipv6_addr_copy(&fl.fl6_src, saddr);
- fl.oif = skb->dev->ifindex;
+ fl.flowi_oif = skb->dev->ifindex;
fl.fl_icmp_type = ICMPV6_ECHO_REPLY;
security_skb_classify_flow(skb, &fl);
@@ -552,8 +552,8 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
return;
np = inet6_sk(sk);
- if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
- fl.oif = np->mcast_oif;
+ if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst))
+ fl.flowi_oif = np->mcast_oif;
err = ip6_dst_lookup(sk, &dst, &fl);
if (err)
@@ -793,10 +793,10 @@ void icmpv6_flow_init(struct sock *sk, struct flowi *fl,
memset(fl, 0, sizeof(*fl));
ipv6_addr_copy(&fl->fl6_src, saddr);
ipv6_addr_copy(&fl->fl6_dst, daddr);
- fl->proto = IPPROTO_ICMPV6;
+ fl->flowi_proto = IPPROTO_ICMPV6;
fl->fl_icmp_type = type;
fl->fl_icmp_code = 0;
- fl->oif = oif;
+ fl->flowi_oif = oif;
security_sk_classify_flow(sk, fl);
}
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index d687e13..673f9bf 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -64,12 +64,12 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
struct flowi fl;
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_TCP;
+ fl.flowi_proto = IPPROTO_TCP;
ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
final_p = fl6_update_dst(&fl, np->opt, &final);
ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr);
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_rsk(req)->loc_port;
security_req_classify_flow(req, &fl);
@@ -213,13 +213,13 @@ int inet6_csk_xmit(struct sk_buff *skb)
struct in6_addr *final_p, final;
memset(&fl, 0, sizeof(fl));
- fl.proto = sk->sk_protocol;
+ fl.flowi_proto = sk->sk_protocol;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
fl.fl6_flowlabel = np->flow_label;
IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel);
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_sport = inet->inet_sport;
fl.fl_ip_dport = inet->inet_dport;
security_sk_classify_flow(sk, &fl);
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 1365468..c8fa470 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -358,7 +358,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
msg.msg_controllen = olen;
msg.msg_control = (void*)(fl->opt+1);
- flowi.oif = 0;
+ flowi.flowi_oif = 0;
err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk,
&junk, &junk);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index adaffaf..3d0f2ac 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -182,7 +182,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
struct in6_addr *first_hop = &fl->fl6_dst;
struct dst_entry *dst = skb_dst(skb);
struct ipv6hdr *hdr;
- u8 proto = fl->proto;
+ u8 proto = fl->flowi_proto;
int seg_len = skb->len;
int hlimit = -1;
int tclass = 0;
@@ -908,7 +908,7 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
#ifdef CONFIG_IPV6_SUBTREES
ip6_rt_check(&rt->rt6i_src, &fl->fl6_src, np->saddr_cache) ||
#endif
- (fl->oif && fl->oif != dst->dev->ifindex)) {
+ (fl->flowi_oif && fl->flowi_oif != dst->dev->ifindex)) {
dst_release(dst);
dst = NULL;
}
@@ -1026,7 +1026,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl,
if (final_dst)
ipv6_addr_copy(&fl->fl6_dst, final_dst);
if (can_sleep)
- fl->flags |= FLOWI_FLAG_CAN_SLEEP;
+ fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
return xfrm_lookup(sock_net(sk), dst, fl, sk, 0);
}
@@ -1062,7 +1062,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl,
if (final_dst)
ipv6_addr_copy(&fl->fl6_dst, final_dst);
if (can_sleep)
- fl->flags |= FLOWI_FLAG_CAN_SLEEP;
+ fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
return xfrm_lookup(sock_net(sk), dst, fl, sk, 0);
}
@@ -1517,7 +1517,7 @@ int ip6_push_pending_frames(struct sock *sk)
struct ipv6_txoptions *opt = np->cork.opt;
struct rt6_info *rt = (struct rt6_info *)inet->cork.dst;
struct flowi *fl = &inet->cork.fl;
- unsigned char proto = fl->proto;
+ unsigned char proto = fl->flowi_proto;
int err = 0;
if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index f199b84..c3fc824 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -963,7 +963,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
skb->transport_header = skb->network_header;
- proto = fl->proto;
+ proto = fl->flowi_proto;
if (encap_limit >= 0) {
init_tel_txopt(&opt, encap_limit);
ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
@@ -1020,7 +1020,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
encap_limit = t->parms.encap_limit;
memcpy(&fl, &t->fl, sizeof (fl));
- fl.proto = IPPROTO_IPIP;
+ fl.flowi_proto = IPPROTO_IPIP;
dsfield = ipv4_get_dsfield(iph);
@@ -1070,7 +1070,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
encap_limit = t->parms.encap_limit;
memcpy(&fl, &t->fl, sizeof (fl));
- fl.proto = IPPROTO_IPV6;
+ fl.flowi_proto = IPPROTO_IPV6;
dsfield = ipv6_get_dsfield(ipv6h);
if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
@@ -1149,7 +1149,7 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
/* Set up flowi template */
ipv6_addr_copy(&fl->fl6_src, &p->laddr);
ipv6_addr_copy(&fl->fl6_dst, &p->raddr);
- fl->oif = p->link;
+ fl->flowi_oif = p->link;
fl->fl6_flowlabel = 0;
if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS))
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 618f67cc..61a8be3 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -618,8 +618,8 @@ static int pim6_rcv(struct sk_buff *skb)
struct net *net = dev_net(skb->dev);
struct mr6_table *mrt;
struct flowi fl = {
- .iif = skb->dev->ifindex,
- .mark = skb->mark,
+ .flowi_iif = skb->dev->ifindex,
+ .flowi_mark = skb->mark,
};
int reg_vif_num;
@@ -688,9 +688,9 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
struct net *net = dev_net(dev);
struct mr6_table *mrt;
struct flowi fl = {
- .oif = dev->ifindex,
- .iif = skb->skb_iif,
- .mark = skb->mark,
+ .flowi_oif = dev->ifindex,
+ .flowi_iif = skb->skb_iif,
+ .flowi_mark = skb->mark,
};
int err;
@@ -1548,9 +1548,9 @@ struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
{
struct mr6_table *mrt;
struct flowi fl = {
- .iif = skb->skb_iif,
- .oif = skb->dev->ifindex,
- .mark = skb->mark,
+ .flowi_iif = skb->skb_iif,
+ .flowi_oif = skb->dev->ifindex,
+ .flowi_mark= skb->mark,
};
if (ip6mr_fib_lookup(net, &fl, &mrt) < 0)
@@ -1916,7 +1916,7 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
ipv6h = ipv6_hdr(skb);
fl = (struct flowi) {
- .oif = vif->link,
+ .flowi_oif = vif->link,
.fl6_dst = ipv6h->daddr,
};
@@ -2044,8 +2044,8 @@ int ip6_mr_input(struct sk_buff *skb)
struct net *net = dev_net(skb->dev);
struct mr6_table *mrt;
struct flowi fl = {
- .iif = skb->dev->ifindex,
- .mark = skb->mark,
+ .flowi_iif = skb->dev->ifindex,
+ .flowi_mark= skb->mark,
};
int err;
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index d1770e0..1448c50 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -448,8 +448,8 @@ sticky_done:
int junk;
fl.fl6_flowlabel = 0;
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
if (optlen == 0)
goto update;
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index f3e3ca9..e2f852c 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -214,7 +214,7 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
struct timeval stamp;
int err = 0;
- if (unlikely(fl->proto == IPPROTO_MH &&
+ if (unlikely(fl->flowi_proto == IPPROTO_MH &&
fl->fl_mh_type <= IP6_MH_TYPE_MAX))
goto out;
@@ -240,14 +240,14 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
sizeof(sel.saddr));
sel.prefixlen_s = 128;
sel.family = AF_INET6;
- sel.proto = fl->proto;
+ sel.proto = fl->flowi_proto;
sel.dport = xfrm_flowi_dport(fl);
if (sel.dport)
sel.dport_mask = htons(~0);
sel.sport = xfrm_flowi_sport(fl);
if (sel.sport)
sel.sport_mask = htons(~0);
- sel.ifindex = fl->oif;
+ sel.ifindex = fl->flowi_oif;
err = km_report(net, IPPROTO_DSTOPTS, &sel,
(hao ? (xfrm_address_t *)&hao->addr : NULL));
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 8d74116..d282c62 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -16,8 +16,8 @@ int ip6_route_me_harder(struct sk_buff *skb)
struct ipv6hdr *iph = ipv6_hdr(skb);
struct dst_entry *dst;
struct flowi fl = {
- .oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
- .mark = skb->mark,
+ .flowi_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
+ .flowi_mark = skb->mark,
.fl6_dst = iph->daddr,
.fl6_src = iph->saddr,
};
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 91f6a61..fd39388 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -90,7 +90,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
}
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_TCP;
+ fl.flowi_proto = IPPROTO_TCP;
ipv6_addr_copy(&fl.fl6_src, &oip6h->daddr);
ipv6_addr_copy(&fl.fl6_dst, &oip6h->saddr);
fl.fl_ip_sport = otcph.dest;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index dc29b07..323ad44 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -588,9 +588,9 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
csum = csum_ipv6_magic(&fl->fl6_src,
&fl->fl6_dst,
- total_len, fl->proto, tmp_csum);
+ total_len, fl->flowi_proto, tmp_csum);
- if (csum == 0 && fl->proto == IPPROTO_UDP)
+ if (csum == 0 && fl->flowi_proto == IPPROTO_UDP)
csum = CSUM_MANGLED_0;
if (skb_store_bits(skb, offset, &csum, 2))
@@ -679,7 +679,7 @@ static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
if (!iov)
continue;
- switch (fl->proto) {
+ switch (fl->flowi_proto) {
case IPPROTO_ICMPV6:
/* check if one-byte field is readable or not. */
if (iov->iov_base && iov->iov_len < 1)
@@ -758,7 +758,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
*/
memset(&fl, 0, sizeof(fl));
- fl.mark = sk->sk_mark;
+ fl.flowi_mark = sk->sk_mark;
if (sin6) {
if (addr_len < SIN6_LEN_RFC2133)
@@ -800,7 +800,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
if (addr_len >= sizeof(struct sockaddr_in6) &&
sin6->sin6_scope_id &&
ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
- fl.oif = sin6->sin6_scope_id;
+ fl.flowi_oif = sin6->sin6_scope_id;
} else {
if (sk->sk_state != TCP_ESTABLISHED)
return -EDESTADDRREQ;
@@ -810,8 +810,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
fl.fl6_flowlabel = np->flow_label;
}
- if (fl.oif == 0)
- fl.oif = sk->sk_bound_dev_if;
+ if (fl.flowi_oif == 0)
+ fl.flowi_oif = sk->sk_bound_dev_if;
if (msg->msg_controllen) {
opt = &opt_space;
@@ -838,7 +838,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
opt = fl6_merge_options(&opt_space, flowlabel, opt);
opt = ipv6_fixup_options(&opt_space, opt);
- fl.proto = proto;
+ fl.flowi_proto = proto;
err = rawv6_probe_proto_opt(&fl, msg);
if (err)
goto out;
@@ -852,8 +852,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
final_p = fl6_update_dst(&fl, opt, &final);
- if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
- fl.oif = np->mcast_oif;
+ if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst))
+ fl.flowi_oif = np->mcast_oif;
security_sk_classify_flow(sk, &fl);
dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0012760..c3b20d6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -608,7 +608,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
restart:
rt = fn->leaf;
- rt = rt6_device_match(net, rt, &fl->fl6_src, fl->oif, flags);
+ rt = rt6_device_match(net, rt, &fl->fl6_src, fl->flowi_oif, flags);
BACKTRACK(net, &fl->fl6_src);
out:
dst_use(&rt->dst, jiffies);
@@ -621,7 +621,7 @@ struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
const struct in6_addr *saddr, int oif, int strict)
{
struct flowi fl = {
- .oif = oif,
+ .flowi_oif = oif,
.fl6_dst = *daddr,
};
struct dst_entry *dst;
@@ -825,7 +825,7 @@ out2:
static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table,
struct flowi *fl, int flags)
{
- return ip6_pol_route(net, table, fl->iif, fl, flags);
+ return ip6_pol_route(net, table, fl->flowi_iif, fl, flags);
}
void ip6_route_input(struct sk_buff *skb)
@@ -834,12 +834,12 @@ void ip6_route_input(struct sk_buff *skb)
struct net *net = dev_net(skb->dev);
int flags = RT6_LOOKUP_F_HAS_SADDR;
struct flowi fl = {
- .iif = skb->dev->ifindex,
+ .flowi_iif = skb->dev->ifindex,
.fl6_dst = iph->daddr,
.fl6_src = iph->saddr,
.fl6_flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK,
- .mark = skb->mark,
- .proto = iph->nexthdr,
+ .flowi_mark = skb->mark,
+ .flowi_proto = iph->nexthdr,
};
if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
@@ -851,7 +851,7 @@ void ip6_route_input(struct sk_buff *skb)
static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
struct flowi *fl, int flags)
{
- return ip6_pol_route(net, table, fl->oif, fl, flags);
+ return ip6_pol_route(net, table, fl->flowi_oif, fl, flags);
}
struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
@@ -1484,7 +1484,7 @@ restart:
continue;
if (!(rt->rt6i_flags & RTF_GATEWAY))
continue;
- if (fl->oif != rt->rt6i_dev->ifindex)
+ if (fl->flowi_oif != rt->rt6i_dev->ifindex)
continue;
if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
continue;
@@ -1511,7 +1511,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
struct net *net = dev_net(dev);
struct ip6rd_flowi rdfl = {
.fl = {
- .oif = dev->ifindex,
+ .flowi_oif = dev->ifindex,
.fl6_dst = *dest,
.fl6_src = *src,
},
@@ -2413,7 +2413,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
iif = nla_get_u32(tb[RTA_IIF]);
if (tb[RTA_OIF])
- fl.oif = nla_get_u32(tb[RTA_OIF]);
+ fl.flowi_oif = nla_get_u32(tb[RTA_OIF]);
if (iif) {
struct net_device *dev;
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 0b4cf35..ca5255c 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -234,12 +234,12 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
struct in6_addr *final_p, final;
struct flowi fl;
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_TCP;
+ fl.flowi_proto = IPPROTO_TCP;
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
final_p = fl6_update_dst(&fl, np->opt, &final);
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_sk(sk)->inet_sport;
security_req_classify_flow(req, &fl);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e59a31c..a3d1229 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -242,12 +242,12 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
if (!ipv6_addr_any(&np->rcv_saddr))
saddr = &np->rcv_saddr;
- fl.proto = IPPROTO_TCP;
+ fl.flowi_proto = IPPROTO_TCP;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src,
(saddr ? saddr : &np->saddr));
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = usin->sin6_port;
fl.fl_ip_sport = inet->inet_sport;
@@ -396,11 +396,11 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
for now.
*/
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_TCP;
+ fl.flowi_proto = IPPROTO_TCP;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
- fl.oif = sk->sk_bound_dev_if;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = sk->sk_bound_dev_if;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = inet->inet_dport;
fl.fl_ip_sport = inet->inet_sport;
security_skb_classify_flow(skb, &fl);
@@ -487,12 +487,12 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
int err;
memset(&fl, 0, sizeof(fl));
- fl.proto = IPPROTO_TCP;
+ fl.flowi_proto = IPPROTO_TCP;
ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr);
fl.fl6_flowlabel = 0;
- fl.oif = treq->iif;
- fl.mark = sk->sk_mark;
+ fl.flowi_oif = treq->iif;
+ fl.flowi_mark = sk->sk_mark;
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_rsk(req)->loc_port;
security_req_classify_flow(req, &fl);
@@ -1055,8 +1055,8 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
__tcp_v6_send_check(buff, &fl.fl6_src, &fl.fl6_dst);
- fl.proto = IPPROTO_TCP;
- fl.oif = inet6_iif(skb);
+ fl.flowi_proto = IPPROTO_TCP;
+ fl.flowi_oif = inet6_iif(skb);
fl.fl_ip_dport = t1->dest;
fl.fl_ip_sport = t1->source;
security_skb_classify_flow(skb, &fl);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index d86d7f6..91f8047 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -915,7 +915,7 @@ static int udp_v6_push_pending_frames(struct sock *sk)
/* add protocol-dependent pseudo-header */
uh->check = csum_ipv6_magic(&fl->fl6_src, &fl->fl6_dst,
- up->len, fl->proto, csum );
+ up->len, fl->flowi_proto, csum);
if (uh->check == 0)
uh->check = CSUM_MANGLED_0;
@@ -1060,7 +1060,7 @@ do_udp_sendmsg:
if (addr_len >= sizeof(struct sockaddr_in6) &&
sin6->sin6_scope_id &&
ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
- fl.oif = sin6->sin6_scope_id;
+ fl.flowi_oif = sin6->sin6_scope_id;
} else {
if (sk->sk_state != TCP_ESTABLISHED)
return -EDESTADDRREQ;
@@ -1071,13 +1071,13 @@ do_udp_sendmsg:
connected = 1;
}
- if (!fl.oif)
- fl.oif = sk->sk_bound_dev_if;
+ if (!fl.flowi_oif)
+ fl.flowi_oif = sk->sk_bound_dev_if;
- if (!fl.oif)
- fl.oif = np->sticky_pktinfo.ipi6_ifindex;
+ if (!fl.flowi_oif)
+ fl.flowi_oif = np->sticky_pktinfo.ipi6_ifindex;
- fl.mark = sk->sk_mark;
+ fl.flowi_mark = sk->sk_mark;
if (msg->msg_controllen) {
opt = &opt_space;
@@ -1105,7 +1105,7 @@ do_udp_sendmsg:
opt = fl6_merge_options(&opt_space, flowlabel, opt);
opt = ipv6_fixup_options(&opt_space, opt);
- fl.proto = sk->sk_protocol;
+ fl.flowi_proto = sk->sk_protocol;
if (!ipv6_addr_any(daddr))
ipv6_addr_copy(&fl.fl6_dst, daddr);
else
@@ -1118,8 +1118,8 @@ do_udp_sendmsg:
if (final_p)
connected = 0;
- if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) {
- fl.oif = np->mcast_oif;
+ if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst)) {
+ fl.flowi_oif = np->mcast_oif;
connected = 0;
}
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 48ce496..d62496c 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -128,7 +128,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
u8 nexthdr = nh[IP6CB(skb)->nhoff];
memset(fl, 0, sizeof(struct flowi));
- fl->mark = skb->mark;
+ fl->flowi_mark = skb->mark;
ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr);
ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr);
@@ -161,7 +161,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
fl->fl_ip_sport = ports[!!reverse];
fl->fl_ip_dport = ports[!reverse];
}
- fl->proto = nexthdr;
+ fl->flowi_proto = nexthdr;
return;
case IPPROTO_ICMPV6:
@@ -171,7 +171,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
fl->fl_icmp_type = icmp[0];
fl->fl_icmp_code = icmp[1];
}
- fl->proto = nexthdr;
+ fl->flowi_proto = nexthdr;
return;
#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
@@ -182,7 +182,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
fl->fl_mh_type = mh->ip6mh_type;
}
- fl->proto = nexthdr;
+ fl->flowi_proto = nexthdr;
return;
#endif
@@ -192,7 +192,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
case IPPROTO_COMP:
default:
fl->fl_ipsec_spi = 0;
- fl->proto = nexthdr;
+ fl->flowi_proto = nexthdr;
return;
}
}
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index a02598e..805d0e1 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -33,8 +33,8 @@ __xfrm6_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl)
sel->family = AF_INET6;
sel->prefixlen_d = 128;
sel->prefixlen_s = 128;
- sel->proto = fl->proto;
- sel->ifindex = fl->oif;
+ sel->proto = fl->flowi_proto;
+ sel->ifindex = fl->flowi_oif;
}
static void
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index d69ec26..d07a32a 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -76,7 +76,7 @@ static int __ip_vs_addr_is_local_v6(struct net *net,
{
struct rt6_info *rt;
struct flowi fl = {
- .oif = 0,
+ .flowi_oif = 0,
.fl6_dst = *addr,
.fl6_src = { .s6_addr32 = {0, 0, 0, 0} },
};
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index faf381d..cc8071f 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -169,7 +169,7 @@ __ip_vs_reroute_locally(struct sk_buff *skb)
.fl4_dst = iph->daddr,
.fl4_src = iph->saddr,
.fl4_tos = RT_TOS(iph->tos),
- .mark = skb->mark,
+ .flowi_mark = skb->mark,
};
rt = ip_route_output_key(net, &fl);
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 624725b..cb14ae2 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -68,7 +68,7 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)
if (info->priv) {
if (info->priv->oif == -1)
return false;
- fl.oif = info->priv->oif;
+ fl.flowi_oif = info->priv->oif;
}
fl.fl4_dst = info->gw.ip;
fl.fl4_tos = RT_TOS(iph->tos);
@@ -149,7 +149,7 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
if (info->priv) {
if (info->priv->oif == -1)
return false;
- fl.oif = info->priv->oif;
+ fl.flowi_oif = info->priv->oif;
}
fl.fl6_dst = info->gw.in6;
fl.fl6_flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 95e0c8e..8316271 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -205,7 +205,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
memset(&fl, 0, sizeof(fl));
- fl.proto = sk->sk_protocol;
+ fl.flowi_proto = sk->sk_protocol;
/* Fill in the dest address from the route entry passed with the skb
* and the source address from the transport.
@@ -216,9 +216,9 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
fl.fl6_flowlabel = np->flow_label;
IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel);
if (ipv6_addr_type(&fl.fl6_src) & IPV6_ADDR_LINKLOCAL)
- fl.oif = transport->saddr.v6.sin6_scope_id;
+ fl.flowi_oif = transport->saddr.v6.sin6_scope_id;
else
- fl.oif = sk->sk_bound_dev_if;
+ fl.flowi_oif = sk->sk_bound_dev_if;
if (np->opt && np->opt->srcrt) {
struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt;
@@ -250,7 +250,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
memset(&fl, 0, sizeof(fl));
ipv6_addr_copy(&fl.fl6_dst, &daddr->v6.sin6_addr);
if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
- fl.oif = daddr->v6.sin6_scope_id;
+ fl.flowi_oif = daddr->v6.sin6_scope_id;
SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl.fl6_dst);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 4e55e6c..832665a 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -477,10 +477,10 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
memset(&fl, 0x0, sizeof(struct flowi));
fl.fl4_dst = daddr->v4.sin_addr.s_addr;
fl.fl_ip_dport = daddr->v4.sin_port;
- fl.proto = IPPROTO_SCTP;
+ fl.flowi_proto = IPPROTO_SCTP;
if (asoc) {
fl.fl4_tos = RT_CONN_FLAGS(asoc->base.sk);
- fl.oif = asoc->base.sk->sk_bound_dev_if;
+ fl.flowi_oif = asoc->base.sk->sk_bound_dev_if;
fl.fl_ip_sport = htons(asoc->base.bind_addr.port);
}
if (saddr) {
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 9e4aacd..dd6243f 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -63,8 +63,8 @@ __xfrm4_selector_match(const struct xfrm_selector *sel, const struct flowi *fl)
addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) &&
!((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
!((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
- (fl->proto == sel->proto || !sel->proto) &&
- (fl->oif == sel->ifindex || !sel->ifindex);
+ (fl->flowi_proto == sel->proto || !sel->proto) &&
+ (fl->flowi_oif == sel->ifindex || !sel->ifindex);
}
static inline int
@@ -74,8 +74,8 @@ __xfrm6_selector_match(const struct xfrm_selector *sel, const struct flowi *fl)
addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) &&
!((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
!((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
- (fl->proto == sel->proto || !sel->proto) &&
- (fl->oif == sel->ifindex || !sel->ifindex);
+ (fl->flowi_proto == sel->proto || !sel->proto) &&
+ (fl->flowi_oif == sel->ifindex || !sel->ifindex);
}
int xfrm_selector_match(const struct xfrm_selector *sel, const struct flowi *fl,
@@ -876,13 +876,13 @@ static int xfrm_policy_match(const struct xfrm_policy *pol,
int match, ret = -ESRCH;
if (pol->family != family ||
- (fl->mark & pol->mark.m) != pol->mark.v ||
+ (fl->flowi_mark & pol->mark.m) != pol->mark.v ||
pol->type != type)
return ret;
match = xfrm_selector_match(sel, fl, family);
if (match)
- ret = security_xfrm_policy_lookup(pol->security, fl->secid,
+ ret = security_xfrm_policy_lookup(pol->security, fl->flowi_secid,
dir);
return ret;
@@ -1012,7 +1012,7 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(struct sock *sk, int dir,
goto out;
}
err = security_xfrm_policy_lookup(pol->security,
- fl->secid,
+ fl->flowi_secid,
policy_to_flow_dir(dir));
if (!err)
xfrm_pol_hold(pol);
@@ -1848,7 +1848,7 @@ restart:
return make_blackhole(net, family, dst_orig);
}
- if (fl->flags & FLOWI_FLAG_CAN_SLEEP) {
+ if (fl->flowi_flags & FLOWI_FLAG_CAN_SLEEP) {
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&net->xfrm.km_waitq, &wait);
@@ -1990,7 +1990,7 @@ int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
return -EAFNOSUPPORT;
afinfo->decode_session(skb, fl, reverse);
- err = security_xfrm_decode_session(skb, &fl->secid);
+ err = security_xfrm_decode_session(skb, &fl->flowi_secid);
xfrm_policy_put_afinfo(afinfo);
return err;
}
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 81221d9..cd6be49 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -859,7 +859,7 @@ found:
xfrm_init_tempstate(x, fl, tmpl, daddr, saddr, family);
memcpy(&x->mark, &pol->mark, sizeof(x->mark));
- error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid);
+ error = security_xfrm_state_alloc_acquire(x, pol->security, fl->flowi_secid);
if (error) {
x->km.state = XFRM_STATE_DEAD;
to_put = x;
diff --git a/security/security.c b/security/security.c
index 8ef1f7d..bae843c 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1100,7 +1100,7 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk)
void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
{
- security_ops->sk_getsecid(sk, &fl->secid);
+ security_ops->sk_getsecid(sk, &fl->flowi_secid);
}
EXPORT_SYMBOL(security_sk_classify_flow);
@@ -1246,7 +1246,7 @@ int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
{
- int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
+ int rc = security_ops->xfrm_decode_session(skb, &fl->flowi_secid, 0);
BUG_ON(rc);
}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index cef42f5..c178494 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4306,7 +4306,7 @@ static void selinux_secmark_refcount_dec(void)
static void selinux_req_classify_flow(const struct request_sock *req,
struct flowi *fl)
{
- fl->secid = req->secid;
+ fl->flowi_secid = req->secid;
}
static int selinux_tun_dev_create(void)
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index c43ab54..510ec2c 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -135,10 +135,10 @@ int selinux_xfrm_state_pol_flow_match(struct xfrm_state *x, struct xfrm_policy *
state_sid = x->security->ctx_sid;
- if (fl->secid != state_sid)
+ if (fl->flowi_secid != state_sid)
return 0;
- rc = avc_has_perm(fl->secid, state_sid, SECCLASS_ASSOCIATION,
+ rc = avc_has_perm(fl->flowi_secid, state_sid, SECCLASS_ASSOCIATION,
ASSOCIATION__SENDTO,
NULL)? 0:1;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 5/25] net: Create struct flowi_common
From: David Miller @ 2011-03-12 23:26 UTC (permalink / raw)
To: netdev
Pull out the AF independent members of struct flowi into a
new struct flowi_common
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/flow.h | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/include/net/flow.h b/include/net/flow.h
index 8c4dbd0..7759687 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -10,18 +10,30 @@
#include <linux/in6.h>
#include <asm/atomic.h>
-struct flowi {
- int flowi_oif;
- int flowi_iif;
- __u32 flowi_mark;
- __u8 flowi_tos;
- __u8 flowi_scope;
- __u8 flowi_proto;
- __u8 flowi_flags;
+struct flowi_common {
+ int flowic_oif;
+ int flowic_iif;
+ __u32 flowic_mark;
+ __u8 flowic_tos;
+ __u8 flowic_scope;
+ __u8 flowic_proto;
+ __u8 flowic_flags;
#define FLOWI_FLAG_ANYSRC 0x01
#define FLOWI_FLAG_PRECOW_METRICS 0x02
#define FLOWI_FLAG_CAN_SLEEP 0x04
- __u32 flowi_secid;
+ __u32 flowic_secid;
+};
+
+struct flowi {
+ struct flowi_common __fl_common;
+#define flowi_oif __fl_common.flowic_oif
+#define flowi_iif __fl_common.flowic_iif
+#define flowi_mark __fl_common.flowic_mark
+#define flowi_tos __fl_common.flowic_tos
+#define flowi_scope __fl_common.flowic_scope
+#define flowi_proto __fl_common.flowic_proto
+#define flowi_flags __fl_common.flowic_flags
+#define flowi_secid __fl_common.flowic_secid
union {
struct {
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox