Re: [vpp-dev] pcap_write error: bad address
hi Dave: I have been gdb before, vl(pm->pcap_data) = 2,806,013,189, pm->n_pcap_data_written = 0. int is 32 bits,size_t is 64 bits. n=0xA740 5D05 cast to size_t is 0x A740 5D05. we can't use n for write param. code fragment: int n = vec_len (pm->pcap_data) - pm->n_pcap_data_written; n = write (pm->file_descriptor, vec_elt_at_index (pm->pcap_data, pm->n_pcap_data_written), n); -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#22043): https://lists.fd.io/g/vpp-dev/message/22043 Mute This Topic: https://lists.fd.io/mt/94377467/21656 Mute #pcap:https://lists.fd.io/g/vpp-dev/mutehashtag/pcap Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [vpp-dev] pcap_write error: bad address #pcap
Use gdb to inspect the pcap_main_t. In particular, determine vec_len(pm->pcap_data) [“(gdb) vl(pm->pcap_data)”] and pm->n_pcap_data_written. For reasonable N pcap_write(...) is known to work. D. From: vpp-dev@lists.fd.io On Behalf Of aihua1...@163.com Sent: Sunday, October 16, 2022 11:23 PM To: vpp-dev@lists.fd.io Subject: [vpp-dev] pcap_write error: bad address #pcap dear all: pcap_write,use type int n; if n is negative。 int n = vec_len (pm->pcap_data) - pm->n_pcap_data_written; write func will failed,errno = 14. n = write (pm->file_descriptor, vec_elt_at_index (pm->pcap_data, pm->n_pcap_data_written), n); int cast to size_t may case some overflow? -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#22041): https://lists.fd.io/g/vpp-dev/message/22041 Mute This Topic: https://lists.fd.io/mt/94377467/21656 Mute #pcap:https://lists.fd.io/g/vpp-dev/mutehashtag/pcap Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[vpp-dev] pcap_write error: bad address #pcap
dear all: pcap_write,use type int n; if n is negative。 int n = vec_len (pm->pcap_data) - pm->n_pcap_data_written; write func will failed,errno = 14. n = write (pm->file_descriptor, vec_elt_at_index (pm->pcap_data, pm->n_pcap_data_written), n); int cast to size_t may case some overflow? -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#22039): https://lists.fd.io/g/vpp-dev/message/22039 Mute This Topic: https://lists.fd.io/mt/94377467/21656 Mute #pcap:https://lists.fd.io/g/vpp-dev/mutehashtag/pcap Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-