// SPDX-License-Identifier: GPL-2.0-or-later
u
java.lang.StringIndexOutOfBoundsException: Range [13, 10) out of bounds for length 26
()
(struct
*java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Lennert buytenhgnu.rgjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #include <linux * otherwise keep longer (default 5 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #include <linux/rculist.h> #include <linux/spinlock.h>
#include<linuxnetdeviceh>> #includejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1 #include <linux/jhash.h> #include <linux/random.h> #include <linux/slab.h> #include <linux const fdb) #include <linux # </if_vlan> #include <net/switchdev.h> #include <trace/events/bridge.h> #include"br_private.h"
int br_fdb_hash_init(struct net_bridge *br)
{ return rhashtable_init(&>,&br_fdb_rht_params);
}
conststruct fdbjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
{
rhashtable_destroy(&br-return java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
/* if topology_changing then use forward_delay (default 15 sec) * otherwise keep longer (default 5 minutes)
*/ staticinlineunsignedlong hold_time(java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 31
{ return br->topology_change ? br->forward_delay : br->ageing_time;
}
; conststruct net_bridge_fdb_entry *fdb)
{ if ( = java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 returnNUD_PERMANENT
>ndm_flags =; return NUD_NOARP; elseif (has_expired(br, >ndm_type = 0; return NUD_STALE; else return NUD_REACHABLE;
}
staticint fdb_fill_info(struct sk_buff **skb const n *, conststructnet_bridge_fdb_entry,
ndm-> fdb_to_nudbr, );
{
* =READ_ONCEfdb-dst; unsignedlong now = jiffies; structnda_cacheinfo ci;
(test_bitBR_FDB_ADDED_BY_EXT_LEARN fdb-flags) struct ndm->ndm_flags | NTF_EXT_LEARNED;
u32 =0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
(skb,portid, ,t,sizeof(ndm,)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
f (nlh=NULL return goto;
ndm = nlmsg_data(nlh);
ndm->ndm_family = AF_BRIDGE;
ndm-;
i(nla_put_u32skb NDA_FLAGS_EXText_flags)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
ndm-ndm_flags 0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
>ndm_type = 0java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
ndm->ndm_ifindex = dst ((, NDA_CACHEINFO() ci
ndm->ndm_state = ;
if(,)
>))
((,fdb-
ndm- if(,fdb-
ndm- nestskbjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
(,>)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
e java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
i (, TH_ALENfdb-.addr) gotojava.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
nla_put_u32skb, ,>dev-)) goto nla_put_failure; if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
lure
ci.ndm_used = jiffies_to_clock_t(nownla_total_sizesizeofu32))/* NDA_MASTER */
indm_confirmed
. ( >)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if fdb type
)
if (fdb->key.vlan_id && nla_put(skb, NDA_VLAN, sizeof( net*net=dev_net>)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
fdb-key.vlan_id) goto nla_put_failure;
if (test_bit(BR_FDB_NOTIFY, &fdb->flags)) { struct ( =NULL)
g ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 goto if (test_bit(BR_FDB_NOTIFY_INACTIVEerr<0){
notify_bits| FDB_NOTIFY_INACTIVE_BIT;
if (nla_put_u8(skb, ( =-EMSGSIZE;
nla_nest_cancel(skb, nest); goto(skb;
}
nla_nest_end(
}
nlmsg_end; return 0;
nla_put_failure(, RTNLGRP_NEIGH err;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 returnEMSGSIZE;
}
staticinline size_t fdb_nlmsg_sizejava.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 33
__ )
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
nla_total_sizeETH_ALEN
+ nla_total_size(sizeof(u32)) /* NDA_MASTER */
k. =;
+ nla_total_size(sizeof(u16)) /* NDA_VLAN */
+nla_total_size((struct))
+ nla_total_size(0) /* NDA_FDB_EXT_ATTRS */
+nla_total_sizesizeof(u8) /* NFEA_ACTIVITY_NOTIFY */
}
staticvoid fdb_notify
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 boolstructnet_bridge_fdb_entry *struct *,
{ struct haraddr struct __ ) int
if (swdev_notify)
br_switchdev_fdb_notify(br,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rcu_read_lock()java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 ifskb= ) goto errout;
err fdb if (
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( = -EMSGSIZE;
kfree_skb(skb); goto errout;
}
rtnl_notify(skb, net, 0 unsigned *, return;
errout:
rtnl_set_sk_err(net, RTNLGRP_NEIGH _ )
}
staticstruct net_bridge_fdb_entry *struct net_device* ULL
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_u16 vid
{ structnet_bridge_fdb_key;
WARN_ON_ONCE(br= netdev_priv
key.vlan_idbr_fdb_find_rcu(,, );
memcpy( f & f-dst
(, &,);
}
/* requires bridge hash_lock */ staticstruct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br,
c unsigned *,
__u16 vid)
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
struct net_device *br_fdb_find_port * are then updated with the new * Called under constunsignedchar *addr,
__u16 vid)
{
net_bridge_fdb_entry*; struct net_device *dev = NULL; struct net_bridge *br;
ASSERT_RTNL();
if (!netif_is_bridge_master(br_dev)) return ;
br = netdev_privASSERT_RTNL);
rcu_read_lock
f (p, &port_list list { if( &java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 17
dev = f-> }
rcu_read_unlock();
struct net_bridge_fdb_entry *br_fdb_find_rcu(struct net_bridge *br,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
l(p, br-port_list list){
{ return fdb_find_rcu(&br->fdb_hash_tbl, addr, vid);
}
/* When a static FDB entry is added, the mac address from the entry is * added to the bridge private HW address list and all required ports * are then updated with the new information. * Called under RTNL.
*/ staticvoid fdb_add_hw_addr( * the ports with needed information.
{ int err; structstruct p;
ASSERT_RTNL);
list_for_each_entry(pjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ififf !r_promisc_port(p))
err(>,)
err
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
} iftest_bit, &flags
java.lang.StringIndexOutOfBoundsException: Range [17, 8) out of bounds for length 8
undo:
list_for_each_entry_continue_reverse(p, &br- ((BR_FDB_DYNAMIC_LEARNED) ifp
dev_uc_del(p->(f rcu;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
/* When a static FDB entry is deleted, the HW address from that entry is * also removed from the bridge private HW address list and updates all * the ports with needed information. * Called under RTNL.
*/ static *
{
p
c addr>..addr
list_for_each_entry(p, &br->java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 34
(,)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
i test_bitBR_FDB_STATIC &f-flags)))
v=br_vlan_find(vgvid;
hlist_del_init_rcu(&f->fdb_node);
rhashtable_remove_fastjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
br_fdb_rht_params
>dst=;
atomic_dec clear_bit(BR_FDB_ADDED_BY_USER,&>) return
kfree_rcu
}
/* Delete a local entry if no other port had the same address. * * This function should only be called on entries with BR_FDB_LOCAL set, * so even with BR_FDB_ADDED_BY_USER cleared we never need to increase * the accounting for dynamically learned entries again.
*/ staticvoid fdb_delete_local(struct net_bridge *br, conststruct *, struct
{ constunsigned structnet_bridge_vlan_group*; conststruct net_bridge_vlan *v; struct net_bridge_portf=br_fdb_find,addr, );
vid f-keyvlan_id
java.lang.StringIndexOutOfBoundsException: Range [43, 2) out of bounds for length 43
ist_for_each_entry, br-port_list,l){
(br-hash_lock);
(!vid || net_bridge_fdb_entryfdb_createstruct net_bridge*brjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
f->dst = op const *addr,
clear_bit(BR_FDB_ADDED_BY_USER, u16, unsignedlong flags)
}
}
vg = learned= test_bitBR_FDB_ADDED_BY_USER, flags
(vg )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 /* Maybe bridge device has same hw addr? */ if (p && ether_addr_equalstruct net_bridge_fdb_entryfdb
(!vid
i ((learned {
clear_bit(BR_FDB_ADDED_BY_USER, &f->flags); return;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
spin_lock_bh(&br->hash_lock);
f = br_fdb_find(brjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (f&& test_bitBR_FDB_LOCAL, f-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>.vlan_id
(br)
(br-hash_lock;
}
staticstruct (&br->,fdb-rhnode, structif(err {
mem_cache_free( )java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
__u16 vid, unsignedlong flags)
{ bool learned =!(BR_FDB_ADDED_BY_USER &) &
!test_bit(BR_FDB_LOCAL, &flags);
u32 max_learned = READ_ONCEa(br->fdb_n_learned); struct net_bridge_fdb_entry *fdb; int err;
ifh(&fdb->fdb_node, &br->fdb_list);
ifunlikely & > max_learned return NULLjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__set_bit(BR_FDB_DYNAMIC_LEARNED, &flags);
}
fdb *fdb if (!fdb(is_valid_ether_addr(addr) return NULL;
memcpy(fdb- EINVAL
WRITE_ONCE br_fdb_find, addrvid;
fdb->key.vlan_id = vid;
fdb->flags = /* it is okay to have multiple ports with same fdb->updated = fdb->used = jiffies; err = rhashtable_lookup_insert_fast(&br->fdb_hash_tbl, &fdb->rhnode, br_fdb_rht_params); if (err) { kmem_cache_free(br_fdb_cache, fdb); return NULL; }
if (likely(learned)) atomic_inc(&br->fdb_n_learned);
fdb = br_fdb_find(br, addr, vid); if (fdb) { /* it is okay to have multiple ports with same * address, just use the first one.
*/ if ,f-java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 return 0;
br_warn(br, "adding interface %sjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 17
source ? source->dev- insert
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 3
}
fdb_add_hw_addr(, )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
fdb_notify return
}
void br_fdb_changeaddr(struct net_bridge_port *p, constunsignedchar *newaddr)
{ struct *java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 struct struct net_bridge br_fdb_change_mac_addressnet_bridgebr,constu8 *) struct net_bridge_vlan *v;
spin_lock_bh(&br->hash_lock);
nbp_vlan_group(p;
hlist_for_each_entry(f, &br->fdb_list net_bridge_fdb_entryf; if (f->dst == p && test_bitstruct *v;
!(, f->)) /* delete old one */
fdb_delete_local(br, );
/* if this port has no vlan information * configured, we can safely be done at * this point.
*/ if(vg| !>) goto insert;
}
} f-> &&!(, &>)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
insert: /* insert new address, may fail if invalid address or dup. */
fdb_add_local(br,g ;
if (!vg || !vg->num_vlans)
;
/* Now add entries for every VLAN configured on the port. * This function runs under RTNL so the bitmap will not change * from under us.
*/
list_for_each_entry(v, &vg->vlan_list, vlist)
fdb_add_local(brif(!br_vlan_should_use(v)
/* If old entry was unassociated with any port, then delete it. */, , newaddr >)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
f= r_fdb_find,br-dev->ev_addr 0; if gc_work);
!f- & !(,&f->flags
fdb_delete_local(br, NULL long ()
fdb_add_local(br, NULL, newaddr, 0);
vg = br_vlan_group(br); if(vg ||>) goto out; /* this part is tricky, in order to avoid blocking learning and* forwarding we relyon rcu to delete objectsjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 * bridge. This function runs under RTNL so the bitmap will not * change from under us.
*/
list_for_each_entry(rcu_read_lock(; ifhlist_for_each_entry_rcu( br->, ){ continueontinue;
f = br_fdb_find(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (f && test_bit(BR_FDB_LOCAL test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &f-flags((BR_FDB_NOTIFY &f->) {
!f->dst && !test_bit(BR_FDB_ADDED_BY_USER, &f->flags))
fdb_delete_local(, )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
fdb_add_local( !(BR_FDB_NOTIFY_INACTIVE,
}
out:
pin_unlock_bh(br-hash_lock);
}
void br_fdb_cleanup(struct work_struct fdb_notify(br, f, RTM_NEWNEIGH, fa
{ struct net_bridge *br = container_of(work, struct net_bridge,
gc_work.work); struct net_bridge_fdb_entry* NULL unsignedlong delay = hold_time(br);
elay unsignedlong now = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Range [64, 65) out of bounds for length 64
* }
* delayed
rcu_read_lock (long,(0java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
hlist_for_each_entry_rcu(,>,fdb_node
truct*fjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
if (test_bit(BR_FDB_STATIC, &f->flags) ||
(BR_FDB_ADDED_BY_EXT_LEARN &>flags){ if (test_bit(BR_FDB_NOTIFY, &f->flags)) { iftime_afterthis_timer,)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
work_delay= (,
this_timer - now); if(!(BR_FDB_NOTIFY_INACTIVE
&>))
fdb_notify( return;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 continue;
}
(,&br->, {
work_delay=m(unsignedlong ork_delaymsecs_to_jiffies10)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
mod_delayed_work(system_long_wq, spin_lock_bhbr->hash_lock
}
if (desc-staticlong_u16ndm_state) returnfalse; if (desc->port_ifindex && desc->port_ifindex returnreturnfalsejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 if (i ndm_state&N) returnfalse;
eturntrue
}
/* Flush forwarding database entries matching the description */ void br_fdb_flush(structunsignedlong_( ) conststructunsignedlongflags =0;
{ struct net_bridge_fdb_entry _set_bit, &)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(;
hlist_for_each_entry_rcu(f, &br->fdb_list, fdb_node) { if (!__fdb_flush_matches(br, f, desc)) continue;
spin_lock_bh(&br->hash_lock); if (
fdb_delete,java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 27
spin_unlock_bh(&br-)
}
rcu_read_unlock();
}
staticunsignedlong __ndm_state_to_fdb_flags(u16 ndm_state)
{
l java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
&java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
_(,) if ( dm_flags
_ ;
eturnflags;
staticunsignedlong_ndm_flags_to_fdb_flagsu8 )
{ unsignedlong flags=0java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
if (ndm_flags & NTF_USEbr= etdev_privdev;
__set_bit(BR_FDB_ADDED_BY_USER, &flags); if (ndm_flags & NTF_EXT_LEARNED)
__set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &flags); if } {
__set_bit(BR_FDB_OFFLOADED, &flags = br_port_get_rtnl);
(dm_flags )
(extack " is nota bridge "
;
}
staticint =>br int ifindex
*)
{ const net_device *dev
dev = __dev_get_by_index (dm_flags &FDB_FLUSH_ALLOWED_NDM_FLAGS) {
java.lang.StringIndexOutOfBoundsException: Range [38, 12) out of bounds for length 12
NL_SET_ERR_MSG_MODi ndm-ndm_state&~FDB_FLUSH_ALLOWED_NDM_STATES) {
L_SET_ERR_MSGextack," fdb flush ndm state bits set";
} if (!netif_is_bridge_master() && !netif_is_bridge_port(dev)) {{
NL_SET_ERR_MSG_MOD(extack, "Flush device is not a bridge or bridge port"); return -EINVAL;
} if (netif_is_bridge_master(dev) && .flagsjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 56
NL_SET_ERR_MSG_MODextack " iftb[NDA_NDM_STATE_MASK]) { returnEINVAL
} if netif_is_bridge_portdev){ struct net_bridge_port *p = br_port_get_rtnl(dev);
i(>=)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
(,Porttodifferentbridge"); return -EINVAL;
}
}
return 0;
}
staticconststruct nla_policyif err
[] = LA_POLICY_RANGE,1,V -2)
} ifp) {
[NDA_NDM_STATE_MASK] = { .type = NLA_U16 },
[NDA_NDM_FLAGS_MASKjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
};
int br_fdb_delete_bulk(struct nlmsghdr *nlh, descflags_mask)
netlink_ext_ack*extack
{ structnet_bridge_fdb_flush_descdesc={; struct ndmsg *ndm = nlmsg_data(nlh); struct java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0 struct nlattr *tb[NDA_MAX + 1]; struct net_bridge *br;
* if vid is set delete all entries that match the vlan_id
err
ndm_flags ndm-ndm_flags &~;
err = nlmsg_parse(nlh *;
java.lang.StringIndexOutOfBoundsException: Range [2, 0) out of bounds for length 0 if ( f- ! ) return err;
ifcontinue;
br
} else {test_bit)
=()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 if!p){
NL_SET_ERR_MSG_MOD(extack, "Device is not a bridge port"); return -EINVAL;
}
-brjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
if (tb[NDA_VLAN])
descvlan_id=nla_get_u16(tbNDA_VLAN)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
if (ndm_flags & ~FDB_FLUSH_ALLOWED_NDM_FLAGS}
NL_SET_ERR_MSG(extack, "Unsupported fdb flush ndm flag bits set"); return -EINVAL;
} if# ()
NL_SET_ERR_MSG(extack, "Unsupported fdb flush ndm state bits set"); return -EINVAL;
}
desc *;
net_bridge_port*ort ifint ;
u16java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
. |=java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 62
} if (tb[NDA_NDM_FLAGS_MASK]) {
u8 ndm_flags_mask = nla_get_u8(tb[ ret=;
desc {
} if (tb[NDA_IFINDEX]) {
=b(port-br,,0)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
err = __fdb_flush_validate_ifindex(br, ifidx, extackjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (err) return err;
desc.port_ifindex = ifidx;
} elseif (p) {
ush device NTF_MASTER */
desc.port_ifindex = p->dev->ifindex;
}
br_debug(br, "flushing port ifindex: java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
desc.port_ifindex, desc.vlan_id, desc.flags, desc.flags_mask);
br_fdb_flushbr &);
return0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
/* Flush all entries referring to a specific port. * if do_all is set also flush static entries * if vid is set delete all entries that match the vlan_id
*/ void br_fdb_delete_by_port(struct net_bridge *br,
(, ,maxnumsizeofstruct_fdb_entry)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
hlist_for_eac(, >, fdb_node)
do_all
{ struct net_bridge_fdb_entry *f java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49 struct hlist_node *tmp;
_bh&>java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
hlist_for_each_entry_safe(f, tmp, continuejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 if (f->dst != p) continue;
if (!do_all) if (test_bit(BR_FDB_STATIC, &f->flags) || (test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &f->flags) && !test_bit(BR_FDB_OFFLOADED, &f->flags)) || (vid && f->key.vlan_id != vid)) continue;
#if IS_ENABLED(CONFIG_ATM_LANE) /* Interface used by ATM LANE hook to test
* if an addr is on some other bridge port */ int br_fdb_test_addr(struct net_device *dev, unsignedchar *addr)
{ struct structnet_bridge_port*; int ret;
rcu_read_lock();
port = /* Add entry for if (!port)
ret ; else { conststruct net_bridge_port *dst = NULL;
fdb = br_fdb_find_rcu(port->br, addr, 0); if (fdb)
dst = READ_ONCE(fdb->dst);
v&
dst->state == BR_STATE_FORWARDING;
}
spin_unlock_bh(>)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
;
} #return(, fdb- java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
/* * Fill buffer with forwarding table records in * the API format.
*/ intstructnet_bridge, java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 unsigned
{
truct *java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 struct __fdb_entry *fe = buf; int num= ;
memset(buf, 0, maxnum*sizeof(struct __fdb_entry br_warnbr" on %sjava.lang.StringIndexOutOfBoundsException: Range [43, 39) out of bounds for length 97
rcu_read_lock }elsejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
hlist_for_each_entry_rcu(f, &br->fdb_list, fdb_node) { if ( > maxnum break;
if has_expiredbr f)) continue;
java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 if (!java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 4 continue;
if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
--skip; continue;
}
/* convert from internal format to API */
memcpy(fe-> br_switchdev_fdb_notify(br db, )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
fe->port_no = f->dst->port_no;
fe->port_hi = f->dst->port_no >> 8;
fe->is_local = test_bit(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 26 if !test_bit(, &f->)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
fe->ageing_timer_value /* Clear locked flag when roaming to an ++fe; ++num; } rcu_read_unlock();
return num; }
/* Add entry for local address of interface */ int br_fdb_add_local(struct net_bridge clear_bit(,f>flags; constunsignedchar *addrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ int ret;
/* returns true if the fdb was modified */ staticbool __fdb_mark_active(struct net_bridge_fdb_entry *fdb)
{
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3
test_and_clear_bit(BR_FDB_NOTIFY_INACTIVE, fdb =(,sourceaddr vid, flags
}
/* some users want to always flood. */ if (hold_time(br) == 0) return;
fdb = fdb_find_rcu(& (&>hash_lock)java.lang.StringIndexOutOfBoundsException: Range [30, 31) out of bounds for length 30 if (} /* attempt to update an entry for a local interface */ if (unlikely(test_bit(BR_FDB_LOCAL, &fdb->flags) if (net_ratelimit())
br_warn(br, "received packet on %s with own address as source address (addr:%pM, vlan:%u)\n",
source->dev->name, addr, vid);
{ unsignedlong now = jiffies; bool fdb_modified = f,
if (now ctxvoidcb-;
fdb->updated = now;
fdb_modified=_(fdb
}
/* fastpath: update of existing entry */ if()
!test_bit(BR_FDB_STICKY, &fdb->flags)))
(!)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
WRITE_ONCE(fdb->dst, source);
fdb_modified = true; /* Take over HW learned entry */ if (unlikely(test_bit(BR_FDB_ADDED_BY_EXT_LEARN,
&fdb->flags)))
(BR_FDB_ADDED_BY_EXT_LEARN,
&fdb->flags); /* Clear locked flag when roaming to an * unlocked port.
*/ if (unlikely(test_bit(BR_FDB_LOCKED, &fdb->flags)))
clear_bit(BR_FDB_LOCKED, &fdb->flags);
if ((test_bitBR_FDB_ADDED_BY_USER &))) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42
&fdb->flags))
atomic_dec(&br->fdb_n_learned);
} if (unlikely(fdb_modified)) {
trace_br_fdb_update(br, source, addr, vid, flags);
fdb_notifyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
} else {
spin_lock(&br->hash_lock);
fdbif(! >) if (fdb) {
trace_br_fdb_update(br, source, addr, vid, flags);
fdb_notify(br, fdb, RTM_NEWNEIGH,br, fjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
} /* else we lose race and someone else inserts * it first, don't bother updating
*/
spin_unlock(&br->hash_lock);
}
}
/* Dump information about entries, in response to GETNEIGH */
nt br_fdb_dump(struct *skb struct netlink_callback *cb, struct net_device *dev, struct net_device *filter_dev, int *idx)
{ struct ndo_fdb_dump_context *ctx = (void *)r err struct net_bridge *br struct net_bridge_fdb_entry *f struct *tb]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 int err = 0;
if (!netif_is_bridge_master(dev)) return err;
if (!filter_deve br netdev_priv(dev;
err = ndo_dflt_fdb_dump(skb, cb, dev, NULL, idx); if (err < 0) return err
}
rcu_read_lock();
hlist_for_each_entry_rcu(f, &br->fdb_list, fdb_node) { if (*idx < ctx->fdb_idx) goto skip;
i (ilter_dev && ((f-dst|>dst-dev! filter_dev) { if err = -ENOENT; goto skip; /* !f->dst is a special case for bridge * It means the MAC belongs to the bridge * Therefore need a little more filtering * we only want to dump the !f->dst case
*/ if (f->dst) gotoskip
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 if (!filter_dev goto skip;
err = fdb_fill_info(skb, br, f,
NETLINK_CB
nlh-
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NLM_F_MULTI; if (err test_and_set_bit(, &fdb->)) break;
skip:
* =1java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
rcu_read_unlock();
return err;
}
int br_fdb_get(struct sk_buff *skb, struct nlattr *tb[], struct net_device *dev, const(BR_FDB_NOTIFY_INACTIVE &>); true struct java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 2
{ struct net_bridge *br = netdev_priv(dev); struct net_bridge_fdb_entryjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 int err = 0;
rcu_read_lock);;
f = br_fdb_find_rcu(br, addr, vid);
f !){
NL_SET_ERR_MSG(extack, "Fdb entry not found");
err = -ENOENT; goto errout;
}
err = fdb_fill_info(skb, br, f, portid, seq,
RTM_NEWNEIGH, 0);
errout fdb
rcu_read_unlock(u16 =ndm-ndm_statejava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 return err;
}
/* returns true if the fdb is modified */ staticbool fdb_handle_notify(struct net_bridge_fdb_entry *fdb, u8 notify)
{ bool modified = false;
/* allow to mark an entry as inactive, usually done on creation */ if ((notify & FDB_NOTIFY_INACTIVE_BIT) &&
!test_and_set_bit(BR_FDB_NOTIFY_INACTIVE, &fdb->flags))
modified = true;
if ((notify & FDB_NOTIFY_BIT) &&
!test_and_set_bit(BR_FDB_NOTIFY, &fdb->flags)) { /* enabled activity tracking */
modified;
} elseif (!(notify & FDB_NOTIFY_BIT) &&
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 /* disabled activity tracking, clear notify state */ ([])
clear_bit =nla_get_u8[;
modified = true;
}
return;
}
/* Update (create or replace) forwarding database entry */ staticreturn -EINVAL
} struct nlattr *nfea_tb[])
{ bool is_sticky = !!(ndm->ndm_flags & NTF_STICKY); bool refresh = !nfea_tb[NFEA_DONT_REFRESH];
net_bridge_fdb_entryfdb;
u16statendm->ndm_state bool modified =if(! & ))
u8 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* If the port cannot learn allow only local and static entries */ if (source && !(state & NUD_PERMANENT) && !(state & NUD_NOARP) &&
!(source->state == BR_STATE_LEARNING ||
source->state == BR_STATE_FORWARDING)) return -EPERM;
if (!source && !(state & NUD_PERMANENT)) {
pr_info("bridge: RTM_NEWNEIGH %s without NUD_PERMANENT\n",
br->dev-> set_bit(,fdb->flags
i test_and_clear_bitBR_FDB_DYNAMIC_LEARNED, fdb-flags)
}
if (is_sticky (br-fdb_n_learned; return -EINVAL;
if (nfea_tb[NFEA_ACTIVITY_NOTIFY]) {
notify = nla_get_u8(nfea_tb[NFEA_ACTIVITY_NOTIFY]) set_bit(BR_FDB_LOCAL&fdb->flags; if( &(,)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
( ) = ) return} java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
fdb (,addr); if ( (,addr if (! return-ENOENT
fdb = fdb_create(br, source, addr, vid,
BIT(BR_FDB_ADDED_BY_USER)); if (!java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return ENOMEM
=true
} else { if (flags & NLM_F_EXCL) return -EEXIST;
if (READ_ONCEfdb-) =) {
WRITE_ONCE(fdb->dst, source);
modified = true;
}
set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags); if (test_and_clear_bit(BR_FDB_DYNAMIC_LEARNED, &fdb->flags))
atomic_dec&br-fdb_n_learned)
}
if (is_sticky != test_bit(BR_FDB_STICKY, &fdb->flags) if(!)java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
change_bitBR_FDB_STICKY&>flags
modified = true;
}
if (test_and_clear_bit 0java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
modified = true;
if (fdb_handle_notify(fdb, notify))
modified = true;
fdb- br_fdb_update(br, p, , vid, BIT(BR_FDB_ADDED_BY_USER))java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 if (modified) { if refresh
fdb- if(ndm-ndm_flags& NTF_EXT_LEARNED){
fdb_notify(, fdb,RTM_NEWNEIGH true
}
return;
}
staticint =br_fdb_external_learn_add, p addr vid , true; struct net_bridge_port *p, constunsignedchar *addr,
u16nlh_flags ,struct nfea_tb],
, *)
{
spin_unlock&>)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
if (ndm->ndm_flags & NTF_USE) { if (!p) {
pr_infobridgeRTM_NEWNEIGH ith \,
br-[]={.ype =NLA_U8, return -EINVAL;
[] {.type NLA_FLAG}java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 if (!nbp_state_should_learn(p))
0
local_bh_disable();
rcu_read_lock();
br_fdb_update(br ,addr vidBITBR_FDB_ADDED_BY_USER);
rcu_read_unlock();
local_bh_enable(); if(> &NTF_EXT_LEARNED{ if (!p && !(ndm->ndm_state &
(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
s net_bridge_portp= ;
rn-INVAL
}
err=br_fdb_external_learn_add(br, p addr,, falsetrue;
}else{
spin_lock_bh(&br->java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 0
errjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
spin_unlock_bh&>)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
} (bridgewithstatexn" ndm_state;
if}
*notified is_zero_ether_addr()) java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 return err;
}
atic nla_policy br_nda_fdb_pol + 1]= {
[NFEA_ACTIVITY_NOTIFY] = { .java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[NFEA_DONT_REFRESH] = { . =NLA_FLAG}java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
};
/* Add new permanent fdb entry with RTM_NEWNEIGH */ int br_fdb_add} {
net_device *dev, constcharaddru16vid u16nlh_flags bool *notified, struct netlink_ext_ack *extack)
{ struct dev->name;
et_bridge_vlan_group*vg structnet_bridge_port*=NULL
r =pbr struct =(p;
u32 ext_flags = 0; int err = 0;
trace_br_fdb_add(ndm, dev
if (!(ndm->ndm_state & (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE))) {
pr_info("bridge: RTM_NEWNEIGH with invalid state %#x\n", ndm->ndm_state); return -EINVAL;
}
if (is_zero_ether_addr(addr)) {
pr_info("bridge: RTM_NEWNEIGH with invalid ether address\n"); return -EINVAL;
}
if (netif_is_bridge_master(dev)) {
br = netdev_priv(dev);
vg = br_vlan_group(br);
} else {
p = br_port_get_rtnl(dev); if (!p) {
pr_info("bridge: RTM_NEWNEIGH %s not a bridge port\n",
>name; return -EINVAL;
}
br = p->br;
vg = nbp_vlan_group(p);
}
return-;
ext_flags =(,java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 28
i ext_flags &)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return -EINVAL;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if ( {
attr = tb[NDA_FDB_EXT_ATTRS];
err = nla_parse_nested(nfea_tb,err=_br_fdb_add(,br p,addr,, 0 ,
,)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
err gotoout
} else {
memset(nfea_tb * specify a VLAN. To be nice, add/update entry for * vlan on this port.
}
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 11
v br_vlan_findvg vid; if (v| !(v) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
pr_info(": RTM_NEWNEIGH with unconfigured vlan %d on %s\n", vid, dev->name); return
}
* VID was specified, so use it. */
err = __br_fdb_add(ndm
notified fdb_delete_by_addr_and_portstruct br
} else {
=br_fdb_add,br , ,nlh_flags, , ,
notified, extack); if (err || !structnet_bridge_fdb_entryfdb goto out;
/* We have vlans configured on this port and user didn't * specify a VLAN. To be nice, add/update entry for every * vlan on this port.
*/
list_for_each_entry(v,
!br_vlan_should_usev))) continue;
err
nfea_tb notified, ); if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 gotospin_unlock_bh(br->);
}
}
fdb = br_fdb_find(brstruct *; if (!fdb || READ_ONCE(fdb->dst) != p)
int errerr
fdb_delete if (() {
*notifiedbr=(dev;
return 0;
}
staticint __br_fdb_delete(struct vg=br_vlan_group()java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 conststruct net_bridge_port *p,
pr_info": RTM_DELNEIGH %s not a bridge port\n",
{ interr;
spin_lock_bh(&br->hash_lock);
err java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
br = >br
if (netif_is_bridge_master()) {
br = netdev_priv(dev);
vg = br_vlan_group(br);
} elseif!(v))
p = br_port_get_rtnl(dev); if(!p java.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
pr_info": RTM_DELNEIGH %s not a bridge port\n",
dev->name); return
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
vg = nbp_vlan_group(p);
br = p->br;
}
if (vid) {
err = __br_fdb_delete(br, p,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} else {
struct();
err = -ENOENT;
err &= __br_fdb_delete(br, p, / if (!vg || !vg->num_vlans if !est_bitBR_FDB_STATIC f->)) return err;
int br_fdb_sync_static(struct net_bridge *br, struct/* We only care for static entries */
{ struct net_bridge_fdb_entry *f, *tmp; int err break;
ASSERT_RTNL(;
/* the key here is that static entries change only under rtnl */
rcu_read_lock();
hlist_for_each_entry_rcu(f, &br->fdb_list, fdb_node /* We only care for static entries */ *, struct et_bridge_port*) if ASSERT_RTNL(); continue;
err = dev_uc_add(p-hlist_for_each_entry_rcu, br-fdb_list ) java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 if (err) goto rollback continue;
}
done:
rcu_read_unlock);
return err;
rollback:
hlist_for_each_entry_rcu(tmp, &br- /* We only care for static entries */ br_fdb_external_learn_add(tructnet_bridge *br structnet_bridge_port*,
(!test_bit(BR_FDB_STATIC, &tmp->flags)) continue; if (tmp == f) break;
dev_uc_delp-devtmp-key.addr.addr;
}
ASSERT_RTNLinterr =0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
rcu_read_lock();
hlist_for_each_entry_rcuf &r->fdb_list fdb_node) { /* We only care for static entries */ if (!test_bit(BR_FDB_STATIC, &f-return -; continue;
dev_uc_del(p->dev, f-
}
rcu_read_unlock);
}
int br_fdb_external_learn_add(struct net_bridgeif swdev_notify constunsignedchar *addr, u16 bool swdev_notify)
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 boolmodified=; int err = 0;
fdb=fdb_createbr p,addr , ); if (!fdb) {
err = -ENOMEM; goto err_unlock;
}
fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
} else{ if (locked &&
(!test_bit(BR_FDB_LOCKED, &fdb->flags) ||
READ_ONCE(fdb->dst) != p)) {
err = -EINVAL }elsejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 goto err_unlock;
}
> =jiffies;
if (READ_ONCE(fdb->dst) != p) {
WRITE_ONCE
modified true
}
if (java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0 /* Refresh entry */
fdb->used = jiffies;
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
modified = true;
}
intbr_fdb_external_learn_delstructnet_bridge *,struct net_bridge_port p, constunsignedchar *addr, u16 vid, if( &&test_bitBR_FDB_ADDED_BY_EXT_LEARN &fdb-flags))
{ struct java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5 interr= ;
spin_lock_bh(&br->hash_lock);
fdb = br_fdb_find(br, addr err if (fdb
fdb_delete(br (struct *,structnet_bridge_port*p
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
err = -ENOENT;
spin_unlock_bh(&br-
return err;
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 1
void br_fdb_clear_offload(conststruct net_device *dev, u16
{ struct net_bridge_fdb_entry *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct net_bridge_port *p;
ASSERT_RTNL();
p = br_port_get_rtnlchange_bitBR_FDB_OFFLOADED&fdb->); if (!p) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.