In yesterday's article , I make complaints about it. Linux Incomplete design of various virtual network cards , Just make complaints about it. , I didn't mean anything else , I'm too lazy to do some hack To avoid these imperfections , I just want to make complaints about it .

last night , Some netizens asked me to give some solutions , Because he also encountered this problem :

* He wants to be bonding Of eth0 Can work independently , yes , As a management port .
therefore , This friend asked me to give a solution , I realize the universality of this need , And not everyone wants to configure something macvlan,ipvlan Of , therefore , I just want to write more .

In my environment :

* enp0s9 cover bonding reach bond0.
* I hope bond0 handle Of traffic .
* I hope enp0s9 handle Of traffic .
* I do not want the above communications to be subject to bonding Of mode.
So let's get started .

Let's see why we are in the enp0s9 cover bonding It doesn't work after that ,stap I can see it all at once , Look at the phenomenon first :
[root@localhost bond]# arp -n Address HWtype HWaddress Flags Mask Iface ether 0a:00:27:00:00:00 C enp0s8[root@localhost bond]# ping
PING 56(84) bytes of data. From icmp_seq=1
Destination Host Unreachable From icmp_seq=2 Destination Host
Unreachable From icmp_seq=3 Destination Host Unreachable From
icmp_seq=4 Destination Host Unreachable ^C --- ping statistics --- 4
packets transmitted, 0 received, +4 errors, 100% packet loss,time 2999ms pipe 4
[root@localhost bond]# arp -n Address HWtype HWaddress Flags Mask Iface
(incomplete) enp0s9 ether 0a:00:27:00:00:00 C enp0s8
It's clear, isn't it ?

Look again stap The output of :
[root@localhost bond]# stap -e 'probe kernel.function("arp_process"){name =
kernel_string($skb->dev->name); printf("%s\n", name);}' bond0 bond0 bond0
Oh,yes!arp cover bond0 Took over ,enp0s9 As slave Independent network card is no longer present .

What should I do? ? It's changed !

Here I think it is bonding Itself and its rx_handler There is a problem with the implementation !! use MAC Just distinguish the address ??
master hold slave Shielding itself is not reasonable !!

good , I follow my usage scenarios , Changed it , first , I take as master Of bond0 And as slave Of enp0s9 Of MAC Address discrimination , Set separately , Then modify it arp_process Processing logic of :
%{ #include <linux/module.h> #include <net/bonding.h> %} function change_indev:
long(skb:long) %{ struct sk_buff *_skb = (struct sk_buff *)STAP_ARG_skb;
STAP_PRINTF(" aa :%s\n", _skb->dev->name); if (!strcmp(_skb->dev->name, "bond0")
) { struct bonding *bond = netdev_priv(_skb->dev); struct slave *curr = bond->
curr_active_slave; STAP_PRINTF(" aa :%s\n", curr->dev->name); // Change the reception device that will do
_skb->dev = curr->dev; } %} probe kernel.function("arp_process") { change_indev(
$skb); } probe begin { }
OK, Once more :
[root@localhost bond]# stap -g ./probe.stp WARNING: side-effect-free probe:
keyword at ./probe.stp:27:1 source: probe begin ^ aa :bond0 aa :enp0s9 ^C^[[A[
start ping bar :
[root@localhost bond]# ping PING ( 56(84) bytes of
data. 64 bytes from icmp_seq=1 ttl=64 time=0.480 ms 64 bytes from icmp_seq=2 ttl=64 time=0.417 ms ^C --- ping statistics --- 2
packets transmitted, 2 received, 0% packet loss,time 1001ms rtt min/avg/max/mdev
= 0.417/0.448/0.480/0.037 ms
Yes .

These are small problems , It's easy to solve , One might say , Configure one macvlan Doesn't it smell good ? ha-ha , I don't think it's a problem at all .

I don't know if it hurts , General rule no pain , If it doesn't work, just straighten it out , What else , I don't care .

You can tell 1000 There's a reason why it's unreasonable , You can tell 1000 There are reasons to justify this , How to put it? ? It's all leather shoes .

Zhejiang Wenzhou shoes wet , Rain and water will not make you fat !

©2019-2020 Toolsou All rights reserved,
Digital rolling lottery program Keras Save and load model (JSON+HDF5) Remember once EventBus Project issues caused by memory leaks I've been drinking soft water for three years ? What is the use of soft water and water softener msf Generate Trojan horse attack android mobile phone Time conversion front desk will 2020-07-17T03:07:02.000+0000 Into 2020-07-17 11:07:02 Chuan Shen 1190 Reverses the substring between each pair of parentheses leetcodehive Summary of processing methods for a large number of small files SparkSQL Achieve partition overlay write Image format conversion