@ -29,7 +29,7 @@
# include "respond-reject.h"
# include "respond-reject-libnet11.h"
# if ndef OS_WIN32
# if def HAVE_LIBNET11
# include <libnet.h>
@ -63,7 +63,7 @@ int RejectSendLibnet11L3IPv4TCP(ThreadVars *tv, Packet *p, void *data, int dir)
if ( ( c = libnet_init ( LIBNET_RAW4 , NULL , ebuf ) ) = = NULL )
{
printf( " RejectSendLibnet11IPv4TCP libnet_init %s \n " , ebuf ) ;
SCLogError( SC_ERR_LIBNET_INIT , " libnet_inint failed: %s " , ebuf ) ;
return 1 ;
}
@ -74,7 +74,7 @@ int RejectSendLibnet11L3IPv4TCP(ThreadVars *tv, Packet *p, void *data, int dir)
lpacket . dsize = p - > payload_len ;
if ( dir = = REJECT_DIR_SRC ) {
printf ( " sending a tcp reset to src \n " ) ;
SCLogDebug ( " sending a tcp reset to src " ) ;
lpacket . seq = TCP_GET_ACK ( p ) ;
lpacket . ack = TCP_GET_SEQ ( p ) + lpacket . dsize ;
@ -85,7 +85,7 @@ int RejectSendLibnet11L3IPv4TCP(ThreadVars *tv, Packet *p, void *data, int dir)
lpacket . dst4 = GET_IPV4_SRC_ADDR_U32 ( p ) ;
}
else if ( dir = = REJECT_DIR_DST ) {
printf ( " sending a tcp reset to dst \n " ) ;
SCLogDebug ( " sending a tcp reset to dst " ) ;
lpacket . seq = TCP_GET_SEQ ( p ) ;
lpacket . ack = TCP_GET_ACK ( p ) ;
@ -96,7 +96,7 @@ int RejectSendLibnet11L3IPv4TCP(ThreadVars *tv, Packet *p, void *data, int dir)
lpacket . dst4 = GET_IPV4_DST_ADDR_U32 ( p ) ;
} else {
printf ( " reset not src or dst returning \n " ) ;
SCLogError( SC_ERR_LIBNET_INVALID_DIR , " reset not src or dst returning " ) ;
return 1 ;
}
@ -122,7 +122,7 @@ int RejectSendLibnet11L3IPv4TCP(ThreadVars *tv, Packet *p, void *data, int dir)
c , /* libnet context */
0 ) ) < 0 ) /* libnet ptag */
{
printf( " RejectSendLibnet11IPv4TCP libnet_build_tcp %s \n " , libnet_geterror ( c ) ) ;
SCLogError( SC_ERR_LIBNET_BUILD_FAILED , " libnet_build_tcp %s " , libnet_geterror ( c ) ) ;
goto cleanup ;
}
@ -141,13 +141,13 @@ int RejectSendLibnet11L3IPv4TCP(ThreadVars *tv, Packet *p, void *data, int dir)
c , /* libnet context pointer */
0 ) ) < 0 ) /* packet id */
{
printf( " RejectSendLibnet11IPv4TCP libnet_build_ipv4 %s \n " , libnet_geterror ( c ) ) ;
SCLogError( SC_ERR_LIBNET_BUILD_FAILED , " libnet_build_ipv4 %s " , libnet_geterror ( c ) ) ;
goto cleanup ;
}
result = libnet_write ( c ) ;
if ( result = = - 1 ) {
printf( " RejectSendLibnet11IPv4TCP libnet_write failed: %s \n " , libnet_geterror ( c ) ) ;
SCLogError( SC_ERR_LIBNET_WRITE_FAILED , " libnet_write failed: %s " , libnet_geterror ( c ) ) ;
goto cleanup ;
}
@ -171,7 +171,7 @@ int RejectSendLibnet11L3IPv4ICMP(ThreadVars *tv, Packet *p, void *data, int dir)
lpacket . len = ( IPV4_GET_HLEN ( p ) + p - > payload_len ) ;
if ( ( c = libnet_init ( LIBNET_RAW4 , NULL , ebuf ) ) = = NULL ) {
printf( " RejectSendLibnet11L3IPv4ICMP libnet_init %s \n " , ebuf ) ;
SCLogError( SC_ERR_LIBNET_INIT , " libnet_inint failed: %s " , ebuf ) ;
return 1 ;
}
@ -184,7 +184,7 @@ int RejectSendLibnet11L3IPv4ICMP(ThreadVars *tv, Packet *p, void *data, int dir)
lpacket . dst4 = GET_IPV4_DST_ADDR_U32 ( p ) ;
} else {
printf ( " reset not src or dst returning \n " ) ;
SCLogError( SC_ERR_LIBNET_INVALID_DIR , " reset not src or dst returning " ) ;
return 1 ;
}
@ -201,7 +201,7 @@ int RejectSendLibnet11L3IPv4ICMP(ThreadVars *tv, Packet *p, void *data, int dir)
c , /* libnet context */
0 ) ) < 0 ) /* libnet ptag */
{
printf( " RejectSendLibnet11L3IPv4ICMP libnet_build_icmpv4_unreach %s \n " , libnet_geterror ( c ) ) ;
SCLogError( SC_ERR_LIBNET_BUILD_FAILED , " libnet_build_icmpv4_unreach %s " , libnet_geterror ( c ) ) ;
goto cleanup ;
}
@ -221,13 +221,13 @@ int RejectSendLibnet11L3IPv4ICMP(ThreadVars *tv, Packet *p, void *data, int dir)
c , /* libnet context pointer */
0 ) ) < 0 ) /* packet id */
{
printf( " RejectSendLibnet11L3IPv4ICMP %s \n " , libnet_geterror ( c ) ) ;
SCLogError( SC_ERR_LIBNET_BUILD_FAILED , " libnet_build_ipv4 %s " , libnet_geterror ( c ) ) ;
goto cleanup ;
}
result = libnet_write ( c ) ;
if ( result = = - 1 ) {
printf( " RejectSendLibnet11L3IPv4ICMP libnet_write_raw_ipv4 failed: %s \n " , libnet_geterror ( c ) ) ;
SCLogError( SC_ERR_LIBNET_WRITE_FAILED , " libnet_write_raw_ipv4 failed: %s " , libnet_geterror ( c ) ) ;
goto cleanup ;
}
@ -236,16 +236,16 @@ cleanup:
return 0 ;
}
# else /* ifndef OS_WIN32 */
# else
int RejectSendLibnet11L3IPv4TCP ( ThreadVars * tv , Packet * p , void * data , int dir ) {
printf( " RejectSendLibnet11L3IPv4TCP not implemented for OS_WIN32 \n " ) ;
SCLogError( SC_ERR_LIBNET_NOT_ENABLED , " Libnet based rejects are disabled. Usually this means that you don't have libnet installed, or configure couldn't find it. " ) ;
return 0 ;
}
int RejectSendLibnet11L3IPv4ICMP ( ThreadVars * tv , Packet * p , void * data , int dir ) {
printf ( " RejectSendLibnet11L3IPv4ICMP not implemented for OS_WIN32 \n " ) ;
SCLogError ( SC_ERR_LIBNET_NOT_ENABLED , " Libnet based rejects are disabled. Usually this means that you don't have libnet installed, or configure couldn't find it. " ) ;
return 0 ;
}
# endif /* ifndef OS_WIN32 */
# endif /* HAVE_LIBNET11 */