- pi.ptype = PT_UDP;
- pi.srcport = uh_sport;
- pi.destport = uh_dport;
-
- /* ONC RPC. We can't base this on anything in the UDP header; we have
- to look at the payload. If "dissect_rpc()" returns TRUE, it was
- an RPC packet, otherwise it's some other type of packet. */
- if (dissect_rpc(pd, offset, fd, tree))
- return;
-
- /* try to apply the plugins */
-#ifdef HAVE_PLUGINS
- {
- plugin *pt_plug = plugin_list;
-
- if (pt_plug) {
- while (pt_plug) {
- if (pt_plug->enabled && !strcmp(pt_plug->protocol, "udp") &&
- tree && dfilter_apply(pt_plug->filter, tree, pd)) {
- pt_plug->dissector(pd, offset, fd, tree);
- return;
- }
- pt_plug = pt_plug->next;
- }
- }
- }
-#endif
-
- /* XXX - we should do all of this through the table of ports. */
-#define PORT_IS(port) (uh_sport == port || uh_dport == port)
- if (PORT_IS(UDP_PORT_BOOTPS))
- dissect_bootp(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_DNS))
- dissect_dns(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_SRVLOC))
- dissect_srvloc(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_ISAKMP))
- dissect_isakmp(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_RIP)) {
- /* we should check the source port too (RIP: UDP src and dst port 520) */
- dissect_rip(pd, offset, fd, tree);
- } else if (PORT_IS(UDP_PORT_RIPNG))
- dissect_ripng(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_NCP))
- dissect_ncp(pd, offset, fd, tree); /* XXX -- need to handle nw_server_address */
- else if (PORT_IS(UDP_PORT_NBNS))
- dissect_nbns(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_NBDGM))
- dissect_nbdgm(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_NTP))
- dissect_ntp(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_WHO))
- dissect_who(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_IPX)) /* RFC 1234 */
- dissect_ipx(pd, offset, fd, tree);
- else if ((uh_sport >= UDP_PORT_RX_LOW && uh_sport <= UDP_PORT_RX_HIGH) ||
- (uh_dport >= UDP_PORT_RX_LOW && uh_dport <= UDP_PORT_RX_HIGH) ||
- PORT_IS(UDP_PORT_RX_AFS_BACKUPS))
- dissect_rx(pd, offset, fd, tree); /* transarc AFS's RX protocol */
- else if (PORT_IS(UDP_PORT_SNMP) || PORT_IS(UDP_PORT_SNMP_TRAP))
- dissect_snmp(pd, offset, fd, tree);
- else if (PORT_IS(UDP_PORT_VINES)) {
- /* FIXME: AFAIK, src and dst port must be the same */
- dissect_vines_frp(pd, offset, fd, tree);
- } else if (PORT_IS(UDP_PORT_TFTP)) {
- /* This is the first point of call, but it adds a dynamic call */
- dissector_add("udp.port", MAX(uh_sport, uh_dport), dissect_tftp); /* Add to table */
- dissect_tftp(pd, offset, fd, tree);
- } else if (PORT_IS(UDP_PORT_TIME)) {
- dissect_time(pd, offset, fd, tree);
- } else if (PORT_IS(UDP_PORT_RADIUS) ||
- PORT_IS(UDP_PORT_RADACCT) ||
- PORT_IS(UDP_PORT_RADIUS_NEW) ||
- PORT_IS(UDP_PORT_RADACCT_NEW) ) {
- dissect_radius(pd, offset, fd, tree);
- } else if ( PORT_IS(UDP_PORT_L2TP)) {
- dissect_l2tp(pd,offset,fd,tree);
- } else if ( PORT_IS(UDP_PORT_ICP)) {
- dissect_icp(pd,offset,fd,tree);
- } else if ( PORT_IS(UDP_PORT_ICQ)) {
- dissect_icq(pd,offset,fd,tree);
- } else if (PORT_IS(UDP_PORT_WCCP) ) {
- dissect_wccp(pd, offset, fd, tree);
- } else {
- /* OK, find a routine in the table, else use the default */
-
- if ((dissect_routine = dissector_lookup(udp_dissector_table, uh_sport))) {
-
- dissector_t dr2 = dissector_lookup(udp_dissector_table, uh_dport);
-
- if (dr2 == NULL) { /* Not in the table, add */
-
- dissector_add("udp.port", uh_dport, dissect_tftp);
-
- }
-
- (*dissect_routine)(pd, offset, fd, tree);
- }
- else if ((dissect_routine = dissector_lookup(udp_dissector_table, uh_dport))) {