Lines Matching +full:1 +full:br +full:- +full:10

1 // SPDX-License-Identifier: GPL-2.0-or-later
35 struct net_device *indev, *brdev = BR_INPUT_SKB_CB(skb)->brdev; in br_pass_frame_up()
36 struct net_bridge *br = netdev_priv(brdev); in br_pass_frame_up() local
39 dev_sw_netstats_rx_add(brdev, skb->len); in br_pass_frame_up()
41 vg = br_vlan_group_rcu(br); in br_pass_frame_up()
53 if (!(brdev->flags & IFF_PROMISC) && in br_pass_frame_up()
59 indev = skb->dev; in br_pass_frame_up()
60 skb->dev = brdev; in br_pass_frame_up()
61 skb = br_handle_vlan(br, NULL, vg, skb); in br_pass_frame_up()
65 br_multicast_count(br, NULL, skb, br_multicast_igmp_type(skb), in br_pass_frame_up()
68 BR_INPUT_SKB_CB(skb)->promisc = promisc; in br_pass_frame_up()
78 struct net_bridge_port *p = br_port_get_rcu(skb->dev); in br_handle_frame_finish()
86 struct net_bridge *br; in br_handle_frame_finish() local
94 br = p->br; in br_handle_frame_finish()
96 if (br_mst_is_enabled(br)) { in br_handle_frame_finish()
99 if (p->state == BR_STATE_DISABLED) in br_handle_frame_finish()
102 state = p->state; in br_handle_frame_finish()
105 brmctx = &p->br->multicast_ctx; in br_handle_frame_finish()
106 pmctx = &p->multicast_ctx; in br_handle_frame_finish()
107 if (!br_allowed_ingress(p->br, nbp_vlan_group_rcu(p), skb, &vid, in br_handle_frame_finish()
111 if (p->flags & BR_PORT_LOCKED) { in br_handle_frame_finish()
113 br_fdb_find_rcu(br, eth_hdr(skb)->h_source, vid); in br_handle_frame_finish()
119 if (p->flags & BR_PORT_MAB) in br_handle_frame_finish()
120 br_fdb_update(br, p, eth_hdr(skb)->h_source, in br_handle_frame_finish()
123 } else if (READ_ONCE(fdb_src->dst) != p || in br_handle_frame_finish()
124 test_bit(BR_FDB_LOCAL, &fdb_src->flags)) { in br_handle_frame_finish()
127 } else if (test_bit(BR_FDB_LOCKED, &fdb_src->flags)) { in br_handle_frame_finish()
131 br_fdb_update(br, p, eth_hdr(skb)->h_source, vid, in br_handle_frame_finish()
140 if (p->flags & BR_LEARNING) in br_handle_frame_finish()
141 br_fdb_update(br, p, eth_hdr(skb)->h_source, vid, 0); in br_handle_frame_finish()
143 promisc = !!(br->dev->flags & IFF_PROMISC); in br_handle_frame_finish()
146 if (is_multicast_ether_addr(eth_hdr(skb)->h_dest)) { in br_handle_frame_finish()
148 if (is_broadcast_ether_addr(eth_hdr(skb)->h_dest)) { in br_handle_frame_finish()
161 BR_INPUT_SKB_CB(skb)->brdev = br->dev; in br_handle_frame_finish()
162 BR_INPUT_SKB_CB(skb)->src_port_isolated = !!(p->flags & BR_ISOLATED); in br_handle_frame_finish()
165 (skb->protocol == htons(ETH_P_ARP) || in br_handle_frame_finish()
166 skb->protocol == htons(ETH_P_RARP))) { in br_handle_frame_finish()
167 br_do_proxy_suppress_arp(skb, br, vid, p); in br_handle_frame_finish()
169 skb->protocol == htons(ETH_P_IPV6) && in br_handle_frame_finish()
170 br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED) && in br_handle_frame_finish()
173 ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) { in br_handle_frame_finish()
178 br_do_suppress_nd(skb, br, vid, p, msg); in br_handle_frame_finish()
186 if ((mdst && mdst->host_joined) || in br_handle_frame_finish()
189 DEV_STATS_INC(br->dev, multicast); in br_handle_frame_finish()
194 DEV_STATS_INC(br->dev, multicast); in br_handle_frame_finish()
198 dst = br_fdb_find_rcu(br, eth_hdr(skb)->h_dest, vid); in br_handle_frame_finish()
207 if (test_bit(BR_FDB_LOCAL, &dst->flags)) in br_handle_frame_finish()
210 if (now != dst->used) in br_handle_frame_finish()
211 dst->used = now; in br_handle_frame_finish()
212 br_forward(dst->dst, skb, local_rcv, false); in br_handle_frame_finish()
215 br_flood(br, skb, pkt_type, local_rcv, false, vid); in br_handle_frame_finish()
233 struct net_bridge_port *p = br_port_get_rcu(skb->dev); in __br_handle_local_finish()
237 if ((p->flags & BR_LEARNING) && in __br_handle_local_finish()
239 !br_opt_get(p->br, BROPT_NO_LL_LEARN) && in __br_handle_local_finish()
241 br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, 0); in __br_handle_local_finish()
249 /* return 1 to signal the okfn() was called so it's ok to use the skb */ in br_handle_local_finish()
250 return 1; in br_handle_local_finish()
262 net = dev_net(skb->dev); in nf_hook_bridge_pre()
268 e = rcu_dereference(net->nf.hooks_bridge[NF_BR_PRE_ROUTING]); in nf_hook_bridge_pre()
273 NFPROTO_BRIDGE, skb->dev, NULL, NULL, in nf_hook_bridge_pre()
276 for (i = 0; i < e->num_hook_entries; i++) { in nf_hook_bridge_pre()
277 verdict = nf_hook_entry_hookfn(&e->hooks[i], skb, &state); in nf_hook_bridge_pre()
280 if (BR_INPUT_SKB_CB(skb)->br_netfilter_broute) { in nf_hook_bridge_pre()
290 if (ret == 1) in nf_hook_bridge_pre()
298 net = dev_net(skb->dev); in nf_hook_bridge_pre()
301 br_handle_frame_finish(dev_net(skb->dev), NULL, skb); in nf_hook_bridge_pre()
306 /* Return 0 if the frame was not processed otherwise 1
314 hlist_for_each_entry_rcu(tmp, &p->br->frame_type_list, list) in br_process_frame_type()
315 if (unlikely(tmp->type == skb->protocol)) in br_process_frame_type()
316 return tmp->frame_handler(p, skb); in br_process_frame_type()
329 const unsigned char *dest = eth_hdr(skb)->h_dest; in br_handle_frame()
331 if (unlikely(skb->pkt_type == PACKET_LOOPBACK)) in br_handle_frame()
334 if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) in br_handle_frame()
341 memset(skb->cb, 0, sizeof(struct br_input_skb_cb)); in br_handle_frame()
344 p = br_port_get_rcu(skb->dev); in br_handle_frame()
345 if (p->flags & BR_VLAN_TUNNEL) in br_handle_frame()
349 u16 fwd_mask = p->br->group_fwd_mask_required; in br_handle_frame()
352 * See IEEE 802.1D Table 7-10 Reserved addresses in br_handle_frame()
355 * Bridge Group Address 01-80-C2-00-00-00 in br_handle_frame()
356 * (MAC Control) 802.3 01-80-C2-00-00-01 in br_handle_frame()
357 * (Link Aggregation) 802.3 01-80-C2-00-00-02 in br_handle_frame()
358 * 802.1X PAE address 01-80-C2-00-00-03 in br_handle_frame()
360 * 802.1AB LLDP 01-80-C2-00-00-0E in br_handle_frame()
364 fwd_mask |= p->group_fwd_mask; in br_handle_frame()
369 if (p->br->stp_enabled == BR_NO_STP || in br_handle_frame()
370 fwd_mask & (1u << dest[5])) in br_handle_frame()
380 fwd_mask |= p->br->group_fwd_mask; in br_handle_frame()
381 if (fwd_mask & (1u << dest[5])) in br_handle_frame()
389 fwd_mask |= p->br->group_fwd_mask; in br_handle_frame()
390 if (fwd_mask & (1u << dest[5])) in br_handle_frame()
394 BR_INPUT_SKB_CB(skb)->promisc = false; in br_handle_frame()
397 * - returns < 0 (drop/error) in br_handle_frame()
398 * - returns = 0 (stolen/nf_queue) in br_handle_frame()
399 * Thus return 1 from the okfn() to signal the skb is ok to pass in br_handle_frame()
402 dev_net(skb->dev), NULL, skb, skb->dev, NULL, in br_handle_frame()
403 br_handle_local_finish) == 1) { in br_handle_frame()
414 if (br_mst_is_enabled(p->br)) in br_handle_frame()
417 switch (p->state) { in br_handle_frame()
421 if (ether_addr_equal(p->br->dev->dev_addr, dest)) in br_handle_frame()
422 skb->pkt_type = PACKET_HOST; in br_handle_frame()
452 void br_add_frame(struct net_bridge *br, struct br_frame_type *ft) in br_add_frame() argument
454 hlist_add_head_rcu(&ft->list, &br->frame_type_list); in br_add_frame()
457 void br_del_frame(struct net_bridge *br, struct br_frame_type *ft) in br_del_frame() argument
461 hlist_for_each_entry(tmp, &br->frame_type_list, list) in br_del_frame()
463 hlist_del_rcu(&ft->list); in br_del_frame()