From glebius@cell.sick.ru  Sun Oct 20 11:33:22 2002
Return-Path: <glebius@cell.sick.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9C46D37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Oct 2002 11:33:22 -0700 (PDT)
Received: from cell.sick.ru (cell.sick.ru [195.91.162.238])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A3F2F43E4A
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Oct 2002 11:33:21 -0700 (PDT)
	(envelope-from glebius@cell.sick.ru)
Received: from cell.sick.ru (glebius@localhost [127.0.0.1])
	by cell.sick.ru (8.12.6/8.12.6) with ESMTP id g9KIXFns016471
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Oct 2002 22:33:16 +0400 (MSD)
	(envelope-from glebius@cell.sick.ru)
Received: (from glebius@localhost)
	by cell.sick.ru (8.12.6/8.12.6/Submit) id g9KIXEtF016470;
	Sun, 20 Oct 2002 22:33:14 +0400 (MSD)
Message-Id: <200210201833.g9KIXEtF016470@cell.sick.ru>
Date: Sun, 20 Oct 2002 22:33:14 +0400 (MSD)
From: Gleb Smirnoff <glebius@cell.sick.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: make ppp(8) add clients MAC address to all RADIUS requests and responces
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         44310
>Category:       bin
>Synopsis:       make ppp(8) add clients MAC address to all RADIUS requests and responses
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brian
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 20 11:40:01 PDT 2002
>Closed-Date:    Thu Jul 15 09:47:14 GMT 2004
>Last-Modified:  Thu Jul 15 09:47:14 GMT 2004
>Originator:     Gleb Smirnoff
>Release:        FreeBSD 4.7-PRERELEASE i386
>Organization:
Moscow State University
>Environment:
System: FreeBSD cell.sick.ru 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #7: Fri Sep 6 02:58:47 MSD 2002 root@cell.sick.ru:/usr/obj/usr/src/sys/NUCLEUS i386

>Description:
	  The following patch makes ppp(8) to add clients' MAC address to RADIUS
	packet if it is serving PPPoE (is run from pppoed(8)). ppp(8) will write MAC
	to RADIUS variable RAD_CALLING_STATION_ID. It can not be messed with real
	station id's (which are phone numbers), because ppp(8) also adds
	variable RAD_NAS_PORT_TYPE = RAD_ETHERNET.
>How-To-Repeat:
	Without this it is impossible to determine from which machine
	did the PPPoE client came from.
>Fix:

--- /usr/src/usr.sbin/ppp/radius.c	Sun Sep  1 06:12:32 2002
+++ radius.c	Sun Oct 20 22:10:27 2002
@@ -726,6 +726,7 @@
   struct timeval tv;
   int got;
   char hostname[MAXHOSTNAMELEN];
+  char *mac_addr;
 #if 0
   struct hostent *hp;
   struct in_addr hostaddr;
@@ -866,6 +867,13 @@
     }
   }
 
+  if ((mac_addr = getenv("HISMACADDR")) != 0)
+    if (rad_put_string(r->cx.rad, RAD_CALLING_STATION_ID, mac_addr) !=0 ) {
+	log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad));
+	rad_close(r->cx.rad);
+	return;
+     }
+
   radius_put_physical_details(r->cx.rad, authp->physical);
 
   r->cx.auth = authp;
@@ -895,6 +903,7 @@
   struct timeval tv;
   int got;
   char hostname[MAXHOSTNAMELEN];
+  char *mac_addr;
 #if 0
   struct hostent *hp;
   struct in_addr hostaddr;
@@ -962,6 +971,13 @@
     rad_close(r->cx.rad);
     return;
   }
+
+  if ((mac_addr = getenv("HISMACADDR")) != 0)
+    if (rad_put_string(r->cx.rad, RAD_CALLING_STATION_ID, mac_addr) !=0 ) {
+	log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad));
+	rad_close(r->cx.rad);
+	return;
+     }
 
   if (gethostname(hostname, sizeof hostname) != 0)
     log_Printf(LogERROR, "rad_put: gethostname(): %s\n", strerror(errno));
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Sat Jun 26 00:42:17 GMT 2004 
State-Changed-Why:  
Committed to -current.  Will MFC in 2 weeks. 


Responsible-Changed-From-To: freebsd-bugs->brian 
Responsible-Changed-By: brian 
Responsible-Changed-When: Sat Jun 26 00:42:17 GMT 2004 
Responsible-Changed-Why:  
Committed by me... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44310 
State-Changed-From-To: closed->patched 
State-Changed-By: brian 
State-Changed-When: Sat Jun 26 12:09:01 GMT 2004 
State-Changed-Why:  
Stay in patched state 'till MFC 
Suggested by: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl> 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44310 
State-Changed-From-To: patched->closed 
State-Changed-By: brian 
State-Changed-When: Thu Jul 15 09:47:01 GMT 2004 
State-Changed-Why:  
This has been MFC'd 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44310 
>Unformatted:
