All Projects → raminfp → linux-4.8.0-netfilter_icmp

raminfp / linux-4.8.0-netfilter_icmp

Licence: other
Anatomy of a linux kernel development

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
assembly
5116 projects
Makefile
30231 projects
shell
77523 projects
perl
6916 projects

Projects that are alternatives of or similar to linux-4.8.0-netfilter icmp

Embedded-Linux-Education-Kit
Embedded Linux Education Kit
Stars: ✭ 66 (+153.85%)
Mutual labels:  linux-kernel
ebpfkit
ebpfkit is a rootkit powered by eBPF
Stars: ✭ 472 (+1715.38%)
Mutual labels:  linux-kernel
wingkalabs
Wingkalabs (Linux) Wingkalabs es una máquina Virtual Linux intencionalmente vulnerable. Esta máquina virtual se puede utilizar para realizar entrenamientos de seguridad, probar herramientas de seguridad y practicar técnicas comunes de pruebas de penetración.
Stars: ✭ 16 (-38.46%)
Mutual labels:  linux-kernel
novaboot
A tool that automates booting of operating systems on target hardware or in qemu
Stars: ✭ 32 (+23.08%)
Mutual labels:  linux-kernel
natick
natickOS - A minimal, lightweight, research Linux Distribution
Stars: ✭ 33 (+26.92%)
Mutual labels:  linux-kernel
ebpfkit-monitor
ebpfkit-monitor is a tool that detects and protects against eBPF powered rootkits
Stars: ✭ 80 (+207.69%)
Mutual labels:  linux-kernel
Umbra
A LKM rootkit targeting 4.x and 5.x kernel versions which opens a backdoor that can spawn a reverse shell to a remote host, launch malware and more.
Stars: ✭ 98 (+276.92%)
Mutual labels:  linux-kernel
linux-insides Turkish
Turkish version of linux-insides book @0xAX
Stars: ✭ 65 (+150%)
Mutual labels:  linux-kernel
mbp-fedora-kernel
No description or website provided.
Stars: ✭ 57 (+119.23%)
Mutual labels:  linux-kernel
Linux-Kernel-Driver-Programming
Implementation of PCI drivers, kprobe, sysfs, devfs, sensor driver, miscdevices, synchronization
Stars: ✭ 43 (+65.38%)
Mutual labels:  linux-kernel
linux-insides-spanish
Un poco de información acerca del kernel Linux
Stars: ✭ 118 (+353.85%)
Mutual labels:  linux-kernel
kernel pendulum sdm845
Pendulum Kernel (old Rebirth) based on LE.UM.3.2.2.r1.1 CAF with google-common merged in for Xiaomi Poco F1 and Mi 8 with LTO, CFI and SCS enabled.
Stars: ✭ 9 (-65.38%)
Mutual labels:  linux-kernel
awesome-gnu-linux-gaming
A curated list of awesome GNU/Linux tips & tricks, games, tools, and resources - Mirrored from: https://gitlab.com/linuxcafefederation/awesome-gnu-linux-gaming.git
Stars: ✭ 135 (+419.23%)
Mutual labels:  linux-kernel
drop-tcp-sock
This module allows one to kill TCP sockets (including TIME-WAIT state).
Stars: ✭ 58 (+123.08%)
Mutual labels:  linux-kernel
linux-insides-ja
Japanese version of linux-insides book
Stars: ✭ 99 (+280.77%)
Mutual labels:  linux-kernel
devheart
Listen to Tux's heartbeat with this awesome Linux Kernel Module ❤️
Stars: ✭ 58 (+123.08%)
Mutual labels:  linux-kernel
LinuxKernelLearn
Learn Linux Kernel Step by Step, including the Modules, FS, Device Driver etc. --- Linux内核学习,包括Linux各模块,文件系统,设备驱动文件等。
Stars: ✭ 37 (+42.31%)
Mutual labels:  linux-kernel
portablebpf
You came here so you could have a base code to serve you as an example on how to develop a BPF application, compatible to BCC and/or LIBBPF, specially LIBBPF, having the userland part made in C or PYTHON.
Stars: ✭ 32 (+23.08%)
Mutual labels:  linux-kernel
lkm-sandbox
Collection of Linux Kernel Modules and PoC to discover, learn and practice Linux Kernel Development
Stars: ✭ 36 (+38.46%)
Mutual labels:  linux-kernel
rtw88-usb
rtw88 family usb driver for linux rtl8723du rtl8822bu rtl8821cu rtl8822cu
Stars: ✭ 40 (+53.85%)
Mutual labels:  linux-kernel

