Ejemplo n.º 1
0
int
fill_extra_addr(uchar * ip)
{
    const char *extra[] = {
        g_nameservers[0], g_nameservers[1]
    };
    int i, n;
    struct mvalue *mv = NULL;
    n = sizeof(extra) / sizeof(extra[0]);
    mv = (struct mvalue *) ip;
    ip = ip + sizeof(struct mvalue);
    mv->num = 0;
    mv->ttl = 0;
    mv->hits = 0;
    mv->len = 0;
    mv->seg = 0;
    for (i = 0; i < n; i++) {
        if (make_bin_from_str(ip, extra[i]) == 0) {
            mv->num++;
            mv->len += 4;       //4 bytes
            ip += 4;            //4 bytes
        }
    }
    mv = (struct mvalue *) ip;
    mv->num = 0;
    mv->ttl = 0;
    mv->hits = 0;
    mv->len = 0;
    mv->seg = 0;
    return 0;
}
Ejemplo n.º 2
0
int fill_extra_addr(struct qoutinfo *qo,uchar *ip)
{
 const char *extra[] = {
 "8.8.8.8", //google dns
 "202.102.154.3", //public dns of shandong province
};
 int i,n;
 struct mvalue *mv = NULL;
 n = sizeof(extra) / sizeof(extra[0]);
 mv = (struct mvalue*)ip;
 ip = ip + sizeof(struct mvalue);
 mv->num = 0;
 mv->ttl = 0;
 mv->hits = 0;
 mv->len = 0;
 for(i = 0;i < n;i ++)
	{
	 if(make_bin_from_str(ip,extra[i]) == 0)
		{
		 mv->num ++;
		 mv->len += 4; //4 bytes
		 ip += 4; //4 bytes
		}
	}
 mv = (struct mvalue*)ip;
 mv->num = 0;
 mv->ttl = 0;
 mv->hits = 0;
 mv->len = 0;
 return 0;
}