| 1 |
#! /usr/bin/env stap |
| 2 |
|
| 3 |
############################################################ |
| 4 |
# netdev.stp |
| 5 |
# Author: Breno Leitao <[email protected]> |
| 6 |
# An example script to show how a netdev works and its |
| 7 |
# functions |
| 8 |
############################################################ |
| 9 |
|
| 10 |
|
| 11 |
probe netdev.get_stats ? { |
| 12 |
printf("%s was asked for statistics structure\n", dev_name) |
| 13 |
} |
| 14 |
|
| 15 |
probe netdev.register{ |
| 16 |
printf("Registering netdev_name %s\n", dev_name) |
| 17 |
} |
| 18 |
|
| 19 |
probe netdev.unregister{ |
| 20 |
printf("Unregistering netdev %s\n", dev_name) |
| 21 |
} |
| 22 |
|
| 23 |
probe netdev.ioctl{ |
| 24 |
printf("Netdev ioctl raised with param: %d and arg: %s\n", cmd, arg) |
| 25 |
} |
| 26 |
|
| 27 |
probe netdev.set_promiscuity { |
| 28 |
if (enable) |
| 29 |
printf("Device %s entering in promiscuous mode\n", dev_name) |
| 30 |
else |
| 31 |
printf("Device %s leaving promiscuous mode\n", dev_name) |
| 32 |
} |
| 33 |
|
| 34 |
probe netdev.change_rx_flag ? { |
| 35 |
printf("Device %s is changing its RX flags to %d\n", dev_name, flags) |
| 36 |
} |
| 37 |
|
| 38 |
probe netdev.change_mtu { |
| 39 |
printf("Changing MTU on device %s from %d to %d\n", dev_name, |
| 40 |
old_mtu, new_mtu) |
| 41 |
} |
| 42 |
|
| 43 |
probe netdev.change_mac { |
| 44 |
printf("Changing MAC address on device %s from %s to %s\n", |
| 45 |
dev_name, old_mac, new_mac) |
| 46 |
} |
| 47 |
|
| 48 |
probe netdev.transmit { |
| 49 |
printf("Device %s is sending (queued) a packet with protocol %d\n", dev_name, protocol) |
| 50 |
} |
| 51 |
|
| 52 |
probe netdev.hard_transmit { |
| 53 |
printf("Device %s is sending (hard) a packet with protocol %d\n", dev_name, protocol) |
| 54 |
} |
| 55 |
|
| 56 |
probe netdev.rx { |
| 57 |
printf("Device %s received a packet with protocol %d\n", dev_name, protocol) |
| 58 |
} |