Anatomy of a linux kernel development

Questions :

  1. How to work kernel code?
  2. How to write C code on the kernel?
  3. How to building and install the kernel on old version linux?
  4. How to release the linux kernel?
  5. How to fixes bugs on kernel trees?

I going to write sample C kernel code the answer all question of the linux kernel and you learning write your own code on linux kernel and build it,

1- Downloading repo linux-4.8.0-netfilter_icmp :

root@raminfp ~# cd /tmp/
root@raminfp /tmp# 
root@raminfp /tmp# git clone https://github.com/raminfp/linux-4.8.0-netfilter_icmp

2- We added sample module netfilter_icmp in the linux kernel:

root@raminfp /tmp/linux-4.8.0# ls
arch/   COPYING  debian.master/  firmware/  ipc/     lib/         net/            samples/        sound/   usr/
block/  CREDITS  Documentation/  fs/        Kbuild   MAINTAINERS  README          scripts/        spl/     virt/
build/  crypto/  drivers/        include/   Kconfig  Makefile     README.md       security/       tools/   zfs/
certs/  debian/  dropped.txt     init/      kernel/  mm/          REPORTING-BUGS  snapcraft.yaml  ubuntu/
root@raminfp /tmp/linux-4.8.0# cd net/netfilter_icmp/
root@raminfp /tmp/linux-4.8.0/netfilter_icmp# 
root@raminfp /tmp/linux-4.8.0/netfilter_icmp# ls
Kconfig  Makefile  netfilter_icmp.c
root@raminfp /tmp/linux-4.8.0/netfilter_icmp# 

we see netfilter_icmp.c here when you build and install this kernel you are unable to connect to ping google.com, with this code able to drop icmp packet on RING 0,

we see Kconfig file for configuration menuconfig and define Makefile for compile object,

  • back to net directory,
root@raminfp /tmp/linux-4.8.0/net# pwd
/tmp/linux-4.8.0/net
root@raminfp /tmp/linux-4.8.0/net# ls
6lowpan/    ax25/        ceph/     dns_resolver/  ipv6/    key/       mac802154/       netlabel/     phonet/  sched/        tipc/       xfrm/
802/        batman-adv/  compat.c  dsa/           ipx/     l2tp/      Makefile         netlink/      qrtr/    sctp/         unix/
8021q/      bluetooth/   core/     ethernet/      irda/    l3mdev/    mpls/            netrom/       rds/     socket.c      vmw_vsock/
9p/         bridge/      dcb/      hsr/           iucv/    lapb/      ncsi/            nfc/          rfkill/  sunrpc/       wimax/
appletalk/  caif/        dccp/     ieee802154/    kcm/     llc/       netfilter/       openvswitch/  rose/    switchdev/    wireless/
atm/        can/         decnet/   ipv4/          Kconfig  mac80211/  netfilter_icmp/  packet/       rxrpc/   sysctl_net.c  x25/

we see all source directory net, now we need config file Makefile and Kconfig,

Now we should define function name of file header netfilter_icmp.c

