diff -ruN freeradius-1.1.2.orig/src/include/radiusd.h freeradius-1.1.2/src/include/radiusd.h
--- freeradius-1.1.2.orig/src/include/radiusd.h	2005-04-11 15:45:21.000000000 -0800
+++ freeradius-1.1.2/src/include/radiusd.h	2006-07-27 15:02:45.000000000 -0800
@@ -293,7 +293,7 @@
 int		session_zap(REQUEST *request, uint32_t nasaddr,
 			    unsigned int port, const char *user,
 			    const char *sessionid, uint32_t cliaddr,
-			    char proto);
+			    char proto, char nas_ident);
 
 /* radiusd.c */
 #ifndef _LIBRADIUS
diff -ruN freeradius-1.1.2.orig/src/main/session.c freeradius-1.1.2/src/main/session.c
--- freeradius-1.1.2.orig/src/main/session.c	2006-03-24 08:54:57.000000000 -0900
+++ freeradius-1.1.2/src/main/session.c	2006-07-27 15:02:45.000000000 -0800
@@ -46,7 +46,7 @@
 /* End a session by faking a Stop packet to all accounting modules */
 int session_zap(REQUEST *request, uint32_t nasaddr, unsigned int port,
 		const char *user,
-		const char *sessionid, uint32_t cliaddr, char proto)
+		const char *sessionid, uint32_t cliaddr, char proto, char nas_ident)
 {
 	REQUEST *stopreq;
 	VALUE_PAIR *vp, *userpair;
@@ -103,6 +103,8 @@
 	INTPAIR(PW_ACCT_INPUT_PACKETS, 0);
 	INTPAIR(PW_ACCT_OUTPUT_PACKETS, 0);
 
+	INTPAIR(PW_NAS_IDENTIFIER, nas_ident);
+
 	stopreq->username = userpair;
 	stopreq->password = NULL;
 
diff -ruN freeradius-1.1.2.orig/src/modules/rlm_radutmp/rlm_radutmp.c freeradius-1.1.2/src/modules/rlm_radutmp/rlm_radutmp.c
--- freeradius-1.1.2.orig/src/modules/rlm_radutmp/rlm_radutmp.c	2004-02-26 10:04:34.000000000 -0900
+++ freeradius-1.1.2/src/modules/rlm_radutmp/rlm_radutmp.c	2006-07-27 15:03:17.000000000 -0800
@@ -589,6 +589,7 @@
 	rlm_radutmp_t	*inst = instance;
 	char		login[256];
 	char		filename[1024];
+	char		nas_ident;
 
 	/*
 	 *	Get the filename, via xlat.
@@ -656,6 +657,8 @@
 		ipno = vp->lvalue;
 	if ((vp = pairfind(request->packet->vps, PW_CALLING_STATION_ID)) != NULL)
 		call_num = vp->strvalue;
+	if ((vp = pairfind(request->packet->vps, PW_NAS_IDENTIFIER)) != NULL)
+		nas_ident = vp->strvalue;
 
 	/*
 	 *	lock the file while reading/writing.
@@ -736,7 +739,7 @@
 				session_zap(request,
 					    u.nas_address, u.nas_port, login,
 					    session_id, u.framed_address,
-					    u.proto);
+					    u.proto, nas_ident);
 			}
 		}
 	}
diff -ruN freeradius-1.1.2.orig/src/modules/rlm_sql/rlm_sql.c freeradius-1.1.2/src/modules/rlm_sql/rlm_sql.c
--- freeradius-1.1.2.orig/src/modules/rlm_sql/rlm_sql.c	2006-05-20 04:44:37.000000000 -0800
+++ freeradius-1.1.2/src/modules/rlm_sql/rlm_sql.c	2006-07-27 15:03:46.000000000 -0800
@@ -1132,6 +1132,7 @@
 	int		ret;
 	uint32_t	nas_addr = 0;
 	int		nas_port = 0;
+	char		nas_ident;
 
 	/* If simul_count_query is not defined, we don't do any checking */
 	if (inst->config->simul_count_query[0] == 0) {
@@ -1207,7 +1208,8 @@
                 ipno = vp->lvalue;
         if ((vp = pairfind(request->packet->vps, PW_CALLING_STATION_ID)) != NULL)
                 call_num = vp->strvalue;
-
+	if ((vp = pairfind(request->packet->vps, PW_NAS_IDENTIFIER)) != NULL)
+		nas_ident = vp->strvalue;
 
 	while (rlm_sql_fetch_row(sqlsocket, inst) == 0) {
 		row = sqlsocket->row;
@@ -1271,7 +1273,7 @@
 
 			session_zap(request,
 				    nas_addr,nas_port,row[2],row[1],
-				    framed_addr, proto);
+				    framed_addr, proto, nas_ident);
 		}
 	}
 
