Skip to content

Commit eee990d

Browse files
committed
[core] run post processing callbacks only on SIP traffic
Credits go to @lemenkov Alternative to OpenSIPS#2316
1 parent 107b6fa commit eee990d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

forward.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static inline int msg_send( struct socket_info* send_sock, int proto,
114114
/* the raw processing callbacks are free to change whatever inside
115115
* the buffer further use out_buff.s and at the end try to free out_buff.s
116116
* if changed by callbacks */
117-
if (proto != PROTO_BIN)
117+
if ( is_sip_proto(proto) )
118118
run_post_raw_processing_cb(POST_RAW_PROCESSING,&out_buff, msg);
119119

120120
/* update the length for further processing */

ip_addr.h

+3
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ struct socket_id {
166166
/* check if a socket_info is marked as anycast */
167167
#define is_anycast(_si) (_si->flags & SI_IS_ANYCAST)
168168

169+
/* checks if the given protocol is a SIP one (versus HEP, BIN, SMPP, etc)
170+
* we rely here on the fact at all the SIP protos are in a sequance */
171+
#define is_sip_proto(_proto) (PROTO_UDP<=(_proto) && (_proto)<=PROTO_WSS)
169172

170173
struct net* mk_net(struct ip_addr* ip, struct ip_addr* mask);
171174
struct net* mk_net_bitlen(struct ip_addr* ip, unsigned int bitlen);

0 commit comments

Comments
 (0)