Older blog entries for lyxmoo (starting at number 5)

Title::An net-snmp API example program for Redback SMS 10000

//The example do one things: send a RBN subscriber reauth snmp to SMS //comile command as: gcc -o redweb redweb.c -lkstat -lm -lsocket -ladm -lnetsnmp -lcrypto

static char snmpreauth[]=".1.3.6.1.4.1.2352.2.14.1.2.1.1."; struct snmp_session session, *ss; struct snmp_pdu *response; struct snmp_pdu *pdu;

char snmpcommunity[32]; char snmpstr[256]; char tmpstr[128]; char *endptr;

oid name[512]; int name_length; int cnt,id=0; int snmpsetvalue=1;

init_mib(); add_mibdir("/opt/weblogin/mibs"); // include Redback Mibs file

snmp_sess_init(&session); session.version=SNMP_VERSION_1; session.peername=strdup(data.nas_address); session.community=strdup(snmpcommunity); session.community_len=strlen(session.community); session.retries=0; session.timeout=12000; session.sessid=strtol(data.timeid, &endptr, 0);

SOCK_STARTUP;

/* Macro * open an SNMP session */

ss = snmp_open(&session); if (ss == NULL) { /* * diagnose snmp_open errors with the input netsnmp_session pointer */ snmp_sess_perror("snmptable", &session); SOCK_CLEANUP; }

/* * create PDU for SET request and add object names and values to request */

pdu = (struct snmp_pdu *)snmp_pdu_create(SNMP_MSG_SET); if(pdu==NULL) { printf("Unable to create the pdu"); }

sprintf(snmpstr,"%s17",snmpreauth); for(cnt=0;cnt<17;cnt++) { sprintf(tmpstr,".%d",(char *)data.session_id[cnt]); // data.session_id MAC format string strcat(snmpstr,tmpstr); }

//FIXME name_length=512;

if(!read_objid(snmpstr,name,&name_length)){ printf("Error in read_objid\n");exit(1);};

snmp_pdu_add_variable(pdu,name,name_length,ASN_INTEGER,&snmpsetvalue,sizeof(snmpsetvalue)); status = snmp_synch_response(ss, pdu, &response); // sync snmp if (status == STAT_SUCCESS) { if (response->errstat == SNMP_ERR_NOERROR) { } exitval = 2; } else if (status == STAT_TIMEOUT) { fprintf(stderr, "SNMP Timeout: No Response from %s\n", session.peername); exitval = 1; } else { snmp_sess_perror("snmpset", ss); printf("snmp session else"); exitval = 1; }

if (response) snmp_free_pdu(response);

snmp_close(ss);

SOCK_CLEANUP;

/* Macro off * final a snmp session */

9 Nov 2003 (updated 9 Nov 2003 at 12:27 UTC) »

.Running on Linux only for getopt_long()

.You must use this program for DNS system security or DNS performance test only.

.Any Modify or Reprogram for discomfort target to anyother beyond my willing

.evil means no Attach me

lyxmoo@msn.com

http://www.xfocus.net/tools/200307/dnsflood.c

19 Mar 2003 (updated 1 Apr 2003 at 06:52 UTC) »
DNS benchmark 
8 Mar 2003 (updated 10 Mar 2003 at 16:25 UTC) »

THX God, there must be a chance to complete cacti installation from scratch;

24 Feb 2003 (updated 25 Feb 2003 at 08:59 UTC) »
After about 20 days hard work, it's been tested today.
the peak speed at 225k bytes/s  :)
but TCO not cheap......  Beside all ,it's worked for me..
paste shell script here:

---------- Compile kernel first -----------------

#with below options

[*] Socket Filtering <*> Unix domain sockets [*] TCP/IP networking [*] IP: multicasting [*] IP: advanced router [*] IP: policy routing [*] IP: use netfilter MARK value as routing key [*] IP: fast network address translation [*] IP: equal cost multipath [*] IP: use TOS value as routing key [*] IP: verbose route monitoring [*] IP: large routing tables

--------------------- Shell script BEGIN --------------------

echo 1 > /proc/sys/net/ipv4/ip_forward

dhclient eth0 dhclient eth1 # get ip address from ISP's CM-DHCPD

ifconfig eth2 172.19.0.1 netmask 255.255.0.0

ext_ip0=`ifconfig eth0 | grep inet | cut -f 2 -d : | cut -f 1 -d \ ` ext_ip1=`ifconfig eth1 | grep inet | cut -f 2 -d : | cut -f 1 -d \ `

insmod /lib/modules/2.4.20-xfs/kernel/net/sched/sch_teql.o

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source $ext_ip0 iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source $ext_ip1

dhcpd eth2 # set default route in dhcpd.conf as 172.19.0.1

gw0=`ip route list | grep eth0 | grep default | cut -f 3 -d \ ` gw1=`ip route list | grep eth1 | grep default | cut -f 3 -d \ `

route delete default gw $gw0 route delete default gw $gw1

ip route replace default nexthop via $gw0 dev eth0 weight 1 nexthop via $gw1 dev eth1 weight 1

ip route flush cache

21 Feb 2003 (updated 24 Feb 2003 at 13:56 UTC) »

This spring festival, I spend all the holiday on DOC & Linux-ip-chunk project.


------------- | eth0 | <-----> cable modem Private Network <--> | eth2 | (get ip from isp) (172.19.0.0)SNAT | .0.1 eth1 | <-----> cable modem ------------- (get ip from isp) Linux router

It's seemed a complex & puzzleheaded project.
I want to made Private Network bound transfer speed with all that egress connection

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!