diff -urp minisapserver-0.3.6/broadcast.cpp minisapserver-0.3.6-ajg/broadcast.cpp
--- minisapserver-0.3.6/broadcast.cpp	2008-09-03 16:08:07.000000000 +0100
+++ minisapserver-0.3.6-ajg/broadcast.cpp	2009-04-22 22:09:35.000000000 +0100
@@ -194,6 +195,7 @@ int Broadcast::Send(Message* m, const st
 
 
 int Broadcast::GuessDestination (const char *str,
+				 uint8_t program_sap_scope,
                                  struct sockaddr_storage *addr,
                                  socklen_t *addrlen) const
 {
@@ -215,19 +217,19 @@ int Broadcast::GuessDestination (const c
         in_addr_t ip = ntohl (n.in.s_addr);
 
         // 224.0.0.0/24 => 224.0.0.255
-        if ((ip & 0xffffff00) == 0xe0000000)
+        if (((ip & 0xffffff00) == 0xe0000000) || program_sap_scope == SAP_V4_LINK_SCOPE)
             ip =  0xe00000ff;
         else
         // 239.255.0.0/16 => 239.255.255.255
-        if ((ip & 0xffff0000) == 0xefff0000)
+        if (((ip & 0xffff0000) == 0xefff0000) || program_sap_scope == SAP_V4_LOCAL_SCOPE)
             ip =  0xefffffff;
         else
         // 239.192.0.0/14 => 239.195.255.255
-        if ((ip & 0xfffc0000) == 0xefc00000)
+        if (((ip & 0xfffc0000) == 0xefc00000) || program_sap_scope == SAP_V4_ORG_SCOPE)
             ip =  0xefc3ffff;
         else
         // other multicast address => 224.2.127.254
-        if ((ip & 0xf0000000) == 0xe0000000)
+        if (((ip & 0xf0000000) == 0xe0000000) || program_sap_scope == SAP_V4_GLOBAL_SCOPE)
             ip = 0xe0027ffe;
         else
         {
diff -urp minisapserver-0.3.6/broadcast.h minisapserver-0.3.6-ajg/broadcast.h
--- minisapserver-0.3.6/broadcast.h	2008-02-06 21:05:34.000000000 +0000
+++ minisapserver-0.3.6-ajg/broadcast.h	2009-04-22 22:10:13.000000000 +0100
@@ -28,14 +28,13 @@
 /* You must put the scope in between */
 #define SAP_IPV6_ADDR_2 "::2:7ffe"
 
-
 class Broadcast {
   public:
     Broadcast(int i_ttl = 0, const char *psz_iface = NULL);
     ~Broadcast(void);
     int Send(Message*, const struct sockaddr *dst, socklen_t len);
 
-    int GuessDestination(const char *prgm, struct sockaddr_storage *addr,
+    int GuessDestination(const char *prgm, uint8_t prgm_scope, struct sockaddr_storage *addr,
                          socklen_t *len) const;
 
   private:
diff -urp minisapserver-0.3.6/parser.cpp minisapserver-0.3.6-ajg/parser.cpp
--- minisapserver-0.3.6/parser.cpp	2009-01-11 19:50:43.000000000 +0000
+++ minisapserver-0.3.6-ajg/parser.cpp	2009-04-22 22:27:37.000000000 +0100
@@ -373,6 +374,25 @@ int Config::Parse()
             something=1;
             pp->SetPort(atoi(tline));
         }
+	if(strstr(line,"scope="))
+  	{
+            if(strstr(line,"global"))
+            {
+                pp->SetSapScope(SAP_V4_GLOBAL_SCOPE);
+            }
+            else if(strstr(line,"org"))
+            {
+                pp->SetSapScope(SAP_V4_ORG_SCOPE);
+            }
+            else if(strstr(line,"local"))
+            {
+                pp->SetSapScope(SAP_V4_LOCAL_SCOPE);
+            }
+            else if(strstr(line,"link"))
+            {
+                pp->SetSapScope(SAP_V4_LINK_SCOPE);
+            }
+	}
     }
 
     if(something)
diff -urp minisapserver-0.3.6/program.cpp minisapserver-0.3.6-ajg/program.cpp
--- minisapserver-0.3.6/program.cpp	2009-01-11 19:50:43.000000000 +0000
+++ minisapserver-0.3.6-ajg/program.cpp	2009-04-22 22:28:52.000000000 +0100
@@ -43,6 +44,7 @@ Program::Program() : b_rtp(false), b_has
     machine = "localhost";
     user = "VideoLAN";
     site = "http://www.videolan.org";
+    sap_scope = 0;
 }
 Program::~Program() {return;}
 
@@ -54,6 +56,7 @@ string Program::GetAddress(void){return 
 uint16_t Program::GetPort(void){return port;}
 string Program::GetTTL(void){return program_ttl;}
 string Program::GetPlGroup(void){return pl_group;}
+uint8_t Program::GetSapScope(void){return sap_scope;}
 
 bool   Program::IsPermanent(void){return permanent;}
 bool   Program::IsRTP(void){return b_rtp;}
@@ -68,6 +71,7 @@ void Program::SetPlGroup(const char *h){
 void Program::SetRTP(bool b){b_rtp = b;}
 void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;}
 void Program::SetPort(uint16_t p) { port = p; }
+void Program::SetSapScope(uint8_t s) { sap_scope = s; }
 
 void Program::SetTTL(const char *p){program_ttl=p;}
 
diff -urp minisapserver-0.3.6/program.h minisapserver-0.3.6-ajg/program.h
--- minisapserver-0.3.6/program.h	2009-01-11 19:50:43.000000000 +0000
+++ minisapserver-0.3.6-ajg/program.h	2009-04-22 22:13:46.000000000 +0100
@@ -21,6 +21,11 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define SAP_V4_AUTO_SCOPE 0
+#define SAP_V4_GLOBAL_SCOPE 1
+#define SAP_V4_ORG_SCOPE 2
+#define SAP_V4_LOCAL_SCOPE 3
+#define SAP_V4_LINK_SCOPE 4
 
 class Program
 {
@@ -38,6 +43,7 @@ class Program
     uint16_t GetPort();
     string GetTTL();
     string GetPlGroup();
+    uint8_t GetSapScope();
 
     /* Functions to set the values */
     void SetName(const char*);
@@ -50,6 +56,7 @@ class Program
     void SetPlGroup(const char *);
     void SetHasPlGroup(bool);
     void SetRTP(bool);
+    void SetSapScope(uint8_t);
 
     bool IsPermanent();
     bool IsRTP();
@@ -66,6 +73,7 @@ class Program
     bool permanent;
     bool b_rtp;
     bool b_has_pl_group;
+    uint8_t sap_scope;
     uint16_t port;
     uint32_t start_time;
     uint32_t stop_time;
diff -urp minisapserver-0.3.6/sap.cfg minisapserver-0.3.6-ajg/sap.cfg
--- minisapserver-0.3.6/sap.cfg	2008-02-06 21:05:34.000000000 +0000
+++ minisapserver-0.3.6-ajg/sap.cfg	2009-04-22 22:32:38.000000000 +0100
@@ -40,6 +40,9 @@ port=1234
 playlist_group=organisationTV 
 
 
+# Optional override for automatic SAP scope calculation
+# Valid options are global, org, local, link
+#scope=local
 
 # IPv6 example
 [program]
diff -urp minisapserver-0.3.6/sapserver.cpp minisapserver-0.3.6-ajg/sapserver.cpp
--- minisapserver-0.3.6/sapserver.cpp	2008-06-30 18:06:06.000000000 +0100
+++ minisapserver-0.3.6-ajg/sapserver.cpp	2009-04-22 22:28:02.000000000 +0100
@@ -214,6 +215,7 @@ int main(int argc, char *argv[])
 
             Announce *announce = new Announce;
             if (broadcast.GuessDestination (program->GetAddress ().c_str (),
+					    program->GetSapScope (),
                                             &announce->addr,
                                             &announce->addrlen))
             {
