--- /dev/null
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=smap
+PKG_VERSION:=0.6.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-20081016.tar.gz
+PKG_SOURCE_URL:=http://www.wormulon.net/smap/
+PKG_MD5SUM:=814456ccc8fea5688382b7ec55fe44eb
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/smap-$(PKG_VERSION)/smap
+PKG_FIXUP = libtool
+
+include $(INCLUDE_DIR)/package.mk
+
+LIBTOOL="$(STAGING_DIR)/host/bin/libtool"
+
+define Package/smap
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=A SIP network discovery tool
+ URL:=http://www.wormulon.net/smap/
+ DEPENDS:=+libpthread
+endef
+
+define Package/smap/description
+ Discovers and identifies SIP devices on the network including hardware
+ phones, softphones, PBX software, and PBX equipment.
+endef
+
+# define Package/smap/conffiles
+# /etc/config/smap
+# endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" \
+ LD="$(TARGET_LD)" \
+ CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -DRAW_SOCKET -DHAVE_RANDOM -DSMAP_OS=linux" \
+ LDFLAGS="$(TARGET_LDFLAGS) -lm -lpthread" \
+ LIBTOOL="$(LIBTOOL)" \
+ smap
+endef
+
+define Package/smap/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/smap $(1)/usr/bin
+ $(INSTALL_DIR) $(1)/usr/share/smap
+ $(CP) $(PKG_BUILD_DIR)/fingerprint.db $(1)/usr/share/smap
+endef
+
+$(eval $(call BuildPackage,smap))
--- /dev/null
+diff -Naur smap.orig/icmpping.c smap/icmpping.c
+--- smap.orig/icmpping.c 2007-10-07 06:15:11.000000000 -0400
++++ smap/icmpping.c 2009-06-13 11:57:28.000000000 -0400
+@@ -182,6 +182,7 @@
+ struct sockaddr_in sin;
+ #define ICMP_PKT_LEN (sizeof(struct icmp) + ICMP_PAYLOAD_LEN)
+ char icmpbuf[ICMP_PKT_LEN];
++ socklen_t socklen;
+
+ /* prepare ICMP packet */
+ memset(&icmpbuf, 'A', ICMP_PKT_LEN);
+@@ -207,6 +208,8 @@
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) != 0)
+ perror("setsockopt");
+ #endif
++ if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) != 0)
++ perror("setsockopt");
+ icmp->icmp_cksum = icmp_in_cksum((unsigned short *) &icmpbuf, ICMP_PKT_LEN);
+
+ /* send data */
+diff -Naur smap.orig/smap.c smap/smap.c
+--- smap.orig/smap.c 2007-11-03 14:14:52.000000000 -0400
++++ smap/smap.c 2009-06-13 10:49:15.000000000 -0400
+@@ -244,11 +244,11 @@
+ break;
+ case 't': /* TCP transport */
+ /* UDP is default so TCP would override it */
+- config.flags ^= FLAG_UDP_TRANSPORT;
++ config.flags &= ~FLAG_UDP_TRANSPORT;
+ config.flags |= FLAG_TCP_TRANSPORT;
+ break;
+ case 'u': /* UDP transport */
+- config.flags ^= FLAG_TCP_TRANSPORT;
++ config.flags &= ~FLAG_TCP_TRANSPORT;
+ config.flags |= FLAG_UDP_TRANSPORT;
+ break;
+ case 'r': /* ratelimit messages/sec */
+diff -Naur smap.orig/transport_udp.c smap/transport_udp.c
+--- smap.orig/transport_udp.c 2008-08-20 09:02:57.000000000 -0400
++++ smap/transport_udp.c 2009-06-13 11:56:15.000000000 -0400
+@@ -52,6 +52,7 @@
+ extern int udp_sendsock;
+ extern struct sockaddr_in udp_sendsock_sockaddr;
+ int sockaddrlen;
++ int one;
+
+ /* is 5060 (DEFAULT_SIP_PORT) available?
+ * if yes, we'll use it since some clients send responses to
+@@ -116,6 +117,13 @@
+ error(ERR_DEBUG, "bind() successful");
+ }
+ }
++ one = 1;
++ if (setsockopt(udp_sendsock, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) != 0) {
++ perror("setsockopt");
++ error(ERR_ERROR, "unable to set socket to broadcast");
++ return 0;
++ }
++
+ if (getsockname(udp_sendsock, (struct sockaddr *) &udp_sendsock_sockaddr,
+ (socklen_t *) &sockaddrlen) != 0)
+ if (DEBUG) perror("getsocknameudp_sendsock");
--- /dev/null
+diff -Naur smap.broadcast/test_supported.c smap/test_supported.c
+--- smap.broadcast/test_supported.c 2009-06-14 21:41:49.000000000 -0400
++++ smap/test_supported.c 2009-06-14 21:51:17.000000000 -0400
+@@ -49,6 +49,8 @@
+ {"Supported: timer, 100rel, replaces, callerid", 13},
+ /* Cisco 79x0 */
+ {"Supported: replaces,join,norefersub", 14},
++ /* Tecom IP2007 */
++ {"Supported: 100rel,replaces", 15 },
+ {"", 0}
+ };
+