root@raminfp /tmp/linux-4.8.0/include# cd net/
root@raminfp /tmp/linux-4.8.0/include//net# ls
6lowpan.h        cls_cgroup.h    flow_dissector.h         inetpeer.h            llc.h             net_ratelimit.h  sock.h
9p/              codel.h         flow.h                   inet_sock.h           llc_if.h          netrom.h         sock_reuseport.h
act_api.h        codel_impl.h    fou.h                    inet_timewait_sock.h  llc_pdu.h         nexthop.h        Space.h
addrconf.h       codel_qdisc.h   fq.h                     ip6_checksum.h        llc_s_ac.h        nfc/             stp.h
af_ieee802154.h  compat.h        fq_impl.h                ip6_fib.h             llc_sap.h         nl802154.h       switchdev.h
af_rxrpc.h       datalink.h      garp.h                   ip6_route.h           llc_s_ev.h        p8022.h          tc_act/
af_unix.h        dcbevent.h      genetlink.h              ip6_tunnel.h          llc_s_st.h        phonet/          tcp.h
af_vsock.h       dcbnl.h         geneve.h                 ipcomp.h              lwtunnel.h        ping.h           tcp_states.h
ah.h             devlink.h       gen_stats.h              ipconfig.h            mac80211.h        pkt_cls.h        timewait_sock.h
arp.h            dn_dev.h        gre.h                    ip_fib.h              mac802154.h       pkt_sched.h      transp_v6.h
atmclip.h        dn_fib.h        gro_cells.h              ip.h                  mip6.h            protocol.h       tso.h
ax25.h           dn.h            gtp.h                    ip_tunnels.h          mld.h             psnap.h          udp.h
ax88796.h        dn_neigh.h      gue.h                    ipv6.h                mpls.h            raw.h            udplite.h
bluetooth/       dn_nsp.h        hwbm.h                   ip_vs.h               mpls_iptunnel.h   rawv6.h          udp_tunnel.h
bond_3ad.h       dn_route.h      icmp.h                   ipx.h                 mrp.h             red.h            vsock_addr.h
bond_alb.h       dsa.h           ieee80211_radiotap.h     irda/                 ncsi.h            regulatory.h     vxlan.h
bonding.h        dsfield.h       ieee802154_netdev.h      iucv/                 ndisc.h           request_sock.h   wext.h
bond_options.h   dst_cache.h     if_inet6.h               iw_handler.h          neighbour.h       rose.h           wimax.h
busy_poll.h      dst.h           ila.h                    kcm.h                 netevent.h        route.h          x25device.h
caif/            dst_metadata.h  inet6_connection_sock.h  l3mdev.h              netfilter/        rtnetlink.h      x25.h
calipso.h        dst_ops.h       inet6_hashtables.h       lapb.h                netfilter_icmp/   sch_generic.h    xfrm.h
cfg80211.h       esp.h           inet_common.h            lib80211.h            netlabel.h        scm.h
cfg80211-wext.h  ethoc.h         inet_connection_sock.h   llc_c_ac.h            netlink.h         sctp/
cfg802154.h      fib_rules.h     inet_ecn.h               llc_c_ev.h            net_namespace.h   secure_seq.h
checksum.h       firewire.h      inet_frag.h              llc_conn.h            netns/            slhc_vj.h
cipso_ipv4.h     flowcache.h     inet_hashtables.h        llc_c_st.h            netprio_cgroup.h  snmp.h
root@raminfp /tmp/linux-4.8.0/include/net# cd netfilter_icmp/
root@raminfp /tmp/linux-4.8.0/include/net/netfilter_icmp# ls
netfilter_icmp.h

it's done,now we should define this function name from file header netfilter_icmp on main.c file linux,

Go to :

root@raminfp /tmp/linux-4.8.0# cd init/
root@raminfp /tmp/linux-4.8.0/init# ls
calibrate.c  do_mounts.h         do_mounts_md.c  initramfs.c  Kconfig  Makefile       version.c
do_mounts.c  do_mounts_initrd.c  do_mounts_rd.c  init_task.c  main.c   noinitramfs.c

we declare header file init/main.c and call function header file here

Building linux kernel :

make menuconfig

kernel

Help NETFILTER ICMP

kernel

Now we build kernel code on the linux kernel you find binary package of build here

build and install kernel package :

root@raminfp /tmp# cd linux-4.8.0/
root@raminfp /tmp/linux-4.8.0# ls
arch/   COPYING  debian.master/  firmware/  ipc/     lib/         net/            samples/        sound/   usr/
block/  CREDITS  Documentation/  fs/        Kbuild   MAINTAINERS  README          scripts/        spl/     virt/
build/  crypto/  drivers/        include/   Kconfig  Makefile     README.md       security/       tools/   zfs/
certs/  debian/  dropped.txt     init/      kernel/  mm/          REPORTING-BUGS  snapcraft.yaml  ubuntu/
root@raminfp /tmp/linux-4.8.0# cd build/
root@raminfp /tmp/linux-4.8.0/build# ls
linux-headers-4.8.17-netfilter-icmp_05-mar-2017_amd64.deb  linux-image-4.8.17-netfilter-icmp_05-mar-2017_amd64.deb
root@raminfp /tmp/linux-4.8.0/build# dpkg --install linux-headers-4.8.17-netfilter-icmp_05-mar-2017_amd64.deb
root@raminfp /tmp/linux-4.8.0/build# dpkg --install linux-image-4.8.17-netfilter-icmp_05-mar-2017_amd64.deb
root@raminfp /tmp/linux-4.8.0/build# reboot

Go to advance options of ubuntu :

kernel

now we see 4.8.17-netfilter_icmp this is we kernel,

kernel

We have on own kernel now what heppen of my code , please see image, we see kernel release and access to google.com,this means any drop packet ICMP,

kernel

now echo 1 > /proc/netfilter_proc_a we see /proc/netfilter_proc_a is true this means drop ICMP packet,

kernel

Special thanks to Kiran Kankipati

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].