瀏覽代碼

added counter sources

tags/v1.1.0
root 5 年之前
父節點
當前提交
91a24444d8
共有 3 個檔案被更改,包括 10 行新增2 行删除
  1. 4
    0
      src/dp_dhcpv4.c
  2. 5
    1
      src/dp_dhcpv6.c
  3. 1
    1
      src/dp_dhcpv6.h

+ 4
- 0
src/dp_dhcpv4.c 查看文件

if ( offset+len>pktlen ) if ( offset+len>pktlen )
break; break;


// option 53 message type
if ( type == 53 && len == 1 )
dp_dhcpv4_cnt(*(uint8_t*)(pkt+offset+1));

// option 82 parser // option 82 parser
if ( type == 82 ) { if ( type == 82 ) {
unsigned char *o82 = pkt+offset; unsigned char *o82 = pkt+offset;

+ 5
- 1
src/dp_dhcpv6.c 查看文件

void dp_dhcpv6_check(dp_conf *conf, unsigned char *pkt, int pktlen, int offset, unsigned char **remoteid, int *remoteidlen) { void dp_dhcpv6_check(dp_conf *conf, unsigned char *pkt, int pktlen, int offset, unsigned char **remoteid, int *remoteidlen) {
uint8_t msgtype = (uint8_t)pkt[offset]; uint8_t msgtype = (uint8_t)pkt[offset];


dp_dhcpv6_cnt((uint16_t)msgtype);

if ( conf->debug ) printf("offset=%i\n",offset); if ( conf->debug ) printf("offset=%i\n",offset);


switch(msgtype) { switch(msgtype) {


offset+=4; offset+=4;


dp_dhcpv6_cnt(code);

if ( code == 9 ) { // relay message if ( code == 9 ) { // relay message
if ( conf->debug ) printf("option 9, relay msg\n"); if ( conf->debug ) printf("option 9, relay msg\n");
offset+=4; offset+=4;
} }
} }


dp_dhcpv6_stats *dp_dhcpv6_cnt(uint8_t msgcode) {
dp_dhcpv6_stats *dp_dhcpv6_cnt(uint16_t msgcode) {


if ( msgcode > 0 && msgcode < DP_DHCPV6_CODE_LEN ) { if ( msgcode > 0 && msgcode < DP_DHCPV6_CODE_LEN ) {
dp_v6_stats.relcnt[msgcode]++; dp_v6_stats.relcnt[msgcode]++;

+ 1
- 1
src/dp_dhcpv6.h 查看文件

unsigned char**, unsigned char**,
int*); int*);


dp_dhcpv6_stats *dp_dhcpv6_cnt(uint8_t);
dp_dhcpv6_stats *dp_dhcpv6_cnt(uint16_t);


#endif // __DP_MACRO #endif // __DP_MACRO

Loading…
取消
儲存