Table des matières
- 2026:
- 2025:
4 billet(s) pour septembre 2026
| Notes HTTP Strict Transport Security - HSTS | 2026/09/18 11:04 | Jean-Baptiste |
| Notes GNU Linux GPU carte graphiques | 2026/09/08 15:49 | Jean-Baptiste |
| Notes GNU Linux graphique | 2026/09/08 15:42 | Jean-Baptiste |
| Notes urlencoding - passer des mots de passe en HTTPS | 2026/09/03 17:58 | Jean-Baptiste |
Network - How to retrieve packet drop reasons in the Linux kernel
Voir aussi :
Understanding why a packet drops in the Linux kernel is not always easy. The networking stack is wide and reasons to refuse a given packet are multiple and include invalid data from a protocol, firewall rules, wrong checksum, full queues, qdisc or XDP actions, and many more reasons. It is possible to look at indicators such as MIB counters and statistic counters, but often those are generic and triggered for different reasons, but most importantly their coverage is small, and it's impossible to match a specific packet to a given counter increase.
Socket buffer drop reasons
The socket buffer, SKB (struct sk_buff) is the main data structure representing a packet in the Linux kernel networking stack. When a packet is dropped in the Linux kernel, in most cases, it means its associated socket buffer has dropped. In recent versions of the Linux kernel, starting in v5.17, socket buffers can be dropped with an associated reason. This was introduced in upstream commit c504e5c2f964 (“net: skb: introduce kfree_skb_reason()”).
Using this commit and later additions, kernel developers are now able to specify why a given packet dropped. In the following example, a packet is dropped because no socket was found:
- kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_NO_SOCKET);
Using tools to retrieve drop reasons
The SKB drop reason can be retrieved in a few different ways, depending on which you are comfortable using, what is available on a given system, and the end goal (some solutions have more flexibility than others).
The main interface to retrieve the drop reason is the skb:kfree_skb tracepoint. It provides a user readable text for all drop reasons. A good way to attach to this tracepoint is to use perf as follows:
# perf record -e skb:kfree_skb curl https://localhost # given no server listens on localhost:443/tcp.
# perf script
curl 883 [001] 340.799805: skb:kfree_skb: skbaddr=0xffff88811f6a7068 protocol=2048 location=tcp_v4_rcv+0x157 reason: NO_SOCKET
curl 883 [001] 340.800860: skb:kfree_skb: skbaddr=0xffff88811f6a6de8 protocol=34525 location=tcp_v6_rcv+0x137 reason: NO_SOCKET
You can see why the two packets where dropped in tcp_v4_rcv and tcp_v6_rcv because no socket was found and we do not have a server listening on localhost:443/tcp.
We can also use other tools such as bpftrace to get the drop reason, which would give us more flexibility, the drawback being the reason isn't converted to a human readable string:
# bpftrace -e 'tracepoint:skb:kfree_skb {printf("%s: %d\n", comm, args->reason)}' -c 'curl https://localhost'
Attaching 1 probe...
curl: 3
curl: 3
curl: (7) Failed to connect to localhost port 443 after 2 ms: Couldn't connect to server
Another method is the dropwatch, an interactive tool to monitor packets dropped in the Linux kernel. When using the packet alert mode, drop reasons are included.
# dropwatch -l kas Initializing kallsyms db dropwatch> set alertmode packet Setting alert mode Alert mode successfully set dropwatch> start Enabling monitoring... Kernel monitoring activated. Issue Ctrl-C to stop monitoring drop at: tcp_v4_rcv+0x157/0x1630 (0xffffffff8abc4f87) origin: software input port ifindex: 1 timestamp: Thu Feb 23 18:03:36 2023 370138884 nsec protocol: 0x800 length: 74 original length: 74 drop reason: NO_SOCKET drop at: tcp_v6_rcv+0x137/0x14f0 (0xffffffff8ad91b37) origin: software input port ifindex: 1 timestamp: Thu Feb 23 18:03:36 2023 372335338 nsec protocol: 0x86dd length: 94 original length: 94 drop reason: NO_SOCKET
Note:The skb_drop_reason enum defines core drop reasons. It is an internal definition, and the actual value of all its members is not guaranteed to be constant over time. This feature is recent and some of the drop reasons were reordered during development. There is also work ongoing for supporting drop reasons from different subsystems. You should either use tools directly providing the drop reason in a text format (perf or dropwatch) or take the right drop reasons definition as a reference when retrieving the drop reason in a numeric way (bpftrace).
Summary
Not all drop places in the Linux kernel are covered. Converting them to this new facility takes time and resources. There is progress upstream with more additions. Currently, more than 70 reasons are supported. There is also an effort to support more than the core networking subsystem.
SKB drop reasons are now available in Red Hat Enterprise Linux starting with RHEL 8.8 and RHEL 9.2.
Commande nbtstat sous GNU/Linux ?
Voir aussi : nbtscan
Nbtstat est une commande sous ouidoze qui : “Affiche les statistiques du protocole et les connexions TCP/IP actuelles utilisant NBT (NetBIOS sur TCP/IP)”
Les options '-A' et '-a' sont couramment utilisées :
- -a (état carte) Liste la table de noms de l'ordinateur distant (nom connu).
- -A (état carte) Liste la table de noms d'ordinateurs distants (adresse IP).
Équivalent sous GNU/Linux
Sous ouindoze
nbtstat -A 192.168.1.22
Sous GNU/Linux
nmblookup -A 137 192.168.1.22
sudo nmap -sU --script nbstat.nse -p 137 192.168.1.22
Source : nbstat.html
Notes
Voir aussi
sudo nmap -T5 -PN -p 445 -sS -n --min-hostgroup 8192 --min-rtt-timeout 1000ms \ --min-parallelism 4096 --script=nbstat <target>
Source : https://blog.skullsecurity.org/2009/nbstatnse-a-replacement-for-nbtscan-and-others
Sous ouindoze
nbtstat -a COMPUTERNAME
Sous GNU/Linux
nmap -p 445 -Pn -script=smb-os-discovery COMPUTERNAME
Pb
J'ai l'erreur suivante avec nmap 5.00 (Debian squeeze) :
Illegal Argument to -P, use -PN, -PO, -PI, -PB, -PE, -PM, -PP, -PA, -PU, -PT, or -PT80 (or whatever number you want for the TCP probe destination port) QUITTING!
Mais ça fonctionne avec nmap 6.00 (Debian Wheezy)
using-smb-sniffing-to-determine-targets-host-name-domain-os-version-system-time-and-time-zone
Voir le paquet Debian apt:nbtscan
Nb de jour entre deux date
Voir
Voir aussi
- Remind calendrier_agenda_remind
!! Attention, les dates doivent être au format yankee MM/DD/YY
Il vaut mieux utiliser la notation YYYY-MM-DD à la place de MM/DD/YY qui est équivoque.
echo $(( ($(date "+%s" --date 04/05/15) - $(date "+%s"))/86400 ))
echo $(( ($(date "+%s" --date 04/05/15) - $(date "+%s" --date $(date "+%m/%d") ))/86400 ))
$ echo $(( ($(date "+%s" --date 2024-10-01) - $(date "+%s" --date 2024-07-08 ))/86400 )) 85 $ date -d "2024-07-08 + 85 days" mar. 01 oct. 2024 00:00:00 CEST
Ajouter où soustraire des jours à une date
33 jours avant l'Annonciation
$ date -d "03/25/20 - 33 days" Fri Feb 21 00:00:00 CET 2020
9 mois après l'Annonciation
$ date -d "03/25/20 + 9 month" Fri Dec 25 00:00:00 CET 2020
MySQL / MariaDB - Reset root pasword
Méthode 1
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -uroot
USE mysql; -- UPDATE user SET authentication_string=PASSWORD("mynewpassword") WHERE User='root'; UPDATE USER SET Password=PASSWORD("mynewpassword") WHERE USER='root'; FLUSH PRIVILEGES; QUIT
Pb MP3 sous tel Nokia
Voir :
message d'erreur Nokia :
Cet appareil supporte les formats MP3 standard à partir de 32 ko/s
apt-get update && apt-get install lame moreutils
lame --resample 32 origine.mp3 nouveaufichier.mp3
Ou si vous le voulez pas garder les originaux. Attention, faites une copie de vos mp3 avant !
lame --resample 32 /tmp/test/musique.mp3 - | sponge /home/test/musique.mp3
En effet sponge permet des choses du genre :
sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd
Voir http://joeyh.name/code/moreutils/
Voici une solution pas très lisible, et qui à l’inconvénient d'être très lente, car les musiques sont converti les une après les autres
Jouons avec notre ami xarg http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility/
find BIBLE -type f -iname "*.mp3" -print0 | xargs -0 -I {} echo lame --resample 32 \'{}\' - \|sponge \'{}\' | bash -s --
Tout d'un coup, à la bourrin (grâce à \&)
find BIBLE -type f -iname "*.mp3" -print0 | xargs -0 -I {} echo lame --resample 32 \'{}\' - \|sponge \'{}\' \& | bash -s --
Attention aux ulimits !
$ pgrep -c lame 1130
$ uptime 20:45:38 up 10:27, 7 users, load average: 685,42, 508,58, 241,19
Ce n'est pas une brillante idée ! Aucunne gestion d'erreur, si un traitement ce passe mal. Bien que la charge CPU (load average) soit impressionnante, je n'ai pas vraiment constaté un ralentissement de mon PC.
Entre faire un traitement, l'un après l'autre. Ou à tous lancer d'un coup. C'est passer d'un extrême à l'autre.
En toutes logique il faut grouper ces traitements dans des lots. En général que un quadcore on lance 4 traitement simultané. Le double si hyperThreading. C'est une approximation à tester.
Note : Il n’était pas pertinent de laisser l'affichage sur la sortie standards et cela peut ralentir les traitements.
Nous pouvons utiliser le commande “parallel”. Le pb sous Debian, c'est qu'il existe deux commande “parallel”
# apt-file search /usr/bin/parallel | grep "/usr/bin/parallel$" moreutils: /usr/bin/parallel parallel: /usr/bin/parallel
Voir https://wiki.archlinux.org/index.php/Convert_Flac_to_Mp3
Autres
Conversion WAV en MP3
for fic in *.wav ; do ffmpeg -i "$fic" -ar 24000 -ac 1 "${fic/.wav/.mp3}" ; done
