[RP-PPPoE] rp-pppoe with PPPoE Indermediate Agent

Evgeniy Kozhuhovskiy ugenk at mgts.by
Sat Aug 1 04:58:24 EDT 2009


Here is the beta version of %subj%:

http://deb10.mgts.by/shared/rp-pppoe-3.10-pia.tar.gz

md5: b77dff65e16bef77aa42ab5dc18af052  rp-pppoe-3.10-pia.tar.gz

almost everything is documented in man page of pppoe-server

in this version, due to bugs in some (in fact, siemens dslams) DSLAMs 
all PIA information encoded into hex, you can decode it
on radius side with smthing like:
<?php
function hex2ascii($string)
{
                 $hex_ = preg_replace("/[^0-9a-fA-F]/","", $string);
                 for($i = 0; $i < strlen($hex_); $i = $i + 2)
                         $ascii = $ascii.chr(hexdec(substr($hex_, $i, 2)));
                 echo $ascii;
}
?>

or in c:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void hex2ascii(char *dest, char *src){
	int i;
	char tmp[4]={0x0};
	char **ptr=NULL,
	     *buf=dest;
	*buf=0x0;
	if(*src){
		for(i=0;src[i];i+=2){
			strncpy(tmp,&src[i],2);
			sprintf(tmp,"%c",strtol(tmp,ptr,16) );
			*buf++=tmp[0];
		}
	}
	*buf=0x0;
}

int main(int argc, char *argv[])
{
	char *d;
	if (argc != 2) return 1;
	d = malloc(strlen(argv[1])/2);
	hex2ascii(d, argv[1]);
	printf("%s\n", d);
	return 0;

}

example:

$ ./a.out 4154532D3230332061746D2030392F30373A302E3333
ATS-203 atm 09/07:0.33

in next version it will be a possibility to enable/disable this encoding 
with command-line option.

-- 
With best regards, Evgeniy Kozhuhovskiy
Leader of Services group, MGTS, RUE Beltelecom


More information about the RP-PPPoE mailing list