Skip to content

Commit

Permalink
[core] run post processing callbacks only on SIP traffic
Browse files Browse the repository at this point in the history
Credits go to @lemenkov
Alternative to #2316

(cherry picked from commit eee990d)
  • Loading branch information
bogdan-iancu committed Jan 19, 2021
1 parent ec1f4cc commit 5896084
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion forward.h
Expand Up @@ -114,7 +114,7 @@ static inline int msg_send( struct socket_info* send_sock, int proto,
/* the raw processing callbacks are free to change whatever inside
* the buffer further use out_buff.s and at the end try to free out_buff.s
* if changed by callbacks */
if (proto != PROTO_BIN)
if ( is_sip_proto(proto) )
run_post_raw_processing_cb(POST_RAW_PROCESSING,&out_buff, msg);

/* update the length for further processing */
Expand Down
3 changes: 3 additions & 0 deletions ip_addr.h
Expand Up @@ -166,6 +166,9 @@ struct socket_id {
/* check if a socket_info is marked as anycast */
#define is_anycast(_si) (_si->flags & SI_IS_ANYCAST)

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

struct net* mk_net(struct ip_addr* ip, struct ip_addr* mask);
struct net* mk_net_bitlen(struct ip_addr* ip, unsigned int bitlen);
Expand Down

0 comments on commit 5896084

Please sign in to comment.