• Home
  • Raw
  • Download

Lines Matching full:local

18 local ffi = require("ffi")
19 local bit = require("bit")
26 local program = [[
187 local debug = false
188 local start_ts = 0
190 local inet_addresslen = #"255.255.255.255"
191 local inet6_addresslen = #"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"
192 local AF_INET = 2
193 local AF_INET6 = 10
195 local header_string = "%-5s %-10.10s %s%-15s %-5s %-15s %-5s %5s %5s %s"
196 local format_string = "%-5d %-10.10s %s%-15s %-5d %-15s %-5d %5d %5d %.2f"
197 local ip_string = ""
198 local ip_version = false
199 local arg_timestamp = false
200 local arg_csv = false
201 local arg_time = false
203 local examples = [[examples:
209 ./tcplife -L 80 # only trace local port 80
210 ./tcplife -L 80,81 # only trace local ports 80 and 81
214 local function split(str,sep)
215 local t = {}
222 local function inet_ntop(af, addr, len)
223 local addr_dst = ffi.new("char[?]", len)
224 local addr_src
234 local function inet_ntohs(port)
235 local p = tonumber(port)
239 local function print_ipv4_event(cpu, event)
241 local event_pid = tonumber(event.pid)
242 local event_task = ffi.string(event.task)
243 local event_ports = tonumber(event.ports)
244 local event_tx_b = tonumber(event.tx_b)
245 local event_rx_b = tonumber(event.rx_b)
246 local event_span_us = tonumber(event.span_us)
247 local event_ts_us = tonumber(event.ts_us)
248 local event_saddr = inet_ntop(AF_INET, tonumber(event.saddr), inet_addresslen)
249 local event_daddr = inet_ntop(AF_INET, tonumber(event.daddr), inet_addresslen)
261 local delta_s = (event_ts_us - start_ts) / 1000000
268 local iv = ""
279 local function print_ipv6_event(cpu, event)
280 local event_pid = tonumber(event.pid)
281 local event_task = ffi.string(event.task)
282 local event_ports = tonumber(event.ports)
283 local event_tx_b = tonumber(event.tx_b)
284 local event_rx_b = tonumber(event.rx_b)
285 local event_span_us = tonumber(event.span_us)
286 local event_ts_us = tonumber(event.ts_us)
287local event_saddr = inet_ntop(AF_INET6, {tonumber(event.saddr[0]), tonumber(event.saddr[1])}, inet…
288local event_daddr = inet_ntop(AF_INET6, {tonumber(event.daddr[0]), tonumber(event.daddr[1])}, inet…
300 local delta_s = (event_ts_us - start_ts) / 1000000
307 local iv = ""
317 local function parse_arg(utils)
318 local parser = utils.argparse("tcplife",
326 parser:option("-L --localport", "comma-separated list of local ports to trace.")
329 local args = parser:parse()
331 local filter = 'if (pid != %d) { return 0; }' % args.pid
336 local dports = split(args.remoteport, ",")
337 local dports_if = ""
345 local filter = "if (%s) { birth.delete(&sk); return 0; }" % dports_if
349 local lports = split(args.localport,",")
350 local lports_if = ""
358 local filter = "if (%s) { birth.delete(&sk); return 0; }" % lports_if
405 local bpf = BPF:new{text=program}
410 local TASK_COMM_LEN = 16 -- linux/sched.h