--- alias_smedia.c.orig 2009-04-12 23:07:57.000000000 +0200 +++ alias_smedia.c 2009-04-12 23:06:32.000000000 +0200 @@ -132,13 +132,20 @@ AliasHandleRtspOut(struct libalias *, struct ip *, struct alias_link *, int maxpacketsize); static int -fingerprint(struct libalias *la, struct alias_data *ah) +fingerprint_udp(struct libalias *la, struct alias_data *ah) { if (ah->dport != NULL && ah->aport != NULL && ah->sport != NULL && ntohs(*ah->dport) == TFTP_PORT_NUMBER) return (0); - if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL || + return (-1); +} + +static int +fingerprint_tcp(struct libalias *la, struct alias_data *ah) +{ + + if (ah->dport == NULL || ah->sport == NULL || ah->lnk == NULL || ah->maxpktsize == 0) return (-1); if (ntohs(*ah->dport) == RTSP_CONTROL_PORT_NUMBER_1 @@ -150,24 +157,37 @@ } static int -protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah) +protohandler_udp(struct libalias *la, struct ip *pip, struct alias_data *ah) { - if (ntohs(*ah->dport) == TFTP_PORT_NUMBER) - FindRtspOut(la, pip->ip_src, pip->ip_dst, - *ah->sport, *ah->aport, IPPROTO_UDP); - else AliasHandleRtspOut(la, pip, ah->lnk, ah->maxpktsize); + FindRtspOut(la, pip->ip_src, pip->ip_dst, + *ah->sport, *ah->aport, IPPROTO_UDP); return (0); } +static int +protohandler_tcp(struct libalias *la, struct ip *pip, struct alias_data *ah) +{ + + AliasHandleRtspOut(la, pip, ah->lnk, ah->maxpktsize); + return (0); +} + struct proto_handler handlers[] = { { .pri = 100, .dir = OUT, - .proto = TCP|UDP, - .fingerprint = &fingerprint, - .protohandler = &protohandler - }, + .proto = UDP, + .fingerprint = &fingerprint_udp, + .protohandler = &protohandler_udp + }, + { + .pri = 100, + .dir = OUT, + .proto = TCP, + .fingerprint = &fingerprint_tcp, + .protohandler = &protohandler_tcp + }, { EOH } };