Beispiel #1
0
void spawn_rtp_subparsers(struct ip_addr const *this_host, uint16_t this_port, struct ip_addr const *other_host, uint16_t other_port, struct timeval const *now, struct proto *requestor)
{
    SLOG(LOG_DEBUG, "Spawning RT(C)P parsers for %s:%"PRIu16"<->%s:%"PRIu16, ip_addr_2_str(this_host), this_port, ip_addr_2_str(other_host), other_port);

    (void)cnxtrack_ip_new(IPPROTO_UDP, this_host, this_port,   other_host, other_port,   false, proto_rtp,  now, requestor);
    (void)cnxtrack_ip_new(IPPROTO_UDP, this_host, this_port+1, other_host, other_port+1, false, proto_rtcp, now, requestor);
}
Beispiel #2
0
// The Via header may inform us that the peer is expecting answers on a non-standard port. Let's conntrack it.
static void conntrack_via(struct sip_proto_info const *info, struct timeval const *now)
{
    /* We conntrack the Via at every occurence, which will insert many conntrack
     * that will never be used (because most of the time Via is toward default SIP
     * port anyway.
     * We can't but hope that timeouting tracked connection will compensate for our
     * slopyness.
     * Notice that we conntrack from any peer to the Via address. SIP is so fun! */
    SLOG(LOG_DEBUG, "Conntracking SIP via %s %s:%"PRIu16,
        info->via.protocol == IPPROTO_UDP ? "UDP" :
            info->via.protocol == IPPROTO_TCP ? "TCP" : "unknown",
        ip_addr_2_str(&info->via.addr),
        info->via.port);

    assert(info->set_values & SIP_VIA_SET);
    (void)cnxtrack_ip_new(info->via.protocol, &info->via.addr, info->via.port, ADDR_UNKNOWN, PORT_UNKNOWN, false /* only one cnx */, proto_sip, now, NULL);
}