X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/3594ff41d46df4ee23ae3d5f958d15f2b0477ebb..09b51d326c38ea8e10ce4da09c09d50e08c5aeb8:/pcap_inject.3pcap diff --git a/pcap_inject.3pcap b/pcap_inject.3pcap index 7ccdf2c5..83eae1c3 100644 --- a/pcap_inject.3pcap +++ b/pcap_inject.3pcap @@ -17,7 +17,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_INJECT 3PCAP "5 April 2008" +.TH PCAP_INJECT 3PCAP "5 March 2022" .SH NAME pcap_inject, pcap_sendpacket \- transmit a packet .SH SYNOPSIS @@ -32,7 +32,7 @@ int pcap_sendpacket(pcap_t *p, const u_char *buf, int size); .ft .fi .SH DESCRIPTION -.B pcap_inject() +.BR pcap_inject () sends a raw packet through the network interface; .I buf points to the data of the packet, including the link-layer header, and @@ -42,7 +42,7 @@ is the number of bytes in the packet. Note that, even if you successfully open the network interface, you might not have permission to send packets on it, or it might not support sending packets; as -.I pcap_open_live() +.BR pcap_open_live (3PCAP) doesn't have a flag to indicate whether to open for capturing, sending, or capturing and sending, you cannot request an open that supports sending and be notified at open time whether sending will be possible. @@ -51,7 +51,7 @@ Note also that some devices might not support sending packets. Note that, on some platforms, the link-layer header of the packet that's sent might not be the same as the link-layer header of the packet supplied to -.BR pcap_inject() , +.BR pcap_inject (), as the source link-layer address, if the header contains such an address, might be changed to be the address assigned to the interface on which the packet it sent, if the platform doesn't support sending @@ -61,28 +61,42 @@ libpcap used when attaching to the device, even on platforms that .I do nominally support sending completely raw and unchanged packets. .PP -.B pcap_sendpacket() +.BR pcap_sendpacket () is like -.BR pcap_inject() , -but it returns 0 on success, rather than returning the number of bytes +.BR pcap_inject (), +but it returns +.B 0 +on success, rather than returning the number of bytes written. -.RB ( pcap_inject() +.RB ( pcap_inject () comes from OpenBSD; -.B pcap_sendpacket() -comes from WinPcap. Both are provided for compatibility.) +.BR pcap_sendpacket () +comes from WinPcap/Npcap. Both are provided for compatibility.) .SH RETURN VALUE -.B pcap_inject() -returns the number of bytes written on success and \-1 on failure. +.BR pcap_inject () +returns the number of bytes written on success, +.B PCAP_ERROR_NOT_ACTIVATED +if called on a capture handle that has been created but not activated, and +.B PCAP_ERROR +on other errors. .PP -.B pcap_sendpacket() -returns 0 on success and \-1 on failure. +.BR pcap_sendpacket () +returns +.B 0 +on success, +.B PCAP_ERROR_NOT_ACTIVATED +if called on a capture handle that has been created but not activated, and +.B PCAP_ERROR +on other errors. .PP -If \-1 is returned, -.B pcap_geterr() +If +.B PCAP_ERROR +is returned, +.BR pcap_geterr (3PCAP) or -.B pcap_perror() +.BR pcap_perror (3PCAP) may be called with .I p as an argument to fetch or display the error text. .SH SEE ALSO -pcap(3PCAP), pcap_geterr(3PCAP) +.BR pcap (3PCAP)