mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
net: Pass neighbours and dest address into NETEVENT_REDIRECT events.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fccd7d5c77
commit
1d248b1cf4
3 changed files with 19 additions and 15 deletions
|
@ -62,7 +62,8 @@ static const unsigned int MAX_ATIDS = 64 * 1024;
|
||||||
static const unsigned int ATID_BASE = 0x10000;
|
static const unsigned int ATID_BASE = 0x10000;
|
||||||
|
|
||||||
static void cxgb_neigh_update(struct neighbour *neigh);
|
static void cxgb_neigh_update(struct neighbour *neigh);
|
||||||
static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new);
|
static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh,
|
||||||
|
struct dst_entry *new, struct neighbour *new_neigh);
|
||||||
|
|
||||||
static inline int offload_activated(struct t3cdev *tdev)
|
static inline int offload_activated(struct t3cdev *tdev)
|
||||||
{
|
{
|
||||||
|
@ -968,8 +969,9 @@ static int nb_callback(struct notifier_block *self, unsigned long event,
|
||||||
}
|
}
|
||||||
case (NETEVENT_REDIRECT):{
|
case (NETEVENT_REDIRECT):{
|
||||||
struct netevent_redirect *nr = ctx;
|
struct netevent_redirect *nr = ctx;
|
||||||
cxgb_redirect(nr->old, nr->new);
|
cxgb_redirect(nr->old, nr->old_neigh,
|
||||||
cxgb_neigh_update(dst_get_neighbour_noref(nr->new));
|
nr->new, nr->new_neigh);
|
||||||
|
cxgb_neigh_update(nr->new_neigh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1107,10 +1109,10 @@ static void set_l2t_ix(struct t3cdev *tdev, u32 tid, struct l2t_entry *e)
|
||||||
tdev->send(tdev, skb);
|
tdev->send(tdev, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
|
static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh,
|
||||||
|
struct dst_entry *new, struct neighbour *new_neigh)
|
||||||
{
|
{
|
||||||
struct net_device *olddev, *newdev;
|
struct net_device *olddev, *newdev;
|
||||||
struct neighbour *n;
|
|
||||||
struct tid_info *ti;
|
struct tid_info *ti;
|
||||||
struct t3cdev *tdev;
|
struct t3cdev *tdev;
|
||||||
u32 tid;
|
u32 tid;
|
||||||
|
@ -1118,15 +1120,8 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
|
||||||
struct l2t_entry *e;
|
struct l2t_entry *e;
|
||||||
struct t3c_tid_entry *te;
|
struct t3c_tid_entry *te;
|
||||||
|
|
||||||
n = dst_get_neighbour_noref(old);
|
olddev = old_neigh->dev;
|
||||||
if (!n)
|
newdev = new_neigh->dev;
|
||||||
return;
|
|
||||||
olddev = n->dev;
|
|
||||||
|
|
||||||
n = dst_get_neighbour_noref(new);
|
|
||||||
if (!n)
|
|
||||||
return;
|
|
||||||
newdev = n->dev;
|
|
||||||
|
|
||||||
if (!is_offloading(olddev))
|
if (!is_offloading(olddev))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,10 +12,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct dst_entry;
|
struct dst_entry;
|
||||||
|
struct neighbour;
|
||||||
|
|
||||||
struct netevent_redirect {
|
struct netevent_redirect {
|
||||||
struct dst_entry *old;
|
struct dst_entry *old;
|
||||||
|
struct neighbour *old_neigh;
|
||||||
struct dst_entry *new;
|
struct dst_entry *new;
|
||||||
|
struct neighbour *new_neigh;
|
||||||
|
const void *daddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum netevent_notif_type {
|
enum netevent_notif_type {
|
||||||
|
|
|
@ -1687,6 +1687,7 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src,
|
||||||
struct rt6_info *rt, *nrt = NULL;
|
struct rt6_info *rt, *nrt = NULL;
|
||||||
struct netevent_redirect netevent;
|
struct netevent_redirect netevent;
|
||||||
struct net *net = dev_net(neigh->dev);
|
struct net *net = dev_net(neigh->dev);
|
||||||
|
struct neighbour *old_neigh;
|
||||||
|
|
||||||
rt = ip6_route_redirect(dest, src, saddr, neigh->dev);
|
rt = ip6_route_redirect(dest, src, saddr, neigh->dev);
|
||||||
|
|
||||||
|
@ -1714,7 +1715,8 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src,
|
||||||
dst_confirm(&rt->dst);
|
dst_confirm(&rt->dst);
|
||||||
|
|
||||||
/* Duplicate redirect: silently ignore. */
|
/* Duplicate redirect: silently ignore. */
|
||||||
if (neigh == dst_get_neighbour_noref_raw(&rt->dst))
|
old_neigh = dst_get_neighbour_noref_raw(&rt->dst);
|
||||||
|
if (neigh == old_neigh)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
nrt = ip6_rt_copy(rt, dest);
|
nrt = ip6_rt_copy(rt, dest);
|
||||||
|
@ -1732,7 +1734,10 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
netevent.old = &rt->dst;
|
netevent.old = &rt->dst;
|
||||||
|
netevent.old_neigh = old_neigh;
|
||||||
netevent.new = &nrt->dst;
|
netevent.new = &nrt->dst;
|
||||||
|
netevent.new_neigh = neigh;
|
||||||
|
netevent.daddr = dest;
|
||||||
call_netevent_notifiers(NETEVENT_REDIRECT, &netevent);
|
call_netevent_notifiers(NETEVENT_REDIRECT, &netevent);
|
||||||
|
|
||||||
if (rt->rt6i_flags & RTF_CACHE) {
|
if (rt->rt6i_flags & RTF_CACHE) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue