diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-12-01 16:40:04 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-12-01 16:40:04 +0300 |
commit | 574912df113888ea19b4811b406612544514d9eb (patch) | |
tree | a7fec6d150d8710b31d4730ef7fab5c4c9ce4417 | |
parent | 3cc7fd0165e096be25761710b66b44fda9d09190 (diff) | |
parent | e09279c7491a8bd16a25b123e03ddd0cd77b566d (diff) | |
download | accel-ppp-574912df113888ea19b4811b406612544514d9eb.tar.gz accel-ppp-574912df113888ea19b4811b406612544514d9eb.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/accel-ppp/code
137 files changed, 2773 insertions, 2775 deletions
diff --git a/accel-pppd/auth/auth_chap_md5.c b/accel-pppd/auth/auth_chap_md5.c index 5be8b875..9df39eff 100644 --- a/accel-pppd/auth/auth_chap_md5.c +++ b/accel-pppd/auth/auth_chap_md5.c @@ -147,7 +147,7 @@ static int chap_finish(struct ppp_t *ppp, struct auth_data_t *auth) if (d->interval.tpd) triton_timer_del(&d->interval); - + if (d->name) _free(d->name); @@ -175,7 +175,7 @@ static void chap_timeout_timer(struct triton_timer_t *t) static void chap_restart_timer(struct triton_timer_t *t) { struct chap_auth_data *d = container_of(t, typeof(*d), interval); - + chap_send_challenge(d, 1); } @@ -201,7 +201,7 @@ static void chap_send_failure(struct chap_auth_data *ad) .hdr.len = htons(sizeof(msg) - 1 - 2), .message = MSG_FAILURE, }; - + if (conf_ppp_verbose) log_ppp_info2("send [CHAP Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE); @@ -217,7 +217,7 @@ static void chap_send_success(struct chap_auth_data *ad, int id) .hdr.len = htons(sizeof(msg)-1-2), .message = MSG_SUCCESS, }; - + if (conf_ppp_verbose) log_ppp_info2("send [CHAP Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS); @@ -301,7 +301,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2); log_ppp_info2("\"]\n"); } - + if (ad->started && msg->hdr.id == ad->id - 1) { chap_send_success(ad, msg->hdr.id); return; @@ -364,7 +364,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) MD5_Update(&md5_ctx,passwd,strlen(passwd)); MD5_Update(&md5_ctx,ad->val,VALUE_SIZE); MD5_Final(md5,&md5_ctx); - + if (memcmp(md5,msg->val,sizeof(md5))) { if (conf_ppp_verbose) @@ -389,7 +389,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) } } else _free(name); - + ad->id++; } _free(passwd); @@ -429,7 +429,7 @@ static int chap_check(uint8_t *ptr) static int chap_restart(struct ppp_t *ppp, struct auth_data_t *auth) { struct chap_auth_data *d = container_of(auth, typeof(*d), auth); - + chap_send_challenge(d, 1); return 0; @@ -491,7 +491,7 @@ static void auth_chap_md5_init() if (ppp_auth_register_handler(&chap)) log_emerg("chap-md5: failed to register handler\n"); - + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); } diff --git a/accel-pppd/auth/auth_mschap_v1.c b/accel-pppd/auth/auth_mschap_v1.c index d9232cc9..bf78f23e 100644 --- a/accel-pppd/auth/auth_mschap_v1.c +++ b/accel-pppd/auth/auth_mschap_v1.c @@ -176,7 +176,7 @@ static void chap_timeout_timer(struct triton_timer_t *t) static void chap_restart_timer(struct triton_timer_t *t) { struct chap_auth_data *d = container_of(t, typeof(*d), interval); - + chap_send_challenge(d, 1); } @@ -218,7 +218,7 @@ static void chap_send_success(struct chap_auth_data *ad, int id) hdr->id = id; hdr->len = htons(HDR_LEN + strlen(conf_msg_success)); strcpy((char *)(hdr + 1), conf_msg_success); - + if (conf_ppp_verbose) log_ppp_info2("send [MSCHAP-v1 Success id=%x \"%s\"]\n", hdr->id, conf_msg_success); @@ -278,14 +278,14 @@ static void auth_result(struct chap_auth_data *ad, int res) name = NULL; } } - + ad->id++; if (ad->mschap_error != conf_msg_failure) { _free(ad->mschap_error); ad->mschap_error = conf_msg_failure; } - + if (name) _free(name); } @@ -358,7 +358,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) ad->mschap_error = conf_msg_failure; r = pwdb_check(&ad->ppp->ses, (pwdb_callback)auth_result, ad, name, PPP_CHAP, MSCHAP_V1, ad->id, ad->val, VALUE_SIZE, msg->lm_hash, msg->nt_hash, msg->flags, &ad->mschap_error); - + if (r == PWDB_WAIT) { ad->name = name; return; @@ -367,7 +367,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) if (r == PWDB_NO_IMPL) if (chap_check_response(ad, msg, name)) r = PWDB_DENIED; - + if (r == PWDB_DENIED) { chap_send_failure(ad, ad->mschap_error); if (ad->started) @@ -426,7 +426,7 @@ static void des_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *outpu DES_set_key_checked(&cb, &ks); memcpy(cb, input, 8); DES_ecb_encrypt(&cb, &res, &ks, DES_ENCRYPT); - memcpy(output, res, 8); + memcpy(output, res, 8); } static int chap_check_response(struct chap_auth_data *ad, struct chap_response *msg, const char *name) @@ -437,7 +437,7 @@ static int chap_check_response(struct chap_auth_data *ad, struct chap_response * char *passwd; char *u_passwd; int i; - + passwd = pwdb_get_passwd(&ad->ppp->ses, name); if (!passwd) { if (conf_ppp_verbose) @@ -497,7 +497,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash) SHA1_Update(&sha_ctx, digest, 16); SHA1_Update(&sha_ctx, digest, 16); SHA1_Update(&sha_ctx, ad->val, VALUE_SIZE); - SHA1_Final(digest, &sha_ctx); + SHA1_Final(digest, &sha_ctx); triton_event_fire(EV_MPPE_KEYS, &ev_mppe); } @@ -505,7 +505,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash) static int chap_restart(struct ppp_t *ppp, struct auth_data_t *auth) { struct chap_auth_data *d = container_of(auth, typeof(*d), auth); - + chap_send_challenge(d, 1); return 0; diff --git a/accel-pppd/auth/auth_mschap_v2.c b/accel-pppd/auth/auth_mschap_v2.c index 0235ddf0..f416c434 100644 --- a/accel-pppd/auth/auth_mschap_v2.c +++ b/accel-pppd/auth/auth_mschap_v2.c @@ -19,7 +19,7 @@ #include "memdebug.h" -#define MSCHAP_V2 0x81 +#define MSCHAP_V2 0x81 #define CHAP_CHALLENGE 1 #define CHAP_RESPONSE 2 @@ -119,7 +119,7 @@ static void auth_data_free(struct ppp_t *ppp, struct auth_data_t *auth) if (d->interval.tpd) triton_timer_del(&d->interval); - + _free(d); } @@ -177,7 +177,7 @@ static void chap_timeout_timer(struct triton_timer_t *t) static void chap_restart_timer(struct triton_timer_t *t) { struct chap_auth_data *d = container_of(t, typeof(*d), interval); - + chap_send_challenge(d, 1); } @@ -203,7 +203,7 @@ static void chap_send_failure(struct chap_auth_data *ad, char *mschap_error, cha hdr->len = htons(HDR_LEN + strlen(mschap_error) + strlen(reply_msg) + 3); sprintf((char *)(hdr + 1), "%s M=%s", mschap_error, reply_msg); - + if (conf_ppp_verbose) log_ppp_info2("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", hdr->id, (char *)(hdr + 1)); @@ -240,7 +240,7 @@ static int generate_response(struct chap_auth_data *ad, struct chap_response *ms uint8_t c_hash[SHA_DIGEST_LENGTH]; uint8_t response[SHA_DIGEST_LENGTH]; int i; - + uint8_t magic1[39] = {0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65, @@ -290,10 +290,10 @@ static int generate_response(struct chap_auth_data *ad, struct chap_response *ms SHA1_Update(&sha_ctx,c_hash,8); SHA1_Update(&sha_ctx,magic2,41); SHA1_Final(response,&sha_ctx); - + for(i=0; i<20; i++) sprintf(authenticator+i*2,"%02X",response[i]); - + _free(passwd); _free(u_passwd); @@ -351,19 +351,19 @@ static void auth_result(struct chap_auth_data *ad, int res) name = NULL; } } - + ad->id++; if (ad->mschap_error != conf_msg_failure) { _free(ad->mschap_error); ad->mschap_error = conf_msg_failure; } - + if (ad->reply_msg != conf_msg_failure2) { _free(ad->reply_msg); ad->reply_msg = conf_msg_failure2; } - + if (name) _free(name); } @@ -398,7 +398,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) if (ad->name) return; - + ad->mschap_error = conf_msg_failure; ad->reply_msg = conf_msg_failure2; @@ -427,7 +427,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) ppp_auth_failed(ad->ppp, NULL); return; } - + r = pwdb_check(&ad->ppp->ses, (pwdb_callback)auth_result, ad, name, PPP_CHAP, MSCHAP_V2, ad->id, ad->val, msg->peer_challenge, msg->reserved, msg->nt_hash, msg->flags, authenticator, &ad->mschap_error, &ad->reply_msg); if (r == PWDB_WAIT) { @@ -449,7 +449,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr) ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); else ppp_auth_failed(ad->ppp, name); - + _free(name); if (ad->mschap_error != conf_msg_failure) { @@ -508,7 +508,7 @@ static void des_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *outpu DES_set_key_checked(&cb, &ks); memcpy(cb,input,8); DES_ecb_encrypt(&cb,&res,&ks,DES_ENCRYPT); - memcpy(output,res,8); + memcpy(output,res,8); } static int chap_check_response(struct chap_auth_data *ad, struct chap_response *msg, const char *name) @@ -521,7 +521,7 @@ static int chap_check_response(struct chap_auth_data *ad, struct chap_response * char *passwd; char *u_passwd; int i; - + passwd = pwdb_get_passwd(&ad->ppp->ses, name); if (!passwd) { if (conf_ppp_verbose) @@ -566,7 +566,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash, uint8_t *n uint8_t digest[20]; uint8_t send_key[20]; uint8_t recv_key[20]; - + uint8_t pad1[40] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -612,7 +612,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash, uint8_t *n .recv_key = recv_key, .send_key = send_key, }; - + //NtPasswordHashHash MD4_Init(&md4_ctx); MD4_Update(&md4_ctx, z_hash, 16); @@ -652,7 +652,7 @@ static int chap_check(uint8_t *ptr) static int chap_restart(struct ppp_t *ppp, struct auth_data_t *auth) { struct chap_auth_data *d = container_of(auth, typeof(*d), auth); - + chap_send_challenge(d, 1); return 0; diff --git a/accel-pppd/auth/auth_pap.c b/accel-pppd/auth/auth_pap.c index 909b115e..15154bf8 100644 --- a/accel-pppd/auth/auth_pap.c +++ b/accel-pppd/auth/auth_pap.c @@ -105,10 +105,10 @@ static int pap_start(struct ppp_t *ppp, struct auth_data_t *auth) static int pap_finish(struct ppp_t *ppp, struct auth_data_t *auth) { struct pap_auth_data *d = container_of(auth, typeof(*d), auth); - + if (d->timeout.tpd) triton_timer_del(&d->timeout); - + if (d->peer_id) _free(d->peer_id); @@ -147,10 +147,10 @@ static void pap_send_ack(struct pap_auth_data *p, int id) msg->hdr.len = htons(HDR_LEN + 1 + sizeof(MSG_SUCCESSED) - 1); msg->msg_len = sizeof(MSG_SUCCESSED) - 1; memcpy(msg->msg, MSG_SUCCESSED, sizeof(MSG_SUCCESSED)); - + if (conf_ppp_verbose) log_ppp_info2("send [PAP AuthAck id=%x \"%s\"]\n", id, MSG_SUCCESSED); - + ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2); } @@ -164,10 +164,10 @@ static void pap_send_nak(struct pap_auth_data *p, int id) msg->hdr.len = htons(HDR_LEN + 1 + sizeof(MSG_FAILED) - 1); msg->msg_len = sizeof(MSG_FAILED) - 1; memcpy(msg->msg, MSG_FAILED, sizeof(MSG_FAILED)); - + if (conf_ppp_verbose) log_ppp_info2("send [PAP AuthNak id=%x \"%s\"]\n", id, MSG_FAILED); - + ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2); } @@ -236,7 +236,7 @@ static int pap_recv_req(struct pap_auth_data *p, struct pap_hdr *hdr) } peer_id = _strndup((const char*)peer_id, peer_id_len); - + if (conf_any_login) { if (ppp_auth_succeeded(p->ppp, peer_id)) { pap_send_nak(p, hdr->id); @@ -293,17 +293,17 @@ static int pap_recv_req(struct pap_auth_data *p, struct pap_hdr *hdr) _free(passwd); return ret; - + failed: pap_send_nak(p, hdr->id); if (p->started) ap_session_terminate(&p->ppp->ses, TERM_AUTH_ERROR, 0); else ppp_auth_failed(p->ppp, peer_id); - + _free(passwd); _free(peer_id); - + return -1; } diff --git a/accel-pppd/backup/backup.c b/accel-pppd/backup/backup.c index 16349fc7..18e9332f 100644 --- a/accel-pppd/backup/backup.c +++ b/accel-pppd/backup/backup.c @@ -15,7 +15,7 @@ static LIST_HEAD(module_list); struct backup_tag __export *backup_add_tag(struct backup_mod *m, uint8_t id, int internal, const void *data, size_t size) { struct backup_tag *t; - + t = m->data->storage->alloc_tag(m->data, size); if (!t) return NULL; @@ -39,7 +39,7 @@ void backup_add_fd(struct backup_mod *m, int fd) struct backup_mod __export *backup_find_mod(struct backup_data *d, uint8_t mod_id) { struct backup_mod *m; - + list_for_each_entry(m, &d->mod_list, entry) { if (m->id == mod_id) return m; @@ -232,19 +232,19 @@ void __export backup_register_storage(struct backup_storage *s) void backup_restore_fd() { - + } void backup_restore(int internal) { struct backup_storage *storage; struct backup_module *module; - + list_for_each_entry(storage, &storage_list, entry) { if (storage->restore) storage->restore(internal); } - + list_for_each_entry(module, &module_list, entry) { if (module->restore_complete) module->restore_complete(); diff --git a/accel-pppd/backup/backup.h b/accel-pppd/backup/backup.h index 0037596a..3d3d77ec 100644 --- a/accel-pppd/backup/backup.h +++ b/accel-pppd/backup/backup.h @@ -41,7 +41,7 @@ struct backup_data struct list_head mod_list; int internal:1; }; - + struct backup_module { struct list_head entry; @@ -49,7 +49,7 @@ struct backup_module int (*save)(struct ap_session *, struct backup_mod *); int (*restore)(struct ap_session *, struct backup_mod *); - + struct ap_session *(*ctrl_restore)(struct backup_mod *); void (*ctrl_start)(struct ap_session *ses); void (*restore_complete)(void); @@ -61,18 +61,18 @@ struct backup_storage /*int (*check_integrity)(void); int (*restore)(int internal);*/ - + void (*restore)(int internal); struct backup_data *(*create)(struct ap_session *); int (*commit)(struct backup_data *); void (*free)(struct backup_data *); - + struct backup_mod *(*alloc_mod)(struct backup_data *); void (*free_mod)(struct backup_mod *); void (*add_fd)(struct backup_data *, int fd); - + struct backup_tag *(*alloc_tag)(struct backup_data *, int size); void (*free_tag)(struct backup_data *, struct backup_tag *); }; diff --git a/accel-pppd/backup/backup_file.c b/accel-pppd/backup/backup_file.c index b9d26466..06dc02d4 100644 --- a/accel-pppd/backup/backup_file.c +++ b/accel-pppd/backup/backup_file.c @@ -78,7 +78,7 @@ static int fs_commit(struct backup_data *d) MD5_Init(&md5); MD5_Update(&md5, &version, 1); - + iov[0].iov_base = &version; iov[0].iov_len = 1; i = 1; @@ -145,7 +145,7 @@ static int fs_commit(struct backup_data *d) } return 0; - + out_err: close(fd); unlink(fname); @@ -159,10 +159,10 @@ static void fs_free(struct backup_data *d) if (fsd->map_addr) munmap(fsd->map_addr, fsd->map_len); - + if (fsd->fd != -1) close(fsd->fd); - + sprintf(fname, "%s/%s", conf_path, d->ses->sessionid); unlink(fname); @@ -190,10 +190,10 @@ static void fs_free_mod(struct backup_mod *mod) static struct backup_tag *fs_alloc_tag(struct backup_data *d, int size) { struct backup_tag *t = _malloc(sizeof(struct backup_tag) + 4 + size); - + if (!t) return NULL; - + memset(t, 0, sizeof(*t)); t->data = (uint8_t *)(t + 1) + 4; @@ -240,7 +240,7 @@ static void restore_session(const char *fn, int internal) close(fd); return; } - + if (*ptr != VERSION) goto out; @@ -250,11 +250,11 @@ static void restore_session(const char *fn, int internal) if (memcmp(md5_buf, ptr + st.st_size - 16, 16)) goto out; - + d = fs_create(NULL); if (!d) goto out; - + d->internal = internal; fsd = container_of(d, typeof(*fsd), data); @@ -304,10 +304,10 @@ static void fs_restore(int internal) { DIR *dirp; struct dirent ent, *res; - + if (!conf_path) return; - + dirp = opendir(conf_path); if (!dirp) { log_emerg("backup_file: opendir: %s\n", strerror(errno)); diff --git a/accel-pppd/cli/cli.c b/accel-pppd/cli/cli.c index 8b5f5165..7d440727 100644 --- a/accel-pppd/cli/cli.c +++ b/accel-pppd/cli/cli.c @@ -49,7 +49,7 @@ void __export cli_register_simple_cmd2( c = malloc(sizeof(*c)); memset(c, 0, sizeof(*c)); - + c->exec = exec; c->help = help; c->hdr_len = hdr_len; @@ -57,7 +57,7 @@ void __export cli_register_simple_cmd2( for (i = 0; i < hdr_len; i++) c->hdr[i] = va_arg(ap, char *); - + list_add_tail(&c->entry, &simple_cmd_list); va_end(ap); @@ -319,7 +319,7 @@ out_found: static void load_config(void) { const char *opt; - + if (conf_cli_passwd) _free(conf_cli_passwd); opt = conf_get_opt("cli", "password"); @@ -327,7 +327,7 @@ static void load_config(void) conf_cli_passwd = _strdup(opt); else conf_cli_passwd = NULL; - + if (conf_cli_prompt && conf_cli_prompt != def_cli_prompt) _free(conf_cli_prompt); opt = conf_get_opt("cli", "prompt"); diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c index 84ccb70b..6a6732b3 100644 --- a/accel-pppd/cli/show_sessions.c +++ b/accel-pppd/cli/show_sessions.c @@ -103,7 +103,7 @@ static void free_row(struct row_t *row) static void insert_row(struct list_head *list, struct row_t *row) { struct row_t *row2, *row3; - + row3 = NULL; list_for_each_entry(row2, list, entry) { if (strcmp(row->order_key, row2->order_key) <= 0) { @@ -213,7 +213,7 @@ static int show_ses_exec(const char *cmd, char * const *f, int f_cnt, void *cli) col->hidden = 1; list_add_tail(&col->entry, &c_list); } - + if (order_key && !order_key_f) { col = _malloc(sizeof(*col)); col->column = order_key; diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c index 84a7711c..38e6a8b6 100644 --- a/accel-pppd/cli/std_cmd.c +++ b/accel-pppd/cli/std_cmd.c @@ -113,7 +113,7 @@ static int terminate_exec1(char * const *f, int f_cnt, void *cli) pcre *re; const char *pcre_err; int pcre_offset; - + if (f_cnt == 5) { if (!strcmp(f[4], "hard")) hard = 1; @@ -121,7 +121,7 @@ static int terminate_exec1(char * const *f, int f_cnt, void *cli) return CLI_CMD_SYNTAX; } else if (f_cnt != 4) return CLI_CMD_SYNTAX; - + re = pcre_compile2(f[3], 0, NULL, &pcre_err, &pcre_offset, NULL); if (!re) { cli_sendv(cli, "match: %s at %i\r\n", pcre_err, pcre_offset); @@ -140,9 +140,9 @@ static int terminate_exec1(char * const *f, int f_cnt, void *cli) triton_context_call(ses->ctrl->ctx, (triton_event_func)__terminate_soft, ses); } pthread_rwlock_unlock(&ses_lock); - + pcre_free(re); - + return CLI_CMD_OK; } @@ -151,7 +151,7 @@ static int terminate_exec2(int key, char * const *f, int f_cnt, void *cli) struct ap_session *ses; int hard = 0; in_addr_t ipaddr = 0; - + if (f_cnt == 4) { if (!strcmp(f[3], "hard")) hard = 1; @@ -159,10 +159,10 @@ static int terminate_exec2(int key, char * const *f, int f_cnt, void *cli) return CLI_CMD_SYNTAX; } else if (f_cnt != 3) return CLI_CMD_SYNTAX; - + if (key == 1) ipaddr = inet_addr(f[2]); - + pthread_rwlock_rdlock(&ses_lock); list_for_each_entry(ses, &ses_list, entry) { switch (key) { @@ -205,7 +205,7 @@ static int terminate_exec(const char *cmd, char * const *fields, int fields_cnt, if (fields_cnt == 1) return CLI_CMD_SYNTAX; - + if (!strcmp(fields[1], "match") && fields_cnt > 3 && !strcmp(fields[2], "username")) return terminate_exec1(fields, fields_cnt, client); else if (!strcmp(fields[1], "username")) @@ -220,7 +220,7 @@ static int terminate_exec(const char *cmd, char * const *fields, int fields_cnt, return terminate_exec2(4, fields, fields_cnt, client); else if (strcmp(fields[1], "all")) return CLI_CMD_SYNTAX; - + if (fields_cnt == 3) { if (!strcmp(fields[2], "hard")) hard = 1; @@ -228,7 +228,7 @@ static int terminate_exec(const char *cmd, char * const *fields, int fields_cnt, return CLI_CMD_SYNTAX; } else if (fields_cnt != 2) return CLI_CMD_SYNTAX; - + pthread_rwlock_rdlock(&ses_lock); list_for_each_entry(ses, &ses_list, entry) { if (hard) diff --git a/accel-pppd/cli/tcp.c b/accel-pppd/cli/tcp.c index 9f60cbf3..2a6bfdee 100644 --- a/accel-pppd/cli/tcp.c +++ b/accel-pppd/cli/tcp.c @@ -94,7 +94,7 @@ static int cli_client_send(struct cli_client_t *tcln, const void *_buf, int size if (cln->disconnect) return -1; - + if (!list_empty(&cln->xmit_queue)) { b = _malloc(sizeof(*b) + size); b->size = size; @@ -197,10 +197,10 @@ static int cln_write(struct triton_md_handler_t *h) { struct tcp_client_t *cln = container_of(h, typeof(*cln), hnd); int k; - + if (!cln->xmit_buf) return 0; - + while (1) { for (; cln->xmit_pos < cln->xmit_buf->size; cln->xmit_pos += k) { k = write(cln->hnd.fd, cln->xmit_buf->buf + cln->xmit_pos, cln->xmit_buf->size - cln->xmit_pos); @@ -312,7 +312,7 @@ static void start_server(const char *host, int port) log_emerg("cli: tcp: failed to create server socket: %s\n", strerror(errno)); return; } - + fcntl(serv_hnd.fd, F_SETFD, fcntl(serv_hnd.fd, F_GETFD) | FD_CLOEXEC); memset(&addr, 0, sizeof(addr)); @@ -323,7 +323,7 @@ static void start_server(const char *host, int port) else addr.sin_addr.s_addr = htonl(INADDR_ANY); - setsockopt(serv_hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv_hnd.fd, 4); + setsockopt(serv_hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv_hnd.fd, 4); if (bind (serv_hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { log_emerg("cli: tcp: failed to bind socket: %s\n", strerror(errno)); close(serv_hnd.fd); @@ -341,7 +341,7 @@ static void start_server(const char *host, int port) close(serv_hnd.fd); return; } - + addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = inet_addr(host); @@ -383,15 +383,15 @@ static void init(void) port = atoi(d + 1); if (port <= 0) goto err_fmt; - + load_config(); temp_buf = malloc(RECV_BUF_SIZE); start_server(host, port); - + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); - + return; err_fmt: log_emerg("cli: tcp: invalid format\n"); diff --git a/accel-pppd/cli/telnet.c b/accel-pppd/cli/telnet.c index cece88ee..de2f39ff 100644 --- a/accel-pppd/cli/telnet.c +++ b/accel-pppd/cli/telnet.c @@ -142,7 +142,7 @@ static int telnet_send(struct telnet_client_t *cln, const void *_buf, int size) if (cln->disconnect) return -1; - + if (!list_empty(&cln->xmit_queue)) { b = _malloc(sizeof(*b) + size); b->size = size; @@ -212,10 +212,10 @@ static int send_password_request(struct telnet_client_t *cln) if (telnet_send(cln, buf0, sizeof(buf0))) return -1; - + if (telnet_send(cln, buf1, sizeof(buf1))) return -1; - + return 0; } @@ -240,10 +240,10 @@ static int send_cmdline_tail(struct telnet_client_t *cln, int corr) return -1; memset(temp_buf, '\b', cln->cmdline_len - cln->cmdline_pos - corr); - + if (telnet_send(cln, temp_buf, cln->cmdline_len - cln->cmdline_pos - corr)) return -1; - + return 0; } @@ -276,7 +276,7 @@ static int telnet_input_char(struct telnet_client_t *cln, uint8_t c) if (c == '\n') return 0; - + if (c == '\r') { cln->cmdline[cln->cmdline_len] = 0; @@ -304,14 +304,14 @@ static int telnet_input_char(struct telnet_client_t *cln, uint8_t c) b->size = cln->cmdline_len; list_add(&b->entry, cln->history.next); cln->history_pos = cln->history.next; - + if (conf_verbose == 2) log_info2("cli: %s: %s\n", inet_ntoa(cln->addr.sin_addr), cln->cmdline); if (cli_process_cmd(&cln->cli_client)) return -1; } - + cln->cmdline_pos = 0; cln->cmdline_len = 0; @@ -346,7 +346,7 @@ static int telnet_input_char(struct telnet_client_t *cln, uint8_t c) if (c != SE) return 0; } - + cln->telcmd = 0; } else if (cln->esc) { if (cln->cmdline_pos2 == RECV_BUF_SIZE - 1) { @@ -360,7 +360,7 @@ static int telnet_input_char(struct telnet_client_t *cln, uint8_t c) if (cln->cmdline_pos2 - cln->cmdline_len != 2) return 0; - + cln->esc = 0; if (cln->auth) { @@ -413,14 +413,14 @@ static int telnet_input_char(struct telnet_client_t *cln, uint8_t c) if (cln->cmdline_pos) { if (cln->cmdline_pos < cln->cmdline_len) { memmove(cln->cmdline + cln->cmdline_pos - 1, cln->cmdline + cln->cmdline_pos, cln->cmdline_len - cln->cmdline_pos); - + cln->cmdline[cln->cmdline_len - 1] = ' '; - + if (telnet_send(cln, "\b", 1)) return -1; - + cln->cmdline_pos--; - + if (send_cmdline_tail(cln, 0)) return -1; } else { @@ -459,7 +459,7 @@ static int telnet_input_char(struct telnet_client_t *cln, uint8_t c) return -1; } } - + if (cln->cmdline_pos < cln->cmdline_len) { if (send_cmdline_tail(cln, 0)) return -1; @@ -585,9 +585,9 @@ static int serv_read(struct triton_md_handler_t *h) list_add(&b2->entry, conn->history.next); } pthread_mutex_unlock(&history_lock); - + conn->history_pos = conn->history.next; - + conn->cli_client.cmdline = conn->cmdline; conn->cli_client.send = cli_client_send; conn->cli_client.sendv = cli_client_sendv; @@ -649,7 +649,7 @@ static void start_server(const char *host, int port) log_emerg("cli: telnet: failed to create server socket: %s\n", strerror(errno)); return; } - + fcntl(serv_hnd.fd, F_SETFD, fcntl(serv_hnd.fd, F_GETFD) | FD_CLOEXEC); memset(&addr, 0, sizeof(addr)); @@ -660,7 +660,7 @@ static void start_server(const char *host, int port) else addr.sin_addr.s_addr = htonl(INADDR_ANY); - setsockopt(serv_hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv_hnd.fd, 4); + setsockopt(serv_hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv_hnd.fd, 4); if (bind (serv_hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { log_emerg("cli: telnet: failed to bind socket: %s\n", strerror(errno)); close(serv_hnd.fd); @@ -678,7 +678,7 @@ static void start_server(const char *host, int port) close(serv_hnd.fd); return; } - + addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = inet_addr(host); @@ -715,7 +715,7 @@ static void load_history_file(void) f = fopen(conf_history_file, "r"); if (!f) return; - + while (fgets((char *)temp_buf, RECV_BUF_SIZE, f)) { b = _malloc(sizeof(*b) + strlen((char *)temp_buf) + 1); b->p_buf = NULL; @@ -747,12 +747,12 @@ static void init(void) opt = conf_get_opt("cli", "telnet"); if (!opt) return; - + host = strdup(opt); d = strstr(host, ":"); if (!d) goto err_fmt; - + *d = 0; port = atoi(d + 1); if (port <= 0) @@ -770,11 +770,11 @@ static void init(void) load_history_file(); start_server(host, port); - + atexit(save_history_file); - + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); - + return; err_fmt: log_emerg("cli: telnet: invalid format\n"); diff --git a/accel-pppd/ctrl/ipoe/arp.c b/accel-pppd/ctrl/ipoe/arp.c index 10ea138f..ebf05c7b 100644 --- a/accel-pppd/ctrl/ipoe/arp.c +++ b/accel-pppd/ctrl/ipoe/arp.c @@ -50,7 +50,7 @@ static int arp_read(struct triton_md_handler_t *h) dst.sll_family = AF_PACKET; dst.sll_ifindex = s->ipoe->ifindex; dst.sll_protocol = htons(ETH_P_ARP); - + ah2.ar_hrd = htons(ARPHRD_ETHER); ah2.ar_pro = htons(ETH_P_IP); ah2.ar_hln = ETH_ALEN; diff --git a/accel-pppd/ctrl/ipoe/backup.c b/accel-pppd/ctrl/ipoe/backup.c index 9633bf71..b272731b 100644 --- a/accel-pppd/ctrl/ipoe/backup.c +++ b/accel-pppd/ctrl/ipoe/backup.c @@ -51,16 +51,16 @@ static int session_save(struct ap_session *ses, struct backup_mod *m) if (conn->ifcfg) flags |= IPOE_FLAG_IFCFG; - + if (conn->dhcp_addr) flags |= IPOE_FLAG_DHCP_ADDR; - + if (conn->relay_addr) flags |= IPOE_FLAG_RELAY_ADDR; - + if (conn->l4_redirect) flags |= IPOE_FLAG_L4_REDIR; - + if (conn->l4_redirect_set) flags |= IPOE_FLAG_L4_REDIR_SET; @@ -82,7 +82,7 @@ static int session_save(struct ap_session *ses, struct backup_mod *m) if (conn->relay_agent) add_tag(IPOE_TAG_RELAY_AGENT, conn->relay_agent->data, conn->relay_agent->len); - + add_tag_i(IPOE_TAG_IFINDEX, &conn->ifindex, 4); return 0; @@ -98,7 +98,7 @@ static int session_restore(struct ap_session *ses, struct backup_mod *m) static void set_dhcpv4_opt(struct dhcpv4_option **opt, struct backup_tag *t, uint8_t **ptr) { - *opt = (struct dhcpv4_option *)(*ptr); + *opt = (struct dhcpv4_option *)(*ptr); (*opt)->len = t->size; memcpy((*opt)->data, t->data, t->size); (*ptr) += sizeof(**opt) + t->size; @@ -200,23 +200,23 @@ static struct ap_session *ctrl_restore(struct backup_mod *m) if (flags & IPOE_FLAG_IFCFG) ses->ifcfg = 1; - + if (flags & IPOE_FLAG_DHCP_ADDR) { dhcpv4_reserve_ip(ses->serv->dhcpv4, ses->yiaddr); ses->dhcp_addr = 1; } - + if (flags & IPOE_FLAG_RELAY_ADDR) ses->relay_addr = 1; - + if (flags & IPOE_FLAG_L4_REDIR) ses->l4_redirect = 1; - + if (flags & IPOE_FLAG_L4_REDIR_SET && m->data->internal) ses->l4_redirect = 1; ses->serv = serv; - + triton_context_register(&ses->ctx, &ses->ses); triton_context_wakeup(&ses->ctx); diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c index 936b50e4..18dea808 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.c +++ b/accel-pppd/ctrl/ipoe/dhcpv4.c @@ -57,10 +57,10 @@ static int open_raw_sock(void) log_error("dhcpv4: socket(AF_PACKET, SOCK_RAW): %s\n", strerror(errno)); return -1; } - + fcntl(raw_sock, F_SETFL, O_NONBLOCK); fcntl(raw_sock, F_SETFD, fcntl(raw_sock, F_GETFD) | FD_CLOEXEC); - + pthread_setspecific(raw_sock_key, (void *)(long)raw_sock); } @@ -78,7 +78,7 @@ static struct dhcpv4_iprange *parse_range(const char *str) struct dhcpv4_iprange *r; n = sscanf(str, "%u.%u.%u.%u/%u", &f1, &f2, &f3, &f4, &m); - + if (n != 5) goto parse_err; if (f1 > 255) @@ -91,7 +91,7 @@ static struct dhcpv4_iprange *parse_range(const char *str) goto parse_err; if (m == 0 || m > 30) goto parse_err; - + start = (f1 << 24) | (f2 << 16) | (f3 << 8) | f4; mask = ~((1 << (32 - m)) - 1); start = start & mask; @@ -145,10 +145,10 @@ struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifna addr.sin_addr.s_addr = htonl(INADDR_ANY); sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - + if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &f, sizeof(f))) log_error("setsockopt(SO_REUSEADDR): %s\n", strerror(errno)); - + if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &f, sizeof(f))) { log_error("setsockopt(SO_BROADCAST): %s\n", strerror(errno)); @@ -164,15 +164,15 @@ struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifna log_error("setsockopt(SO_BINDTODEVICE): %s\n", strerror(errno)); goto out_err; } - + if (ioctl(sock, SIOCGIFHWADDR, &ifr)) { log_error("dhcpv4(%s): ioctl(SIOCGIFHWADDR): %s\n", ifname, strerror(errno)); goto out_err; } - + fcntl(sock, F_SETFL, O_NONBLOCK); fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC); - + serv = _malloc(sizeof(*serv)); memset(serv, 0, sizeof(*serv)); @@ -186,13 +186,13 @@ struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifna if (opt && *opt) { str0 = _strdup(opt); str = str0; - + while (1) { for (ptr1 = str + 1; *ptr1 && *ptr1 != '='; ptr1++); if (!*ptr1) break; - + *ptr1 = 0; for (ptr2 = ++ptr1; *ptr2 && *ptr2 != ','; ptr2++); @@ -213,7 +213,7 @@ struct dhcpv4_serv *dhcpv4_create(struct triton_context_t *ctx, const char *ifna str = ptr2 + 1; } - + _free(str0); } @@ -301,10 +301,10 @@ static int dhcpv4_parse_packet(struct dhcpv4_packet *pack, int len) log_warn("dhcpv4: short packet received\n"); return -1; } - + if (pack->hdr->htype != 1) return -1; - + if (pack->hdr->hlen != 6) return -1; @@ -318,7 +318,7 @@ static int dhcpv4_parse_packet(struct dhcpv4_packet *pack, int len) ptr++; continue; } - + if (*ptr == 0xff) { ptr++; break; @@ -357,9 +357,9 @@ static int dhcpv4_parse_packet(struct dhcpv4_packet *pack, int len) if (dhcpv4_check_options(pack)) return -1; - + pack->ptr = ptr; - + /*if (conf_verbose) { log_info2("recv "); print_packet(pack, log_info2); @@ -465,7 +465,7 @@ int dhcpv4_packet_insert_opt82(struct dhcpv4_packet *pack, const char *agent_cir r = dhcpv4_packet_add_opt(pack, 82, data, 4 + len1 + len2); _free(data); - + *pack->ptr++ = 255; return r; @@ -500,7 +500,7 @@ static int dhcpv4_read(struct triton_md_handler_t *h) dhcpv4_packet_free(pack); continue; } - + if (pack->hdr->op != DHCP_OP_REQUEST) { dhcpv4_packet_free(pack); continue; @@ -510,7 +510,7 @@ static int dhcpv4_read(struct triton_md_handler_t *h) if (serv->recv) serv->recv(serv, pack); - + dhcpv4_packet_free(pack); } } @@ -542,7 +542,7 @@ static int dhcpv4_relay_read(struct triton_md_handler_t *h) dhcpv4_packet_free(pack); continue; } - + if (pack->hdr->op != DHCP_OP_REPLY) { dhcpv4_packet_free(pack); continue; @@ -564,17 +564,17 @@ uint16_t ip_csum(uint16_t *buf, int len) { uint32_t sum=0; int i; - + for (i=0; i < len; i += 2) sum += *buf++; - + // take only 16 bits out of the 32 bit sum and add up the carries while (sum >> 16) sum = (sum & 0xffff) + (sum >> 16); // one's complement the result sum = ~sum; - + return sum & 0xffff; } @@ -591,7 +591,7 @@ static int dhcpv4_send_raw(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, struct sockaddr_ll ll_addr; struct msghdr msg; int sock = open_raw_sock(); - + memset(&ll_addr, 0, sizeof(ll_addr)); ll_addr.sll_family = AF_PACKET; ll_addr.sll_ifindex = serv->ifindex; @@ -638,7 +638,7 @@ static int dhcpv4_send_raw(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, printf("%i %i\n", errno, serv->ifindex); return -1; } - + return 0; } @@ -656,7 +656,7 @@ static int dhcpv4_send_udp(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, n = sendto(serv->hnd.fd, pack->data, len, 0, (struct sockaddr *)&addr, sizeof(addr)); if (n != len) return -1; - + return 0; } @@ -674,7 +674,7 @@ int dhcpv4_packet_add_opt(struct dhcpv4_packet *pack, int type, const void *data opt->type = type; opt->len = len; - opt->data = pack->ptr; + opt->data = pack->ptr; pack->ptr += len; memcpy(opt->data, data, len); @@ -697,7 +697,7 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack } dns; int dns_avail = 0; struct dhcpv4_option *opt; - + pack = dhcpv4_packet_alloc(); if (!pack) { log_emerg("out of memory\n"); @@ -717,17 +717,17 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack if (dhcpv4_packet_add_opt(pack, 53, &msg_type, 1)) goto out_err; - + if (dhcpv4_packet_add_opt(pack, 54, &siaddr, 4)) goto out_err; - + val = ntohl(lease_time); if (dhcpv4_packet_add_opt(pack, 51, &val, 4)) goto out_err; if (router && dhcpv4_packet_add_opt(pack, 3, &router, 4)) goto out_err; - + val = htonl(~((1 << (32 - mask)) - 1)); if (dhcpv4_packet_add_opt(pack, 1, &val, 4)) goto out_err; @@ -742,7 +742,7 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack goto out_err; } } - + if (!dns_avail) { if (conf_dns1 && conf_dns2) { dns.dns1 = conf_dns1; @@ -783,7 +783,7 @@ int dhcpv4_send_nak(struct dhcpv4_serv *serv, struct dhcpv4_packet *req) { struct dhcpv4_packet *pack; int val, r; - + pack = dhcpv4_packet_alloc(); if (!pack) { log_emerg("out of memory\n"); @@ -801,7 +801,7 @@ int dhcpv4_send_nak(struct dhcpv4_serv *serv, struct dhcpv4_packet *req) val = DHCPNAK; if (dhcpv4_packet_add_opt(pack, 53, &val, 1)) goto out_err; - + *pack->ptr++ = 255; if (conf_verbose) { @@ -837,7 +837,7 @@ struct dhcpv4_relay *dhcpv4_relay_create(const char *_addr, in_addr_t giaddr, st int sock = -1; int f = 1; struct dhcpv4_relay_ctx *c; - + ptr = strchr(_addr, ':'); if (ptr) { memcpy(str, _addr, ptr - _addr); @@ -846,7 +846,7 @@ struct dhcpv4_relay *dhcpv4_relay_create(const char *_addr, in_addr_t giaddr, st port = atoi(ptr + 1); } else addr = inet_addr(_addr); - + memset(&raddr, 0, sizeof(raddr)); raddr.sin_family = AF_INET; raddr.sin_addr.s_addr = addr; @@ -862,7 +862,7 @@ struct dhcpv4_relay *dhcpv4_relay_create(const char *_addr, in_addr_t giaddr, st if (r->addr == addr && r->giaddr == giaddr) goto found; } - + r = _malloc(sizeof(*r)); memset(r, 0, sizeof(*r)); INIT_LIST_HEAD(&r->ctx_list); @@ -877,7 +877,7 @@ struct dhcpv4_relay *dhcpv4_relay_create(const char *_addr, in_addr_t giaddr, st if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &f, sizeof(f))) log_error("dhcpv4: setsockopt(SO_REUSEADDR): %s\n", strerror(errno)); - + if (bind(sock, &laddr, sizeof(laddr))) { log_error("dhcpv4: relay: %s: bind: %s\n", _addr, strerror(errno)); goto out_err_unlock; @@ -887,7 +887,7 @@ struct dhcpv4_relay *dhcpv4_relay_create(const char *_addr, in_addr_t giaddr, st log_error("dhcpv4: relay: %s: connect: %s\n", _addr, strerror(errno)); goto out_err_unlock; } - + fcntl(sock, F_SETFL, O_NONBLOCK); fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC); @@ -908,7 +908,7 @@ found: c->ctx = ctx; c->recv = recv; list_add_tail(&c->entry, &r->ctx_list); - + pthread_mutex_unlock(&relay_lock); return r; @@ -965,11 +965,11 @@ int dhcpv4_relay_send(struct dhcpv4_relay *relay, struct dhcpv4_packet *request, if (server_id) { opt = dhcpv4_packet_find_opt(request, 54); if (opt) { - _server_id = *(uint32_t *)opt->data; + _server_id = *(uint32_t *)opt->data; *(uint32_t *)opt->data = server_id; } } - + if (conf_verbose) { log_ppp_info2("send "); dhcpv4_print_packet(request, 1, log_ppp_info2); @@ -982,10 +982,10 @@ int dhcpv4_relay_send(struct dhcpv4_relay *relay, struct dhcpv4_packet *request, if (opt) *(uint32_t *)opt->data = _server_id; - + if (n != len) return -1; - + return 0; } @@ -1019,7 +1019,7 @@ int dhcpv4_relay_send_release(struct dhcpv4_relay *relay, uint8_t *chaddr, uint3 if (client_id && dhcpv4_packet_add_opt(pack, 61, client_id->data, client_id->len)) goto out_err; - + if (relay_agent && dhcpv4_packet_add_opt(pack, 82, relay_agent->data, relay_agent->len)) goto out_err; else if (!relay_agent) { @@ -1028,18 +1028,18 @@ int dhcpv4_relay_send_release(struct dhcpv4_relay *relay, uint8_t *chaddr, uint3 goto out_err; pack->ptr--; } - + *pack->ptr++ = 255; len = pack->ptr - pack->data; - + if (conf_verbose) { log_ppp_info2("send "); dhcpv4_print_packet(pack, 1, log_ppp_info2); } n = write(relay->hnd.fd, pack->data, len); - + dhcpv4_packet_free(pack); return n == len ? 0 : -1; @@ -1055,7 +1055,7 @@ int dhcpv4_get_ip(struct dhcpv4_serv *serv, uint32_t *yiaddr, uint32_t *siaddr, if (!serv->range) return 0; - + pthread_mutex_lock(&serv->range->lock); while (1) { @@ -1074,7 +1074,7 @@ int dhcpv4_get_ip(struct dhcpv4_serv *serv, uint32_t *yiaddr, uint32_t *siaddr, if (serv->range->pos == 0) break; - + serv->range->pos = 0; } @@ -1097,7 +1097,7 @@ void dhcpv4_put_ip(struct dhcpv4_serv *serv, uint32_t ip) void dhcpv4_reserve_ip(struct dhcpv4_serv *serv, uint32_t ip) { int n = ntohl(ip) - serv->range->startip; - + if (n <= 0 || n / (8 * sizeof(long)) >= serv->range->len) return; @@ -1108,7 +1108,7 @@ void dhcpv4_reserve_ip(struct dhcpv4_serv *serv, uint32_t ip) static void load_config() { - const char *opt; + const char *opt; opt = conf_get_opt("ipoe", "verbose"); if (opt) @@ -1117,7 +1117,7 @@ static void load_config() opt = conf_get_opt("dns", "dns1"); if (opt) conf_dns1 = inet_addr(opt); - + opt = conf_get_opt("dns", "dns2"); if (opt) conf_dns2 = inet_addr(opt); @@ -1127,7 +1127,7 @@ static void init() { pack_pool = mempool_create(BUF_SIZE + sizeof(struct dhcpv4_packet)); opt_pool = mempool_create(sizeof(struct dhcpv4_option)); - + pthread_key_create(&raw_sock_key, close_raw_sock); load_config(); diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.h b/accel-pppd/ctrl/ipoe/dhcpv4.h index 15db8ed5..163c0847 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.h +++ b/accel-pppd/ctrl/ipoe/dhcpv4.h @@ -80,7 +80,7 @@ struct dhcpv4_iprange { int len; pthread_mutex_t lock; unsigned long free[0]; -}; +}; struct dhcpv4_serv { struct triton_context_t *ctx; diff --git a/accel-pppd/ctrl/ipoe/dhcpv4_options.c b/accel-pppd/ctrl/ipoe/dhcpv4_options.c index f233e7c5..b5f2b3bf 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4_options.c +++ b/accel-pppd/ctrl/ipoe/dhcpv4_options.c @@ -131,7 +131,7 @@ static void print_ip(const struct dhcpv4_option *opt, int elem_size, void (*prin { int i, n = opt->len / elem_size; uint32_t ip; - + for (i = 0; i < n; i++) { ip = ntohl(*(uint32_t *)(opt->data + i*elem_size)); @@ -172,10 +172,10 @@ static void print_route(const struct dhcpv4_option *opt, int elem_size, void (*p for (i = 0; i < n; i++) { ip = ntohl(*(uint32_t *)(opt->data + i*8)); gw = ntohl(*(uint32_t *)(opt->data + i*8 + 4)); - + if (i) print(","); - + print("%i.%i.%i.%i via %i.%i.%i.%i", (ip >> 24) & 0xff, (ip >> 16) & 0xff, @@ -275,7 +275,7 @@ static void print_classless_route(const struct dhcpv4_option *opt, int elem_size ptr += 4; gw = ntohl(*(uint32_t *)ptr); ptr += 4; - + print("%i.%i.%i.%i/%i via %i.%i.%i.%i", (ip >> 24) & 0xff, (ip >> 16) & 0xff, diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index cdb8fb09..cca20964 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -186,7 +186,7 @@ static int ipoe_rad_send_request(struct rad_plugin_t *rad, struct rad_packet_t * static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct dhcpv4_packet *pack, struct ipoe_session **opt82_ses) { struct ipoe_session *ses, *res = NULL; - + uint8_t *agent_circuit_id = NULL; uint8_t *agent_remote_id = NULL; int opt82_match; @@ -201,27 +201,27 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d list_for_each_entry(ses, &serv->sessions, entry) { opt82_match = pack->relay_agent != NULL; - + if (agent_circuit_id && !ses->agent_circuit_id) opt82_match = 0; - + if (opt82_match && agent_remote_id && !ses->agent_remote_id) opt82_match = 0; - + if (opt82_match && !agent_circuit_id && ses->agent_circuit_id) opt82_match = 0; - + if (opt82_match && !agent_remote_id && ses->agent_remote_id) opt82_match = 0; - + if (opt82_match && agent_circuit_id) { if (*agent_circuit_id != *ses->agent_circuit_id) opt82_match = 0; - + if (memcmp(agent_circuit_id + 1, ses->agent_circuit_id + 1, *agent_circuit_id)) opt82_match = 0; } - + if (opt82_match && agent_remote_id) { if (*agent_remote_id != *ses->agent_remote_id) opt82_match = 0; @@ -232,19 +232,19 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d if (opt82_match && opt82_ses) *opt82_ses = ses; - + if (memcmp(pack->hdr->chaddr, ses->hwaddr, ETH_ALEN)) continue; - + res = ses; break; - + /*if (pack->client_id && !ses->client_id) continue; - + if (!pack->client_id && ses->client_id) continue; - + if (pack->client_id) { if (pack->client_id->len != ses->client_id->len) continue; @@ -262,28 +262,28 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d if (!res || !pack->relay_agent || !opt82_ses || *opt82_ses) return res; - + list_for_each_entry(ses, &serv->sessions, entry) { if (agent_circuit_id && !ses->agent_circuit_id) continue; - + if (opt82_match && agent_remote_id && !ses->agent_remote_id) continue; - + if (opt82_match && !agent_circuit_id && ses->agent_circuit_id) continue; - + if (opt82_match && !agent_remote_id && ses->agent_remote_id) continue; - + if (opt82_match && agent_circuit_id) { if (*agent_circuit_id != *ses->agent_circuit_id) continue; - + if (memcmp(agent_circuit_id + 1, ses->agent_circuit_id + 1, *agent_circuit_id)) continue; } - + if (opt82_match && agent_remote_id) { if (*agent_remote_id != *ses->agent_remote_id) continue; @@ -295,7 +295,7 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d *opt82_ses = ses; break; } - + return res; } @@ -367,7 +367,7 @@ static void l4_redirect_list_add(in_addr_t addr) memset(n, 0, sizeof(*n)); n->addr = addr; n->timeout = ts.tv_sec + conf_l4_redirect_on_reject; - + ipoe_nl_add_exclude(addr, 32); if (conf_l4_redirect_table) @@ -377,13 +377,13 @@ static void l4_redirect_list_add(in_addr_t addr) ipset_add(conf_l4_redirect_ipset, addr); pthread_rwlock_wrlock(&l4_list_lock); - + list_add_tail(&n->entry, &l4_redirect_list); - + if (!l4_redirect_timer.tpd) triton_timer_add(&l4_redirect_ctx, &l4_redirect_timer, 0); - pthread_rwlock_unlock(&l4_list_lock); + pthread_rwlock_unlock(&l4_list_lock); } static int l4_redirect_list_check(in_addr_t addr) @@ -417,10 +417,10 @@ static void l4_redirect_list_timer(struct triton_timer_t *t) if (conf_l4_redirect_table) iprule_del(n->addr, conf_l4_redirect_table); - + if (conf_l4_redirect_ipset) ipset_del(conf_l4_redirect_ipset, n->addr); - + ipoe_nl_del_exclude(n->addr); _free(n); @@ -438,12 +438,12 @@ static void l4_redirect_list_timer(struct triton_timer_t *t) static void ipoe_change_l4_redirect(struct ipoe_session *ses, int del) { in_addr_t addr; - + if (ses->ses.ipv4) addr = ses->ses.ipv4->peer_addr; else addr = ses->yiaddr; - + if (ses->l4_redirect_table) { if (del) { iprule_del(addr, ses->l4_redirect_table); @@ -560,7 +560,7 @@ cont: if (ses->serv->opt_nat) ses->ses.ipv4 = ipdb_get_ipv4(&ses->ses); - + if (ses->serv->opt_shared == 0 && (!ses->ses.ipv4 || ses->ses.ipv4->peer_addr == ses->yiaddr)) { strncpy(ses->ses.ifname, ses->serv->ifname, AP_IFNAME_LEN); ses->ses.ifindex = ses->serv->ifindex; @@ -586,18 +586,18 @@ static void ipoe_session_start(struct ipoe_session *ses) int r; char *passwd; char *username; - + if (ses->dhcpv4_request && conf_verbose) { log_ppp_info2("recv "); dhcpv4_print_packet(ses->dhcpv4_request, 0, log_ppp_info2); } __sync_add_and_fetch(&stat_starting, 1); - + assert(!ses->ses.username); strncpy(ses->ses.ifname, ses->serv->ifname, AP_IFNAME_LEN); - + username = ipoe_session_get_username(ses); if (!username) { @@ -606,13 +606,13 @@ static void ipoe_session_start(struct ipoe_session *ses) } ses->ses.unit_idx = ses->serv->ifindex; - + triton_event_fire(EV_CTRL_STARTING, &ses->ses); triton_event_fire(EV_CTRL_STARTED, &ses->ses); ap_session_starting(&ses->ses); - - if (conf_noauth) + + if (conf_noauth) r = PWDB_SUCCESS; else { if (ses->serv->opt_shared && ipoe_create_interface(ses)) @@ -628,7 +628,7 @@ static void ipoe_session_start(struct ipoe_session *ses) ses->username = username; r = pwdb_check(&ses->ses, (pwdb_callback)auth_result, ses, username, PPP_PAP, conf_password ? conf_password : username); - + if (r == PWDB_WAIT) return; @@ -642,7 +642,7 @@ static void ipoe_session_start(struct ipoe_session *ses) } } } - + auth_result(ses, r); } @@ -659,7 +659,7 @@ static void find_gw_addr(struct ipoe_session *ses) } } -static void __ipoe_session_start(struct ipoe_session *ses) +static void __ipoe_session_start(struct ipoe_session *ses) { if (!ses->yiaddr) { dhcpv4_get_ip(ses->serv->dhcpv4, &ses->yiaddr, &ses->router, &ses->mask); @@ -676,7 +676,7 @@ static void __ipoe_session_start(struct ipoe_session *ses) if (!ses->yiaddr) ses->yiaddr = ses->ses.ipv4->peer_addr; - + if (!ses->router) ses->router = ses->ses.ipv4->addr; } /*else if (ses->yiaddr) { @@ -686,7 +686,7 @@ static void __ipoe_session_start(struct ipoe_session *ses) ses->ipv4.mask = ses->mask; ses->ipv4.owner = NULL; }*/ - + if (ses->dhcpv4_request) { if (!ses->yiaddr) { log_ppp_error("no free IPv4 address\n"); @@ -696,13 +696,13 @@ static void __ipoe_session_start(struct ipoe_session *ses) if (!ses->router) find_gw_addr(ses); - + if (!ses->mask) ses->mask = conf_netmask; - + if (!ses->mask) ses->mask = 32; - + if (ses->dhcpv4_request->hdr->giaddr) { /*uint32_t mask = ses->mask == 32 ? 0xffffffff : (((1 << ses->mask) - 1) << (32 - ses->mask)); @@ -719,18 +719,18 @@ static void __ipoe_session_start(struct ipoe_session *ses) ses->router = ses->dhcpv4_request->hdr->giaddr; } } - + if (!ses->router) { log_ppp_error("can't determine router address\n"); ap_session_terminate(&ses->ses, TERM_NAS_REQUEST, 0); return; - } - + } + if (!ses->siaddr && ses->router != ses->yiaddr) ses->siaddr = ses->router; - + if (!ses->siaddr) - ses->siaddr = ses->serv->opt_src; + ses->siaddr = ses->serv->opt_src; if (!ses->siaddr && ses->serv->dhcpv4_relay) ses->siaddr = ses->serv->dhcpv4_relay->giaddr; @@ -748,7 +748,7 @@ static void __ipoe_session_start(struct ipoe_session *ses) dhcpv4_packet_free(ses->dhcpv4_request); ses->dhcpv4_request = NULL; - + ses->timer.expire = ipoe_session_timeout; ses->timer.period = 0; ses->timer.expire_tv.tv_sec = conf_offer_timeout; @@ -756,7 +756,7 @@ static void __ipoe_session_start(struct ipoe_session *ses) } else { if (!ses->siaddr) find_gw_addr(ses); - + if (!ses->siaddr) ses->siaddr = ses->serv->opt_src; @@ -768,7 +768,7 @@ static void __ipoe_session_start(struct ipoe_session *ses) ap_session_terminate(&ses->ses, TERM_NAS_ERROR, 0); return; } - + if (ses->ses.ipv4 && !ses->ses.ipv4->addr) ses->ses.ipv4->addr = ses->siaddr; @@ -781,7 +781,7 @@ static void ipoe_serv_add_addr(struct ipoe_serv *serv, in_addr_t addr, int mask) struct ifaddr *a; pthread_mutex_lock(&serv->lock); - + if (serv->opt_shared) { list_for_each_entry(a, &serv->addr_list, entry) { if (a->addr == addr) { @@ -823,7 +823,7 @@ static void ipoe_serv_del_addr(struct ipoe_serv *serv, in_addr_t addr, int lock) break; } } - + if (lock) pthread_mutex_unlock(&serv->lock); } @@ -834,7 +834,7 @@ static void ipoe_ifcfg_add(struct ipoe_session *ses) if (ses->serv->opt_ifcfg) ipoe_serv_add_addr(ses->serv, ses->siaddr, conf_ip_unnumbered ? 32 : ses->mask); - + if (conf_ip_unnumbered) { if (iproute_add(serv->ifindex, ses->serv->opt_src ? ses->serv->opt_src : ses->router, ses->yiaddr, 0, conf_proto)) log_ppp_warn("ipoe: failed to add route to interface '%s'\n", serv->ifname); @@ -846,7 +846,7 @@ static void ipoe_ifcfg_add(struct ipoe_session *ses) static void ipoe_ifcfg_del(struct ipoe_session *ses, int lock) { struct ipoe_serv *serv = ses->serv; - + if (conf_ip_unnumbered) { if (iproute_del(serv->ifindex, ses->yiaddr, conf_proto)) log_ppp_warn("ipoe: failed to delete route from interface '%s'\n", serv->ifname); @@ -862,7 +862,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses) if (ses->terminating) return; - + if (ses->ifindex != -1) { addr = 0; if (!ses->ses.ipv4) { @@ -889,29 +889,29 @@ static void __ipoe_session_activate(struct ipoe_session *ses) return; } } - + if (!ses->ses.ipv4) { ses->ses.ipv4 = &ses->ipv4; ses->ipv4.owner = NULL; ses->ipv4.peer_addr = ses->yiaddr; ses->ipv4.addr = ses->siaddr; } - + if (ses->ifindex == -1) { if (ses->serv->opt_ifcfg || (ses->serv->opt_mode == MODE_L2)) ipoe_ifcfg_add(ses); - + ipoe_nl_add_exclude(ses->yiaddr, 32); iproute_add(ses->serv->ifindex, ses->siaddr, ses->yiaddr, 0, conf_proto); - + ses->ctrl.dont_ifcfg = 1; } else if (ses->ctrl.dont_ifcfg && ses->serv->opt_mode == MODE_L2) ipaddr_add(ses->ifindex, ses->siaddr, ses->mask); - + if (ses->l4_redirect) ipoe_change_l4_redirect(ses, 0); - + if (ses->serv->opt_mode == MODE_L2 && ses->serv->opt_ipv6 && sock6_fd != -1) { ses->ses.ipv6 = ipdb_get_ipv6(&ses->ses); if (!ses->ses.ipv6) @@ -935,7 +935,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses) dhcpv4_packet_free(ses->dhcpv4_request); ses->dhcpv4_request = NULL; } - + ses->timer.expire = ipoe_session_timeout; ses->timer.period = 0; ses->timer.expire_tv.tv_sec = conf_lease_timeout ? conf_lease_timeout : ses->lease_time; @@ -946,7 +946,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses) static void ipoe_session_activate(struct dhcpv4_packet *pack) { struct ipoe_session *ses = container_of(triton_context_self(), typeof(*ses), ctx); - + if (ses->ses.state == AP_STATE_ACTIVE) { ipoe_session_keepalive(pack); return; @@ -954,7 +954,7 @@ static void ipoe_session_activate(struct dhcpv4_packet *pack) if (ses->dhcpv4_request) dhcpv4_packet_free(ses->dhcpv4_request); - + ses->dhcpv4_request = pack; if (ses->serv->dhcpv4_relay) @@ -969,14 +969,14 @@ static void ipoe_session_keepalive(struct dhcpv4_packet *pack) if (ses->dhcpv4_request) dhcpv4_packet_free(ses->dhcpv4_request); - + ses->dhcpv4_request = pack; if (ses->timer.tpd) triton_timer_mod(&ses->timer, 0); ses->xid = ses->dhcpv4_request->hdr->xid; - + if (/*ses->ses.state == AP_STATE_ACTIVE &&*/ ses->serv->dhcpv4_relay) { dhcpv4_relay_send(ses->serv->dhcpv4_relay, ses->dhcpv4_request, ses->relay_server_id, ses->serv->ifname, conf_agent_remote_id); return; @@ -990,7 +990,7 @@ static void ipoe_session_keepalive(struct dhcpv4_packet *pack) dhcpv4_packet_free(ses->dhcpv4_request); ses->dhcpv4_request = NULL; } - + static void ipoe_session_decline(struct dhcpv4_packet *pack) { struct ipoe_session *ses = container_of(triton_context_self(), typeof(*ses), ctx); @@ -999,7 +999,7 @@ static void ipoe_session_decline(struct dhcpv4_packet *pack) log_ppp_info2("recv "); dhcpv4_print_packet(pack, 0, log_ppp_info2); } - + if (pack->msg_type == DHCPDECLINE && ses->serv->dhcpv4_relay) dhcpv4_relay_send(ses->serv->dhcpv4_relay, pack, 0, ses->serv->ifname, conf_agent_remote_id); @@ -1011,12 +1011,12 @@ static void ipoe_session_decline(struct dhcpv4_packet *pack) static void ipoe_session_started(struct ap_session *s) { struct ipoe_session *ses = container_of(s, typeof(*ses), ses); - + log_ppp_info1("ipoe: session started\n"); if (ses->timer.tpd) triton_timer_mod(&ses->timer, 0); - + if (ses->ifindex != -1 && ses->xid) { ses->dhcpv4 = dhcpv4_create(ses->ctrl.ctx, ses->ses.ifname, ""); if (!ses->dhcpv4) { @@ -1033,33 +1033,33 @@ static void ipoe_session_free(struct ipoe_session *ses) __sync_sub_and_fetch(&stat_active, 1); else __sync_sub_and_fetch(&stat_starting, 1); - + if (ses->timer.tpd) triton_timer_del(&ses->timer); - + if (ses->l4_redirect_timer.tpd) triton_timer_del(&ses->timer); if (ses->dhcpv4_request) dhcpv4_packet_free(ses->dhcpv4_request); - + if (ses->dhcpv4_relay_reply) dhcpv4_packet_free(ses->dhcpv4_relay_reply); - + if (ses->ctrl.called_station_id) _free(ses->ctrl.called_station_id); - + if (ses->ctrl.calling_station_id) _free(ses->ctrl.calling_station_id); - + if (ses->l4_redirect_ipset) _free(ses->l4_redirect_ipset); triton_context_unregister(&ses->ctx); - + if (ses->data) _free(ses->data); - + mempool_free(ses); } @@ -1097,12 +1097,12 @@ static void ipoe_session_finished(struct ap_session *s) if (ses->ifcfg) ipoe_ifcfg_del(ses, 1); - + if (ses->dhcpv4) dhcpv4_free(ses->dhcpv4); triton_event_fire(EV_CTRL_FINISHED, s); - + triton_context_call(&ses->ctx, (triton_event_func)ipoe_session_free, ses); } @@ -1120,7 +1120,7 @@ static void ipoe_session_terminate(struct ap_session *s, int hard) static void ipoe_session_close(struct triton_context_t *ctx) { struct ipoe_session *ses = container_of(ctx, typeof(*ses), ctx); - + if (ses->ses.state) ap_session_terminate(&ses->ses, TERM_ADMIN_RESET, 1); else @@ -1132,7 +1132,7 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s struct ipoe_session *ses; int dlen = 0; uint8_t *ptr = NULL; - + ses = ipoe_session_alloc(); if (!ses) return NULL; @@ -1140,7 +1140,7 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s ses->serv = serv; ses->dhcpv4_request = pack; strncpy(ses->ses.ifname, serv->ifname, AP_IFNAME_LEN); - + ses->xid = pack->hdr->xid; memcpy(ses->hwaddr, pack->hdr->chaddr, 6); ses->giaddr = pack->hdr->giaddr; @@ -1148,10 +1148,10 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s if (pack->client_id) dlen += sizeof(struct dhcpv4_option) + pack->client_id->len; - + if (pack->relay_agent) dlen += sizeof(struct dhcpv4_option) + pack->relay_agent->len; - + if (dlen) { ses->data = _malloc(dlen); if (!ses->data) { @@ -1169,7 +1169,7 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s memcpy(ses->client_id->data, pack->client_id->data, pack->client_id->len); ptr += sizeof(struct dhcpv4_option) + pack->client_id->len; } - + if (pack->relay_agent) { ses->relay_agent = (struct dhcpv4_option *)ptr; ses->relay_agent->len = pack->relay_agent->len; @@ -1181,14 +1181,14 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s } ses->ctrl.dont_ifcfg = 1; - + ses->ctrl.calling_station_id = _malloc(19); ses->ctrl.called_station_id = _strdup(serv->ifname); - + ptr = ses->hwaddr; sprintf(ses->ctrl.calling_station_id, "%02x:%02x:%02x:%02x:%02x:%02x", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); - + ses->ses.ctrl = &ses->ctrl; ses->ses.chan_name = ses->ctrl.calling_station_id; @@ -1202,10 +1202,10 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s //pthread_mutex_lock(&serv->lock); list_add_tail(&ses->entry, &serv->sessions); //pthread_mutex_unlock(&serv->lock); - + if (serv->timer.tpd) triton_timer_del(&serv->timer); - + dhcpv4_packet_ref(pack); triton_context_call(&ses->ctx, (triton_event_func)ipoe_session_start, ses); @@ -1227,7 +1227,7 @@ static void ipoe_ses_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packe if (ap_shutdown) return; - + if (conf_verbose) { log_ppp_info2("recv "); dhcpv4_print_packet(pack, 0, log_ppp_info2); @@ -1239,27 +1239,27 @@ static void ipoe_ses_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packe } opt82_match = pack->relay_agent != NULL; - + if (agent_circuit_id && !ses->agent_circuit_id) opt82_match = 0; - + if (opt82_match && agent_remote_id && !ses->agent_remote_id) opt82_match = 0; - + if (opt82_match && !agent_circuit_id && ses->agent_circuit_id) opt82_match = 0; - + if (opt82_match && !agent_remote_id && ses->agent_remote_id) opt82_match = 0; - + if (opt82_match && agent_circuit_id) { if (*agent_circuit_id != *ses->agent_circuit_id) opt82_match = 0; - + if (memcmp(agent_circuit_id + 1, ses->agent_circuit_id + 1, *agent_circuit_id)) opt82_match = 0; } - + if (opt82_match && agent_remote_id) { if (*agent_remote_id != *ses->agent_remote_id) opt82_match = 0; @@ -1295,7 +1295,7 @@ static void ipoe_ses_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packe dhcpv4_send_nak(dhcpv4, pack); else if (ses->serv->dhcpv4_relay) dhcpv4_relay_send(ses->serv->dhcpv4_relay, pack, 0, ses->serv->ifname, conf_agent_remote_id); - + triton_context_call(ses->ctrl.ctx, (triton_event_func)__ipoe_session_terminate, &ses->ses); } else { dhcpv4_packet_ref(pack); @@ -1315,10 +1315,10 @@ static void ipoe_ses_recv_dhcpv4_discover(struct dhcpv4_packet *pack) log_ppp_info2("recv "); dhcpv4_print_packet(pack, 0, log_ppp_info2); } - + if (ses->yiaddr) dhcpv4_send_reply(DHCPOFFER, ses->serv->dhcpv4, pack, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); - + dhcpv4_packet_free(pack); } @@ -1327,12 +1327,12 @@ static void ipoe_ses_recv_dhcpv4_request(struct dhcpv4_packet *pack) struct ipoe_session *ses = container_of(triton_context_self(), typeof(*ses), ctx); ses->xid = pack->hdr->xid; - + if (conf_verbose) { log_ppp_info2("recv "); dhcpv4_print_packet(pack, 0, log_ppp_info2); } - + if ((pack->server_id && (pack->server_id != ses->siaddr || pack->request_ip != ses->yiaddr)) || (pack->hdr->ciaddr && (pack->hdr->ciaddr != ses->yiaddr))) { @@ -1361,10 +1361,10 @@ static void ipoe_serv_disc_timer(struct triton_timer_t *t) int delay, offer_delay; clock_gettime(CLOCK_MONOTONIC, &ts); - - while (!list_empty(&serv->disc_list)) { + + while (!list_empty(&serv->disc_list)) { d = list_entry(serv->disc_list.next, typeof(*d), entry); - + delay = (ts.tv_sec - d->ts.tv_sec) * 1000 + (ts.tv_nsec - d->ts.tv_nsec) / 1000000; offer_delay = get_offer_delay(); @@ -1375,7 +1375,7 @@ static void ipoe_serv_disc_timer(struct triton_timer_t *t) triton_timer_mod(t, 0); return; } - + __ipoe_recv_dhcpv4(serv->dhcpv4, d->pack, 1); list_del(&d->entry); @@ -1394,14 +1394,14 @@ static void ipoe_serv_add_disc(struct ipoe_serv *serv, struct dhcpv4_packet *pac if (!d) return; - + __sync_add_and_fetch(&stat_delayed_offer, 1); - + dhcpv4_packet_ref(pack); d->pack = pack; clock_gettime(CLOCK_MONOTONIC, &d->ts); list_add_tail(&d->entry, &serv->disc_list); - + if (!serv->disc_timer.tpd) { serv->disc_timer.expire_tv.tv_sec = offer_delay / 1000; serv->disc_timer.expire_tv.tv_usec = (offer_delay % 1000) * 1000; @@ -1419,13 +1419,13 @@ static void ipoe_serv_check_disc(struct ipoe_serv *serv, struct dhcpv4_packet *p if (memcmp(d->pack->hdr->chaddr, pack->hdr->chaddr, ETH_ALEN)) continue; - + list_del(&d->entry); dhcpv4_packet_free(d->pack); mempool_free(d); - + __sync_sub_and_fetch(&stat_delayed_offer, 1); - + break; } } @@ -1456,7 +1456,7 @@ static int ipoe_serv_request_check(struct ipoe_serv *serv, uint32_t xid) mempool_free(r); } } - + r = mempool_alloc(req_item_pool); r->xid = xid; r->expire = ts.tv_sec + 30; @@ -1481,7 +1481,7 @@ static void port_change_detected(struct dhcpv4_packet *pack) ap_session_terminate(&ses->ses, TERM_USER_REQUEST, 0); } - + static void mac_change_detected(struct dhcpv4_packet *pack) { struct ipoe_session *ses = container_of(triton_context_self(), typeof(*ses), ctx); @@ -1490,11 +1490,11 @@ static void mac_change_detected(struct dhcpv4_packet *pack) log_ppp_info2("recv "); dhcpv4_print_packet(pack, 0, log_ppp_info2); } - + dhcpv4_packet_free(pack); - + log_ppp_warn("mac change detected\n"); - + ap_session_terminate(&ses->ses, TERM_USER_REQUEST, 0); } @@ -1510,7 +1510,7 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet if (ap_shutdown) return; - + if (connlimit_loaded && pack->msg_type == DHCPDISCOVER && connlimit_check(serv->opt_shared ? cl_key_from_mac(pack->hdr->chaddr) : serv->ifindex)) return; @@ -1543,13 +1543,13 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet triton_context_call(&opt82_ses->ctx, (triton_event_func)__ipoe_session_terminate, &opt82_ses->ses); goto out; } - + dhcpv4_packet_ref(pack); triton_context_call(&ses->ctx, (triton_event_func)ipoe_ses_recv_dhcpv4_discover, pack); } } else if (pack->msg_type == DHCPREQUEST) { ipoe_serv_check_disc(serv, pack); - + ses = ipoe_session_lookup(serv, pack, &opt82_ses); if (!ses) { @@ -1576,7 +1576,7 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet triton_context_call(&opt82_ses->ctx, (triton_event_func)__ipoe_session_terminate, &opt82_ses->ses); goto out; } - + if (serv->opt_shared == 0) ipoe_drop_sessions(serv, ses); @@ -1617,7 +1617,7 @@ static void ipoe_ses_recv_dhcpv4_relay(struct dhcpv4_packet *pack) if (ses->dhcpv4_relay_reply) dhcpv4_packet_free(ses->dhcpv4_relay_reply); - + if (!ses->dhcpv4_request) { ses->dhcpv4_relay_reply = NULL; return; @@ -1667,7 +1667,7 @@ static void ipoe_ses_recv_dhcpv4_relay(struct dhcpv4_packet *pack) ap_session_terminate(&ses->ses, TERM_NAS_REQUEST, 0); return; } - + dhcpv4_packet_free(ses->dhcpv4_relay_reply); ses->dhcpv4_relay_reply = NULL; } @@ -1694,7 +1694,7 @@ static void ipoe_recv_dhcpv4_relay(struct dhcpv4_packet *pack) found = 1; break; } - + if (found) { triton_context_call(&ses->ctx, (triton_event_func)ipoe_ses_recv_dhcpv4_relay, pack); } else @@ -1710,10 +1710,10 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc if (ap_shutdown) return NULL; - + if (l4_redirect_list_check(iph->saddr)) return NULL; - + ses = ipoe_session_alloc(); if (!ses) return NULL; @@ -1726,12 +1726,12 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc ses->ctrl.called_station_id = _strdup(serv->ifname); u_inet_ntoa(iph->saddr, ses->ctrl.calling_station_id); - + ses->ses.chan_name = ses->ctrl.calling_station_id; - + if (conf_ip_pool) ses->ses.ipv4_pool_name = _strdup(conf_ip_pool); - + triton_context_register(&ses->ctx, &ses->ses); triton_context_wakeup(&ses->ctx); @@ -1763,7 +1763,7 @@ struct ipoe_session *ipoe_session_alloc(void) ap_session_init(&ses->ses); ses->ifindex = -1; - + ses->ctx.before_switch = log_switch; ses->ctx.close = ipoe_session_close; ses->ctrl.ctx = &ses->ctx; @@ -1775,7 +1775,7 @@ struct ipoe_session *ipoe_session_alloc(void) ses->l4_redirect_table = conf_l4_redirect_table; ses->ses.ctrl = &ses->ctrl; - + return ses; } @@ -1790,7 +1790,7 @@ void ipoe_recv_up(int ifindex, struct ethhdr *eth, struct iphdr *iph) if (!serv->opt_up) return; - + pthread_mutex_lock(&serv->lock); list_for_each_entry(ses, &serv->sessions, entry) { if (ses->yiaddr == iph->saddr) { @@ -1799,7 +1799,7 @@ void ipoe_recv_up(int ifindex, struct ethhdr *eth, struct iphdr *iph) } } pthread_mutex_unlock(&serv->lock); - + ipoe_session_create_up(serv, eth, iph); break; @@ -1853,10 +1853,10 @@ static void ev_radius_coa(struct ev_radius_t *ev) struct ipoe_session *ses = container_of(ev->ses, typeof(*ses), ses); struct rad_attr_t *attr; int l4_redirect; - + if (ev->ses->ctrl->type != CTRL_TYPE_IPOE) return; - + l4_redirect = ses->l4_redirect; list_for_each_entry(attr, &ev->request->attrs, entry) { @@ -1883,8 +1883,8 @@ static int ipoe_rad_send_request(struct rad_plugin_t *rad, struct rad_packet_t * if (!ses->relay_agent) return 0; - - return rad_packet_add_octets(pack, NULL, conf_attr_dhcp_opt82, ses->relay_agent->data, ses->relay_agent->len); + + return rad_packet_add_octets(pack, NULL, conf_attr_dhcp_opt82, ses->relay_agent->data, ses->relay_agent->len); } #endif @@ -1906,7 +1906,7 @@ static void ipoe_serv_release(struct ipoe_serv *serv) return; } - + log_info2("ipoe: stop interface %s\n", serv->ifname); pthread_mutex_lock(&serv_lock); @@ -1915,7 +1915,7 @@ static void ipoe_serv_release(struct ipoe_serv *serv) if (serv->dhcpv4) dhcpv4_free(serv->dhcpv4); - + if (serv->dhcpv4_relay) { ipoe_serv_del_addr(serv, serv->dhcpv4_relay->giaddr, 0); dhcpv4_relay_free(serv->dhcpv4_relay, &serv->ctx); @@ -1931,7 +1931,7 @@ static void ipoe_serv_release(struct ipoe_serv *serv) mempool_free(d); __sync_sub_and_fetch(&stat_delayed_offer, 1); } - + while (!list_empty(&serv->req_list)) { struct request_item *r = list_first_entry(&serv->req_list, typeof(*r), entry); list_del(&r->entry); @@ -1940,7 +1940,7 @@ static void ipoe_serv_release(struct ipoe_serv *serv) if (serv->disc_timer.tpd) triton_timer_del(&serv->disc_timer); - + if (serv->timer.tpd) triton_timer_del(&serv->timer); @@ -1982,19 +1982,19 @@ static void l4_redirect_ctx_close(struct triton_context_t *ctx) if (conf_l4_redirect_table) iprule_del(n->addr, conf_l4_redirect_table); - + if (conf_l4_redirect_ipset) ipset_del(conf_l4_redirect_ipset, n->addr); - + ipoe_nl_del_exclude(n->addr); - + _free(n); } pthread_rwlock_unlock(&l4_list_lock); if (l4_redirect_timer.tpd) triton_timer_del(&l4_redirect_timer); - + triton_context_unregister(&l4_redirect_ctx); } @@ -2066,7 +2066,7 @@ static int get_offer_delay() if (prev) return prev->delay; - + return 0; } @@ -2118,12 +2118,12 @@ void ipoe_vlan_notify(int ifindex, int vid) log_error("ipoe: vlan-mon: failed to get interface name, ifindex=%i\n", ifindex); return; } - + if (make_vlan_name(ifr.ifr_name, vid, ifname)) { log_error("ipoe: vlan-mon: %s.%i: interface name is too long\n", ifr.ifr_name, vid); return; } - + log_info2("ipoe: create vlan %s parent %s\n", ifname, ifr.ifr_name); strcpy(ifr.ifr_name, ifname); @@ -2133,11 +2133,11 @@ void ipoe_vlan_notify(int ifindex, int vid) log_warn("ipoe: vlan-mon: %s: failed to add vlan\n", ifr.ifr_name); return; } - + ioctl(sock_fd, SIOCGIFFLAGS, &ifr, sizeof(ifr)); ifr.ifr_flags |= IFF_UP; ioctl(sock_fd, SIOCSIFFLAGS, &ifr, sizeof(ifr)); - + if (ioctl(sock_fd, SIOCGIFINDEX, &ifr, sizeof(ifr))) { log_error("ipoe: vlan-mon: %s: failed to get interface index\n", ifr.ifr_name); return; @@ -2148,7 +2148,7 @@ void ipoe_vlan_notify(int ifindex, int vid) continue; if (!opt->val) continue; - + ptr = strchr(opt->val, ','); if (!ptr) ptr = strchr(opt->val, 0); @@ -2157,20 +2157,20 @@ void ipoe_vlan_notify(int ifindex, int vid) pattern = _malloc(ptr - (opt->val + 3) + 1); memcpy(pattern, opt->val + 3, ptr - (opt->val + 3)); pattern[ptr - (opt->val + 3)] = 0; - + re = pcre_compile2(pattern, 0, NULL, &pcre_err, &pcre_offset, NULL); - + _free(pattern); - + if (!re) continue; r = pcre_exec(re, NULL, ifr.ifr_name, len, 0, 0, NULL, 0); pcre_free(re); - + if (r < 0) continue; - + add_interface(ifr.ifr_name, ifr.ifr_ifindex, opt->val, ifindex, vid); } else if (ptr - opt->val == len && memcmp(opt->val, ifr.ifr_name, len) == 0) add_interface(ifr.ifr_name, ifr.ifr_ifindex, opt->val, ifindex, vid); @@ -2182,7 +2182,7 @@ static void ipoe_serv_timeout(struct triton_timer_t *t) struct ipoe_serv *serv = container_of(t, typeof(*serv), timer); serv->need_close = 1; - + ipoe_serv_release(serv); } @@ -2213,13 +2213,13 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int if (str0) { str0 = _strdup(str0 + 1); str = str0; - + while (1) { for (ptr1 = str + 1; *ptr1 && *ptr1 != '='; ptr1++); if (!*ptr1) goto parse_err; - + *ptr1 = 0; for (ptr2 = ++ptr1; *ptr2 && *ptr2 != ','; ptr2++); @@ -2270,7 +2270,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int else if (strlen(ptr1) > 4 && memcmp(ptr1, "lua:", 4) == 0) { opt_username = USERNAME_LUA; opt_lua_username_func = _strdup(ptr1 + 4); - } + } #endif else log_error("ipoe: unknown username value '%s'\n", ptr1); @@ -2297,14 +2297,14 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int addr.sin_family = AF_INET; addr.sin_addr.s_addr = relay_addr; addr.sin_port = htons(DHCP_SERV_PORT); - + sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - + if (connect(sock, &addr, sizeof(addr))) { log_error("dhcpv4: relay: %s: connect: %s\n", opt_relay, strerror(errno)); goto out_err; } - + getsockname(sock, &addr, &len); opt_giaddr = addr.sin_addr.s_addr; @@ -2321,7 +2321,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int serv->active = 1; serv->ifindex = ifindex; - + if ((opt_shared && !serv->opt_shared) || (!opt_shared && serv->opt_shared)) { ipoe_drop_sessions(serv, NULL); serv->opt_shared = opt_shared; @@ -2336,7 +2336,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int serv->dhcpv4 = NULL; } - if (serv->dhcpv4_relay && + if (serv->dhcpv4_relay && (serv->dhcpv4_relay->addr != relay_addr || serv->dhcpv4_relay->giaddr != opt_giaddr)) { if (serv->opt_ifcfg) ipoe_serv_del_addr(serv, serv->dhcpv4_relay->giaddr, 0); @@ -2355,7 +2355,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int serv->arp = NULL; } else if (!serv->arp && conf_arp) serv->arp = arpd_start(serv); - + serv->opt_up = opt_up; serv->opt_mode = opt_mode; serv->opt_ifcfg = opt_ifcfg; @@ -2369,7 +2369,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int _free(serv->opt_lua_username_func); serv->opt_lua_username_func = NULL; } - + if (!serv->opt_lua_username_func && opt_lua_username_func) serv->opt_lua_username_func = opt_lua_username_func; else if (opt_lua_username_func) @@ -2392,14 +2392,14 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, ifname); - + if (ioctl(sock_fd, SIOCGIFHWADDR, &ifr)) { log_error("ipoe: '%s': ioctl(SIOCGIFHWADDR): %s\n", ifname, strerror(errno)); return; } - + ioctl(sock_fd, SIOCGIFFLAGS, &ifr); - + if (!(ifr.ifr_flags & IFF_UP)) { ifr.ifr_flags |= IFF_UP; @@ -2435,14 +2435,14 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int INIT_LIST_HEAD(&serv->req_list); memcpy(serv->hwaddr, ifr.ifr_hwaddr.sa_data, ETH_ALEN); serv->disc_timer.expire = ipoe_serv_disc_timer; - + triton_context_register(&serv->ctx, NULL); if (serv->opt_dhcpv4) { serv->dhcpv4 = dhcpv4_create(&serv->ctx, serv->ifname, opt); if (serv->dhcpv4) serv->dhcpv4->recv = ipoe_recv_dhcpv4; - + if (opt_relay) { if (opt_ifcfg) ipoe_serv_add_addr(serv, opt_giaddr, 32); @@ -2452,7 +2452,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int if (serv->opt_arp) serv->arp = arpd_start(serv); - + if (vid) { serv->timer.expire = ipoe_serv_timeout; serv->timer.expire_tv.tv_sec = conf_vlan_timeout; @@ -2488,12 +2488,12 @@ static void load_interface(const char *opt) memcpy(ifr.ifr_name, opt, ptr - opt); ifr.ifr_name[ptr - opt] = 0; - + if (ioctl(sock_fd, SIOCGIFINDEX, &ifr)) { log_error("ipoe: '%s': ioctl(SIOCGIFINDEX): %s\n", ifr.ifr_name, strerror(errno)); return; } - + add_interface(ifr.ifr_name, ifr.ifr_ifindex, opt, 0, 0); } @@ -2517,13 +2517,13 @@ static void load_interface_re(const char *opt) struct iplink_arg arg; for (ptr = opt; *ptr && *ptr != ','; ptr++); - + pattern = _malloc(ptr - (opt + 3) + 1); memcpy(pattern, opt + 3, ptr - (opt + 3)); pattern[ptr - (opt + 3)] = 0; - + re = pcre_compile2(pattern, 0, NULL, &pcre_err, &pcre_offset, NULL); - + if (!re) { log_error("ipoe: '%s': %s at %i\r\n", pattern, pcre_err, pcre_offset); return; @@ -2559,7 +2559,7 @@ static void load_interfaces(struct conf_sect_t *sect) else load_interface(opt->val); } - + list_for_each_entry(serv, &serv_list, entry) { if (!serv->active && !serv->vid) { ipoe_drop_sessions(serv, NULL); @@ -2664,7 +2664,7 @@ static void parse_conf_rad_attr(const char *opt, int *val) struct rad_dict_attr_t *attr; opt = conf_get_opt("ipoe", opt); - + *val = 0; if (opt) { @@ -2798,11 +2798,11 @@ static int parse_vlan_mon(const char *opt, long *mask) log_error("ipoe: vlan-mon=%s: invalid vlan %i\n", opt, vid2); return -1; } - + for (; vid < vid2; vid++) mask[vid / (8*sizeof(long))] &= ~(1lu << (vid % (8*sizeof(long)))); } - + mask[vid / (8*sizeof(long))] &= ~(1lu << (vid % (8*sizeof(long)))); if (*ptr2 == 0) @@ -2815,7 +2815,7 @@ static int parse_vlan_mon(const char *opt, long *mask) } return 0; - + out_err: log_error("ipoe: vlan-mon=%s: failed to parse\n", opt); return -1; @@ -2828,16 +2828,16 @@ static void add_vlan_mon(const char *opt, long *mask) int ifindex; long mask1[4096/8/sizeof(long)]; struct ipoe_serv *serv; - + for (ptr = opt; *ptr && *ptr != ','; ptr++); - + if (ptr - opt >= sizeof(ifr.ifr_name)) { log_error("ipoe: vlan-mon=%s: interface name is too long\n", opt); return; } memset(&ifr, 0, sizeof(ifr)); - + memcpy(ifr.ifr_name, opt, ptr - opt); ifr.ifr_name[ptr - opt] = 0; @@ -2847,9 +2847,9 @@ static void add_vlan_mon(const char *opt, long *mask) } ifindex = ifr.ifr_ifindex; - + ioctl(sock_fd, SIOCGIFFLAGS, &ifr); - + if (!(ifr.ifr_flags & IFF_UP)) { ifr.ifr_flags |= IFF_UP; @@ -2876,15 +2876,15 @@ static int __load_vlan_mon_re(int index, int flags, const char *name, struct ipl memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, name); - + ioctl(sock_fd, SIOCGIFFLAGS, &ifr); - + if (!(ifr.ifr_flags & IFF_UP)) { ifr.ifr_flags |= IFF_UP; ioctl(sock_fd, SIOCSIFFLAGS, &ifr); } - + memcpy(mask1, arg->arg1, sizeof(mask1)); list_for_each_entry(serv, &serv_list, entry) { if (serv->vid && serv->parent_ifindex == index) @@ -2906,13 +2906,13 @@ static void load_vlan_mon_re(const char *opt, long *mask, int len) struct iplink_arg arg; for (ptr = opt; *ptr && *ptr != ','; ptr++); - + pattern = _malloc(ptr - (opt + 3) + 1); memcpy(pattern, opt + 3, ptr - (opt + 3)); pattern[ptr - (opt + 3)] = 0; - + re = pcre_compile2(pattern, 0, NULL, &pcre_err, &pcre_offset, NULL); - + if (!re) { log_error("ipoe: '%s': %s at %i\r\n", pattern, pcre_err, pcre_offset); return; @@ -2942,7 +2942,7 @@ static void load_vlan_mon(struct conf_sect_t *sect) if (!opt->val) continue; - + if (parse_vlan_mon(opt->val, mask)) continue; @@ -2977,7 +2977,7 @@ static void load_config(void) log_emerg("ipoe: unknown username value '%s'\n", opt); } else conf_username = USERNAME_UNSET; - + opt = conf_get_opt("ipoe", "password"); if (opt) { if (!strcmp(opt, "username")) @@ -2998,7 +2998,7 @@ static void load_config(void) } } else conf_netmask = 0; - + opt = conf_get_opt("ipoe", "verbose"); if (opt) conf_verbose = atoi(opt); @@ -3008,49 +3008,49 @@ static void load_config(void) conf_lease_time = atoi(opt); else conf_lease_time = 600; - + opt = conf_get_opt("ipoe", "max-lease-time"); if (opt) conf_lease_timeout = atoi(opt); else conf_lease_timeout = 660; - + opt = conf_get_opt("ipoe", "unit-cache"); if (opt) conf_unit_cache = atoi(opt); - + opt = conf_get_opt("ipoe", "l4-redirect-table"); if (opt && atoi(opt) > 0) conf_l4_redirect_table = atoi(opt); else conf_l4_redirect_table = 0; - + conf_l4_redirect_ipset = conf_get_opt("ipoe", "l4-redirect-ipset"); - + opt = conf_get_opt("ipoe", "l4-redirect-on-reject"); if (opt) { conf_l4_redirect_on_reject = atoi(opt); } else conf_l4_redirect_on_reject = 0; - + if (conf_l4_redirect_on_reject) { l4_redirect_timer.period = conf_l4_redirect_on_reject / 10 * 1000; if (l4_redirect_timer.tpd) triton_timer_mod(&l4_redirect_timer, 0); } - + opt = conf_get_opt("ipoe", "shared"); if (opt) conf_shared = atoi(opt); else conf_shared = 1; - + opt = conf_get_opt("ipoe", "ifcfg"); if (opt) conf_ifcfg = atoi(opt); else conf_ifcfg = 1; - + opt = conf_get_opt("ipoe", "nat"); if (opt) conf_nat = atoi(opt); @@ -3068,12 +3068,12 @@ static void load_config(void) conf_arp = atoi(opt); else conf_arp = 0; - + if (conf_arp < 0 || conf_arp > 2) { log_error("ipoe: arp=%s: invalid value\n", opt); conf_arp = 0; } - + opt = conf_get_opt("ipoe", "mode"); if (opt) { if (!strcmp(opt, "L2")) @@ -3084,7 +3084,7 @@ static void load_config(void) log_emerg("ipoe: failed to parse 'mode=%s'\n", opt); } else conf_mode = MODE_L2; - + conf_relay = conf_get_opt("ipoe", "relay"); opt = conf_get_opt("ipoe", "relay-timeout"); @@ -3092,25 +3092,25 @@ static void load_config(void) conf_relay_timeout = atoi(opt); else conf_relay_timeout = 3; - + opt = conf_get_opt("ipoe", "relay-retransmit"); if (opt && atoi(opt) > 0) conf_relay_retransmit = atoi(opt); else conf_relay_retransmit = 3; - + opt = conf_get_opt("ipoe", "agent-remote-id"); if (opt) conf_agent_remote_id = opt; else conf_agent_remote_id = "accel-pppd"; - + opt = conf_get_opt("ipoe", "ipv6"); if (opt) conf_ipv6 = atoi(opt); else conf_ipv6 = 0; - + opt = conf_get_opt("ipoe", "noauth"); if (opt) conf_noauth = atoi(opt); @@ -3131,45 +3131,45 @@ static void load_config(void) if (!conf_dhcpv4 && !conf_up) conf_dhcpv4 = 1; - + opt = conf_get_opt("ipoe", "proto"); if (opt && atoi(opt) > 0) conf_proto = atoi(opt); else conf_proto = 3; - + opt = conf_get_opt("ipoe", "vlan-timeout"); if (opt && atoi(opt) > 0) conf_vlan_timeout = atoi(opt); else conf_vlan_timeout = 60; - + opt = conf_get_opt("ipoe", "offer-timeout"); if (opt && atoi(opt) > 0) conf_offer_timeout = atoi(opt); else conf_offer_timeout = 10; - + conf_ip_pool = conf_get_opt("ipoe", "ip-pool"); conf_l4_redirect_pool = conf_get_opt("ipoe", "l4-redirect-ip-pool"); conf_vlan_name = conf_get_opt("ipoe", "vlan-name"); if (!conf_vlan_name) conf_vlan_name = "%I.%N"; - + opt = conf_get_opt("ipoe", "ip-unnumbered"); if (opt) conf_ip_unnumbered = atoi(opt); else conf_ip_unnumbered = 1; - + #ifdef RADIUS if (triton_module_loaded("radius")) load_radius_attrs(); #endif parse_offer_delay(conf_get_opt("ipoe", "offer-delay")); - + load_interfaces(s); load_local_nets(s); load_vlan_mon(s); @@ -3200,7 +3200,7 @@ static void ipoe_init(void) ipset_flush(conf_l4_redirect_ipset); cli_register_simple_cmd2(show_stat_exec, NULL, 2, "show", "stat"); - + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); #ifdef RADIUS @@ -3209,7 +3209,7 @@ static void ipoe_init(void) triton_event_register_handler(EV_RADIUS_COA, (triton_event_func)ev_radius_coa); } #endif - + connlimit_loaded = triton_module_loaded("connlimit"); radius_loaded = triton_module_loaded("radius"); } diff --git a/accel-pppd/ctrl/ipoe/ipoe_netlink.c b/accel-pppd/ctrl/ipoe/ipoe_netlink.c index 7643961a..c0610367 100644 --- a/accel-pppd/ctrl/ipoe/ipoe_netlink.c +++ b/accel-pppd/ctrl/ipoe/ipoe_netlink.c @@ -63,7 +63,7 @@ void ipoe_nl_add_net(uint32_t addr, int mask) struct nlmsghdr n; char buf[1024]; } req; - + if (rth.fd == -1) return; @@ -74,7 +74,7 @@ void ipoe_nl_add_net(uint32_t addr, int mask) ghdr = NLMSG_DATA(&req.n); ghdr->cmd = IPOE_CMD_ADD_NET; - + mask = ((1 << mask) - 1) << (32 - mask); addattr32(nlh, 1024, IPOE_ATTR_ADDR, addr); @@ -94,12 +94,12 @@ int ipoe_nl_add_exclude(uint32_t addr, int mask) char buf[1024]; } req; int ret = 0; - + if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC)) { log_ppp_error("ipoe: cannot open generic netlink socket\n"); return -1; } - + nlh = &req.n; nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; @@ -115,9 +115,9 @@ int ipoe_nl_add_exclude(uint32_t addr, int mask) log_ppp_error("ipoe: nl_add_net: error talking to kernel\n"); ret = -1; } - + rtnl_close(&rth); - + return ret; } @@ -130,7 +130,7 @@ void ipoe_nl_del_exclude(uint32_t addr) struct nlmsghdr n; char buf[1024]; } req; - + if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC)) { log_ppp_error("ipoe: cannot open generic netlink socket\n"); return; @@ -148,7 +148,7 @@ void ipoe_nl_del_exclude(uint32_t addr) if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) log_ppp_error("ipoe: nl_add_net: error talking to kernel\n"); - + rtnl_close(&rth); } @@ -186,7 +186,7 @@ void ipoe_nl_add_interface(int ifindex) struct nlmsghdr n; char buf[1024]; } req; - + if (rth.fd == -1) return; @@ -238,10 +238,10 @@ int ipoe_nl_create(uint32_t peer_addr, uint32_t addr, const char *ifname, uint8_ if (peer_addr) addattr32(nlh, 1024, IPOE_ATTR_PEER_ADDR, peer_addr); - + if (addr) addattr32(nlh, 1024, IPOE_ATTR_ADDR, addr); - + if (hwaddr) { memcpy(u.hwaddr, hwaddr, 6); addattr_l(nlh, 1024, IPOE_ATTR_HWADDR, &u.u64, 8); @@ -252,7 +252,7 @@ int ipoe_nl_create(uint32_t peer_addr, uint32_t addr, const char *ifname, uint8_ if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) log_ppp_error("ipoe: nl_create: error talking to kernel\n"); - + if (nlh->nlmsg_type != ipoe_genl_id) { log_ppp_error("ipoe: not a IPoE message %d\n", nlh->nlmsg_type); goto out; @@ -281,7 +281,7 @@ int ipoe_nl_create(uint32_t peer_addr, uint32_t addr, const char *ifname, uint8_ } ret = *(uint32_t *)(RTA_DATA(tb[IPOE_ATTR_IFINDEX])); - + out: rtnl_close(&rth); @@ -319,7 +319,7 @@ int ipoe_nl_modify(int ifindex, uint32_t peer_addr, uint32_t addr, const char *i addattr32(nlh, 1024, IPOE_ATTR_IFINDEX, ifindex); addattr32(nlh, 1024, IPOE_ATTR_PEER_ADDR, peer_addr); addattr32(nlh, 1024, IPOE_ATTR_ADDR, addr); - + if (hwaddr) { memcpy(u.hwaddr, hwaddr, 6); addattr_l(nlh, 1024, IPOE_ATTR_HWADDR, &u.u64, 8); @@ -332,7 +332,7 @@ int ipoe_nl_modify(int ifindex, uint32_t peer_addr, uint32_t addr, const char *i log_ppp_error("ipoe: nl_create: error talking to kernel\n"); ret = -1; } - + rtnl_close(&rth); return ret; @@ -399,7 +399,7 @@ void ipoe_nl_get_sessions(struct list_head *list) if (rth.fd == -1) return; - + nlh = &req.n; nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); nlh->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; @@ -456,7 +456,7 @@ int ipoe_nl_add_vlan_mon(int ifindex, long *mask, int len) struct nlmsghdr n; char buf[1024]; } req; - + if (rth.fd == -1) return -1; @@ -489,12 +489,12 @@ int ipoe_nl_add_vlan_mon_vid(int ifindex, int vid) char buf[1024]; } req; int r = 0; - + if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC)) { log_error("ipoe: cannot open generic netlink socket\n"); return -1; } - + nlh = &req.n; nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; @@ -510,7 +510,7 @@ int ipoe_nl_add_vlan_mon_vid(int ifindex, int vid) log_error("ipoe: nl_add_vlan_mon_vid: error talking to kernel\n"); r = -1; } - + rtnl_close(&rth); return r; @@ -525,7 +525,7 @@ int ipoe_nl_del_vlan_mon(int ifindex) struct nlmsghdr n; char buf[1024]; } req; - + if (rth.fd == -1) return -1; @@ -575,7 +575,7 @@ static void ipoe_up_handler(const struct sockaddr_nl *addr, struct nlmsghdr *h) break; parse_rtattr_nested(tb2, IPOE_ATTR_MAX, tb[i]); - + if (!tb2[IPOE_ATTR_ETH_HDR] || !tb2[IPOE_ATTR_IP_HDR] || !tb2[IPOE_ATTR_IFINDEX]) continue; @@ -612,7 +612,7 @@ static void ipoe_vlan_mon_handler(const struct sockaddr_nl *addr, struct nlmsghd break; parse_rtattr_nested(tb2, IPOE_ATTR_MAX, tb[i]); - + if (!tb2[IPOE_ATTR_IFINDEX] || !tb2[IPOE_ATTR_ADDR]) continue; @@ -657,7 +657,7 @@ static int ipoe_mc_read(struct triton_md_handler_t *h) continue; return 0; } - + if (status == 0) { log_error("ipoe: EOF on netlink\n"); return 0; @@ -728,13 +728,13 @@ static void init(void) rth.fd = -1; return; } - + if (rtnl_open_byproto(&rth, 1 << (mcg_id - 1), NETLINK_GENERIC)) { log_error("ipoe: cannot open generic netlink socket\n"); rth.fd = -1; return; } - + fcntl(rth.fd, F_SETFL, O_NONBLOCK); fcntl(rth.fd, F_SETFD, fcntl(rth.fd, F_GETFD) | FD_CLOEXEC); diff --git a/accel-pppd/ctrl/ipoe/lua.c b/accel-pppd/ctrl/ipoe/lua.c index 46c85948..abc3d0dd 100644 --- a/accel-pppd/ctrl/ipoe/lua.c +++ b/accel-pppd/ctrl/ipoe/lua.c @@ -70,7 +70,7 @@ static int packet4_hdr(lua_State *L) if (!ses || !ses->dhcpv4_request) return 0; - + if (!strcmp(name, "xid")) lua_pushinteger(L, ses->dhcpv4_request->hdr->xid); else if (!strcmp(name, "ciaddr")) { @@ -95,9 +95,9 @@ static int packet4_ifname(lua_State *L) if (!ses) return 0; - + lua_pushstring(L, ses->serv->ifname); - + return 1; } @@ -129,7 +129,7 @@ static int packet4_options(lua_State *L) if (!ses || !ses->dhcpv4_request) return 0; - + lua_newtable(L); list_for_each_entry(opt, &ses->dhcpv4_request->options, entry) { @@ -146,12 +146,12 @@ static int packet4_agent_circuit_id(lua_State *L) if (!ses || !ses->dhcpv4_request) return 0; - + if (ses->agent_circuit_id) lua_pushlstring(L, (char *)(ses->agent_circuit_id + 1), *ses->agent_circuit_id); else lua_pushnil(L); - + return 1; } @@ -161,12 +161,12 @@ static int packet4_agent_remote_id(lua_State *L) if (!ses || !ses->dhcpv4_request) return 0; - + if (ses->agent_remote_id) lua_pushlstring(L, (char *)(ses->agent_remote_id + 1), *ses->agent_remote_id); else lua_pushnil(L); - + return 1; } @@ -264,7 +264,7 @@ char *ipoe_lua_get_username(struct ipoe_session *ses, const char *func) lua_settop(L, 0); return r; - + out_err: file_error = 1; lua_close(L); diff --git a/accel-pppd/ctrl/ipoe/lua_lpack.c b/accel-pppd/ctrl/ipoe/lua_lpack.c index 0dc3046d..feb0a5a8 100644 --- a/accel-pppd/ctrl/ipoe/lua_lpack.c +++ b/accel-pppd/ctrl/ipoe/lua_lpack.c @@ -109,7 +109,7 @@ static int l_unpack(lua_State *L) /** unpack(s,f,[init]) */ { int c=*f++; int N=1; - if (isdigit(*f)) + if (isdigit(*f)) { N=0; while (isdigit(*f)) N=10*N+(*f++)-'0'; @@ -204,7 +204,7 @@ static int l_pack(lua_State *L) /** pack(f,...) */ { int c=*f++; int N=1; - if (isdigit(*f)) + if (isdigit(*f)) { N=0; while (isdigit(*f)) N=10*N+(*f++)-'0'; diff --git a/accel-pppd/ctrl/l2tp/dict.c b/accel-pppd/ctrl/l2tp/dict.c index f1454499..b636c871 100644 --- a/accel-pppd/ctrl/l2tp/dict.c +++ b/accel-pppd/ctrl/l2tp/dict.c @@ -70,7 +70,7 @@ const struct l2tp_dict_value_t *l2tp_dict_find_value(const struct l2tp_dict_attr static char *skip_word(char *ptr) { for(; *ptr; ptr++) - if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') + if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') break; return ptr; } @@ -91,9 +91,9 @@ static int split(char *buf, char **ptr) buf = skip_word(buf); if (!*buf) return i; - + *buf = 0; - + buf = skip_space(buf + 1); if (!*buf) return i; @@ -153,12 +153,12 @@ static int dict_load(const char *fname) } else if (!strcmp(buf, "ATTRIBUTE")) { if (r < 3) goto out_syntax; - + attr = malloc(sizeof(*attr)); memset(attr, 0, sizeof(*attr)); list_add_tail(&attr->entry, items); INIT_LIST_HEAD(&attr->values); - + attr->name = strdup(ptr[0]); attr->id = strtol(ptr[1], &endptr, 10); if (*endptr != 0) @@ -197,7 +197,7 @@ static int dict_load(const char *fname) } else if (!strcmp(buf, "VALUE")) { if (r != 3) goto out_syntax; - + attr = l2tp_dict_find_attr_by_name(ptr[0]); if (!attr) { log_emerg("l2tp:%s:%i: attribute not found\n", fname, n); diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 2a52d69f..befe0c90 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -4552,7 +4552,7 @@ static int start_udp_server(void) err_hnd: triton_md_unregister_handler(&udp_serv.hnd, 1); triton_context_unregister(&udp_serv.ctx); - + return -1; err_fd: @@ -4888,7 +4888,7 @@ static void load_config(void) opt = conf_get_opt("l2tp", "dir300_quirk"); if (opt) conf_dir300_quirk = atoi(opt); - + conf_mppe = MPPE_UNSET; opt = conf_get_opt("l2tp", "mppe"); if (opt) { diff --git a/accel-pppd/ctrl/l2tp/netlink.c b/accel-pppd/ctrl/l2tp/netlink.c index c8dce899..3de6e060 100644 --- a/accel-pppd/ctrl/l2tp/netlink.c +++ b/accel-pppd/ctrl/l2tp/netlink.c @@ -11,7 +11,7 @@ void l2tp_nl_delete_tunnel(int tid) { struct nl_sock *nl_sock; struct nl_msg *msg; - + nl_sock = nl_socket_alloc(); msg = nlmsg_alloc(); @@ -32,10 +32,10 @@ void l2tp_nl_create_tunnel(int fd, int tid, int peer_tid) { struct nl_sock *nl_sock; struct nl_msg *msg; - + nl_sock = nl_socket_alloc(); msg = nlmsg_alloc(); - + genl_connect(nl_sock); genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, NLM_F_REQUEST, L2TP_CMD_TUNNEL_CREATE, L2TP_GENL_VERSION); @@ -58,10 +58,10 @@ void l2tp_nl_create_session(int tid, int sid, int peer_sid) { struct nl_sock *nl_sock; struct nl_msg *msg; - + nl_sock = nl_socket_alloc(); msg = nlmsg_alloc(); - + genl_connect(nl_sock); genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, NLM_F_REQUEST, L2TP_CMD_SESSION_CREATE, L2TP_GENL_VERSION); @@ -83,11 +83,11 @@ void l2tp_nl_create_session(int tid, int sid, int peer_sid) static void init(void) { struct nl_sock *nl_sock = nl_socket_alloc(); - + genl_connect(nl_sock); family = genl_ctrl_resolve(nl_sock, L2TP_GENL_NAME); - + nl_close(nl_sock); nl_socket_free(nl_sock); } diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index 78e0789e..34e4bb67 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -69,7 +69,7 @@ struct l2tp_packet_t *l2tp_packet_alloc(int ver, int msg_type, struct l2tp_packet_t *pack = mempool_alloc(pack_pool); if (!pack) return NULL; - + memset(pack, 0, sizeof(*pack)); INIT_LIST_HEAD(&pack->attrs); pack->hdr.ver = ver; @@ -250,16 +250,16 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info, memset(&msg, 0, sizeof(msg)); msg.msg_control = msg_control; msg.msg_controllen = 128; - + n = recvmsg(fd, &msg, MSG_PEEK); - + if (n < 0) { if (errno == EAGAIN) return -1; log_error("l2tp: recvmsg: %s\n", strerror(errno)); return 0; } - + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) { memcpy(pkt_info, CMSG_DATA(cmsg), sizeof(*pkt_info)); diff --git a/accel-pppd/ctrl/pppoe/cli.c b/accel-pppd/ctrl/pppoe/cli.c index ad577c11..c79a5f1e 100644 --- a/accel-pppd/ctrl/pppoe/cli.c +++ b/accel-pppd/ctrl/pppoe/cli.c @@ -77,7 +77,7 @@ static int intf_exec(const char *cmd, char * const *fields, int fields_cnt, void pppoe_server_stop(fields[3]); else goto help; - + return CLI_CMD_OK; help: intf_help(fields, fields_cnt, client); @@ -149,9 +149,9 @@ static int show_verbose_exec(const char *cmd, char * const *f, int f_cnt, void * { if (f_cnt != 3) return CLI_CMD_SYNTAX; - + cli_sendv(cli, "%i\r\n", conf_verbose); - + return CLI_CMD_OK; } @@ -159,9 +159,9 @@ static int show_pado_delay_exec(const char *cmd, char * const *f, int f_cnt, voi { if (f_cnt != 3) return CLI_CMD_SYNTAX; - + cli_sendv(cli, "%s\r\n", conf_pado_delay); - + return CLI_CMD_OK; } @@ -169,12 +169,12 @@ static int show_service_name_exec(const char *cmd, char * const *f, int f_cnt, v { if (f_cnt != 3) return CLI_CMD_SYNTAX; - + if (conf_service_name) cli_sendv(cli, "%s\r\n", conf_service_name); else cli_sendv(cli, "*\r\n"); - + return CLI_CMD_OK; } @@ -182,9 +182,9 @@ static int show_ac_name_exec(const char *cmd, char * const *f, int f_cnt, void * { if (f_cnt != 3) return CLI_CMD_SYNTAX; - + cli_sendv(cli, "%s\r\n", conf_ac_name); - + return CLI_CMD_OK; } @@ -192,14 +192,14 @@ static int set_verbose_exec(const char *cmd, char * const *f, int f_cnt, void *c { if (f_cnt != 4) return CLI_CMD_SYNTAX; - + if (!strcmp(f[3], "0")) conf_verbose = 0; else if (!strcmp(f[3], "1")) conf_verbose = 1; else return CLI_CMD_INVAL; - + return CLI_CMD_OK; } @@ -218,7 +218,7 @@ static int set_service_name_exec(const char *cmd, char * const *f, int f_cnt, vo { if (f_cnt != 4) return CLI_CMD_SYNTAX; - + if (conf_service_name) _free(conf_service_name); @@ -226,7 +226,7 @@ static int set_service_name_exec(const char *cmd, char * const *f, int f_cnt, vo conf_service_name = NULL; else conf_service_name = _strdup(f[3]); - + return CLI_CMD_OK; } @@ -234,10 +234,10 @@ static int set_ac_name_exec(const char *cmd, char * const *f, int f_cnt, void *c { if (f_cnt != 4) return CLI_CMD_SYNTAX; - + _free(conf_ac_name); conf_ac_name = _strdup(f[3]); - + return CLI_CMD_OK; } //=================================== diff --git a/accel-pppd/ctrl/pppoe/dpado.c b/accel-pppd/ctrl/pppoe/dpado.c index 3f565198..c7992bc4 100644 --- a/accel-pppd/ctrl/pppoe/dpado.c +++ b/accel-pppd/ctrl/pppoe/dpado.c @@ -37,7 +37,7 @@ void dpado_check_next(int conn_cnt) dpado_range_next = list_entry(dpado_range_next->entry.next, typeof(*dpado_range_next), entry); else dpado_range_next = NULL; - /*printf("active=%i, prev=%i:%i, next=%i:%i, pado_delay=%i\n", stat_active, + /*printf("active=%i, prev=%i:%i, next=%i:%i, pado_delay=%i\n", stat_active, dpado_range_prev?dpado_range_prev->pado_delay:0,dpado_range_prev?dpado_range_prev->conn_cnt:0, dpado_range_next?dpado_range_next->pado_delay:0,dpado_range_next?dpado_range_next->conn_cnt:0, pado_delay);*/ @@ -52,7 +52,7 @@ void dpado_check_prev(int conn_cnt) dpado_range_next = dpado_range_prev; dpado_range_prev = list_entry(dpado_range_prev->entry.prev, typeof(*dpado_range_prev), entry); pado_delay = dpado_range_prev->pado_delay; - /*printf("active=%i, prev=%i:%i, next=%i:%i, pado_delay=%i\n", stat_active, + /*printf("active=%i, prev=%i:%i, next=%i:%i, pado_delay=%i\n", stat_active, dpado_range_prev?dpado_range_prev->pado_delay:0,dpado_range_prev?dpado_range_prev->conn_cnt:0, dpado_range_next?dpado_range_next->pado_delay:0,dpado_range_next?dpado_range_next->conn_cnt:0, pado_delay);*/ @@ -144,7 +144,7 @@ int dpado_parse(const char *str) if (conf_pado_delay) _free(conf_pado_delay); conf_pado_delay = _strdup(str); - /*printf("active=%i, prev=%i:%i, next=%i:%i, pado_delay=%i\n", stat_active, + /*printf("active=%i, prev=%i:%i, next=%i:%i, pado_delay=%i\n", stat_active, dpado_range_prev?dpado_range_prev->pado_delay:0,dpado_range_prev?dpado_range_prev->conn_cnt:0, dpado_range_next?dpado_range_next->pado_delay:0,dpado_range_next?dpado_range_next->conn_cnt:0, pado_delay);*/ diff --git a/accel-pppd/ctrl/pppoe/mac_filter.c b/accel-pppd/ctrl/pppoe/mac_filter.c index b55cbf2e..d1e104e6 100644 --- a/accel-pppd/ctrl/pppoe/mac_filter.c +++ b/accel-pppd/ctrl/pppoe/mac_filter.c @@ -73,7 +73,7 @@ static int mac_filter_load(const char *opt) log_emerg("pppoe: open '%s': %s\n", name, strerror(errno)); goto err; } - + conf_mac_filter = opt; pthread_rwlock_wrlock(&lock); @@ -274,7 +274,7 @@ static void init(void) const char *opt = conf_get_opt("pppoe", "mac-filter"); if (!opt || mac_filter_load(opt)) type = -1; - + cli_register_simple_cmd2(cmd_exec, cmd_help, 2, "pppoe", "mac-filter"); } diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 5037f5a0..12c274bb 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -49,7 +49,7 @@ struct pppoe_conn_t { struct pppoe_tag *service_name; struct pppoe_tag *tr101; uint8_t cookie[COOKIE_LENGTH - 4]; - + struct ap_ctrl ctrl; struct ppp_t ppp; #ifdef RADIUS @@ -153,7 +153,7 @@ static void disconnect(struct pppoe_conn_t *conn) pppoe_server_free(conn->serv); } else pthread_mutex_unlock(&conn->serv->lock); - + pthread_mutex_lock(&sid_lock); sid_map[conn->sid/(8*sizeof(long))] |= 1 << (conn->sid % (8*sizeof(long))); pthread_mutex_unlock(&sid_lock); @@ -209,7 +209,7 @@ static int pppoe_rad_send_access_request(struct rad_plugin_t *rad, struct rad_pa if (conn->tr101) return tr101_send_access_request(conn->tr101, pack); - + return 0; } @@ -219,11 +219,11 @@ static int pppoe_rad_send_accounting_request(struct rad_plugin_t *rad, struct ra if (conn->tr101) return tr101_send_accounting_request(conn->tr101, pack); - + return 0; } #endif - + static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const uint8_t *addr, const struct pppoe_tag *host_uniq, const struct pppoe_tag *relay_sid, const struct pppoe_tag *service_name, const struct pppoe_tag *tr101, const uint8_t *cookie) { struct pppoe_conn_t *conn; @@ -241,18 +241,18 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui old_sid_ptr = sid_ptr; while (1) { int bit = ffsl(*sid_ptr) - 1; - + if (bit != -1) { conn->sid = sid_idx*8*sizeof(long) + bit; *sid_ptr &= ~(1lu << bit); } - + if (++sid_idx == SID_MAX/8/sizeof(long)) { sid_ptr = sid_map; sid_idx = 0; } else sid_ptr++; - + if (bit != -1) break; @@ -349,7 +349,7 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui else sprintf(conn->ctrl.calling_station_id, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - + ppp_init(&conn->ppp); conn->ppp.ses.ctrl = &conn->ctrl; @@ -357,16 +357,16 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui if (conf_ip_pool) conn->ppp.ses.ipv4_pool_name = _strdup(conf_ip_pool); - + conn->disc_sock = dup(serv->hnd.fd); - + triton_context_register(&conn->ctx, &conn->ppp.ses); pthread_mutex_lock(&serv->lock); list_add_tail(&conn->entry, &serv->conn_list); serv->conn_cnt++; pthread_mutex_unlock(&serv->lock); - + return conn; } @@ -374,7 +374,7 @@ static void connect_channel(struct pppoe_conn_t *conn) { int sock; struct sockaddr_pppox sp; - + triton_event_fire(EV_CTRL_STARTING, &conn->ppp.ses); triton_event_fire(EV_CTRL_STARTED, &conn->ppp.ses); @@ -383,7 +383,7 @@ static void connect_channel(struct pppoe_conn_t *conn) log_error("pppoe: socket(PPPOX): %s\n", strerror(errno)); goto out_err; } - + fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC); memset(&sp, 0, sizeof(sp)); @@ -403,7 +403,7 @@ static void connect_channel(struct pppoe_conn_t *conn) if (establish_ppp(&conn->ppp)) goto out_err_close; - + #ifdef RADIUS if (conn->tr101 && triton_module_loaded("radius")) { conn->radius.send_access_request = pppoe_rad_send_access_request; @@ -413,9 +413,9 @@ static void connect_channel(struct pppoe_conn_t *conn) #endif conn->ppp_started = 1; - + dpado_check_next(__sync_add_and_fetch(&stat_active, 1)); - + return; out_err_close: @@ -478,8 +478,8 @@ static void print_packet(uint8_t *pack) log_info2("PADT"); break; } - - log_info2(" %02x:%02x:%02x:%02x:%02x:%02x => %02x:%02x:%02x:%02x:%02x:%02x", + + log_info2(" %02x:%02x:%02x:%02x:%02x:%02x => %02x:%02x:%02x:%02x:%02x:%02x", ethhdr->h_source[0], ethhdr->h_source[1], ethhdr->h_source[2], ethhdr->h_source[3], ethhdr->h_source[4], ethhdr->h_source[5], ethhdr->h_dest[0], ethhdr->h_dest[1], ethhdr->h_dest[2], ethhdr->h_dest[3], ethhdr->h_dest[4], ethhdr->h_dest[5]); @@ -577,7 +577,7 @@ static void generate_cookie(struct pppoe_serv_t *serv, const uint8_t *src, uint8 u1.raw[16 + i] = buf[i] ^ buf[i + 4] ^ buf[i + 8] ^ buf[i + 12]; } else memset(u1.raw + 16, 0, 4); - + *(uint32_t *)(u1.raw + 20) = ts.tv_sec + conf_cookie_timeout; for (i = 0; i < 3; i++) @@ -585,7 +585,7 @@ static void generate_cookie(struct pppoe_serv_t *serv, const uint8_t *src, uint8 for (i = 0; i < 3; i++) DES_ecb_encrypt(&u2.b[i], &u1.b[i], &serv->des_ks, DES_ENCRYPT); - + memcpy(cookie, u1.raw, 24); } @@ -593,7 +593,7 @@ static int check_cookie(struct pppoe_serv_t *serv, const uint8_t *src, const uin { MD5_CTX ctx; DES_cblock key; - DES_key_schedule ks; + DES_key_schedule ks; int i; union { DES_cblock b[3]; @@ -602,7 +602,7 @@ static int check_cookie(struct pppoe_serv_t *serv, const uint8_t *src, const uin struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - + memcpy(key, serv->hwaddr, 6); key[6] = src[4]; key[7] = src[5]; @@ -612,13 +612,13 @@ static int check_cookie(struct pppoe_serv_t *serv, const uint8_t *src, const uin for (i = 0; i < 3; i++) DES_ecb_encrypt(&u1.b[i], &u2.b[i], &serv->des_ks, DES_DECRYPT); - + for (i = 0; i < 3; i++) DES_ecb_encrypt(&u2.b[i], &u1.b[i], &ks, DES_DECRYPT); - + if (*(uint32_t *)(u1.raw + 20) < ts.tv_sec) return 1; - + MD5_Init(&ctx); MD5_Update(&ctx, serv->secret, SECRET_LENGTH); MD5_Update(&ctx, serv->hwaddr, ETH_ALEN); @@ -664,7 +664,7 @@ static void add_tag2(uint8_t *pack, const struct pppoe_tag *t) struct pppoe_tag *tag = (struct pppoe_tag *)(pack + ETH_HLEN + sizeof(*hdr) + ntohs(hdr->length)); memcpy(tag, t, sizeof(*t) + ntohs(t->tag_len)); - + hdr->length = htons(ntohs(hdr->length) + sizeof(*tag) + ntohs(t->tag_len)); } @@ -695,14 +695,14 @@ static void pppoe_send_PADO(struct pppoe_serv_t *serv, const uint8_t *addr, cons if (service_name) add_tag2(pack, service_name); - + generate_cookie(serv, addr, cookie, host_uniq, relay_sid); add_tag(pack, TAG_AC_COOKIE, cookie, COOKIE_LENGTH); if (host_uniq) add_tag2(pack, host_uniq); - + if (relay_sid) add_tag2(pack, relay_sid); @@ -726,7 +726,7 @@ static void pppoe_send_err(struct pppoe_serv_t *serv, const uint8_t *addr, const if (host_uniq) add_tag2(pack, host_uniq); - + if (relay_sid) add_tag2(pack, relay_sid); @@ -745,12 +745,12 @@ static void pppoe_send_PADS(struct pppoe_conn_t *conn) setup_header(pack, conn->serv->hwaddr, conn->addr, CODE_PADS, conn->sid); add_tag(pack, TAG_AC_NAME, (uint8_t *)conf_ac_name, strlen(conf_ac_name)); - + add_tag2(pack, conn->service_name); if (conn->host_uniq) add_tag2(pack, conn->host_uniq); - + if (conn->relay_sid) add_tag2(pack, conn->relay_sid); @@ -831,13 +831,13 @@ static int check_padi_limit(struct pppoe_serv_t *serv, uint8_t *addr) } else break; } - + if (serv->padi_cnt == serv->padi_limit) return -1; - + if (conf_padi_limit && total_padi_cnt >= conf_padi_limit) return -1; - + list_for_each_entry(padi, &serv->padi_list, entry) { if (memcmp(padi->addr, addr, ETH_ALEN) == 0) return -1; @@ -846,7 +846,7 @@ static int check_padi_limit(struct pppoe_serv_t *serv, uint8_t *addr) padi = mempool_alloc(padi_pool); if (!padi) return -1; - + padi->ts = ts; memcpy(padi->addr, addr, ETH_ALEN); list_add_tail(&padi->entry, &serv->padi_list); @@ -990,13 +990,13 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size) if (ap_shutdown) return; - + if (!memcmp(ethhdr->h_dest, bc_addr, ETH_ALEN)) { if (conf_verbose) log_warn("pppoe: discard PADR (destination address is broadcast)\n"); return; } - + if (hdr->sid) { if (conf_verbose) log_warn("pppoe: discarding PADR packet (sid is not zero)\n"); @@ -1007,7 +1007,7 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size) log_info2("recv "); print_packet(pack); } - + for (n = 0; n < ntohs(hdr->length); n += sizeof(*tag) + ntohs(tag->tag_len)) { tag = (struct pppoe_tag *)(pack + ETH_HLEN + sizeof(*hdr) + n); @@ -1110,13 +1110,13 @@ static void pppoe_recv_PADT(struct pppoe_serv_t *serv, uint8_t *pack) struct pppoe_hdr *hdr = (struct pppoe_hdr *)(pack + ETH_HLEN); struct pppoe_conn_t *conn; uint16_t sid = ntohs(hdr->sid); - + if (!memcmp(ethhdr->h_dest, bc_addr, ETH_ALEN)) { if (conf_verbose) log_warn("pppoe: discard PADT (destination address is broadcast)\n"); return; } - + if (conf_verbose) { log_info2("recv "); print_packet(pack); @@ -1191,7 +1191,7 @@ static int pppoe_serv_read(struct triton_md_handler_t *h) log_warn("pppoe: discarding packet (unsupported version %i)\n", hdr->ver); continue; } - + if (hdr->type != 1) { if (conf_verbose) log_warn("pppoe: discarding packet (unsupported type %i)\n", hdr->type); @@ -1266,13 +1266,13 @@ static void pppoe_add_interface_re(const char *opt, void *cli) struct iplink_arg arg; for (ptr = opt; *ptr && *ptr != ','; ptr++); - + pattern = _malloc(ptr - (opt + 3) + 1); memcpy(pattern, opt + 3, ptr - (opt + 3)); pattern[ptr - (opt + 3)] = 0; - + re = pcre_compile2(pattern, 0, NULL, &pcre_err, &pcre_offset, NULL); - + if (!re) { log_error("pppoe: %s at %i\r\n", pcre_err, pcre_offset); return; @@ -1352,7 +1352,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli) _free(serv); return; } - + fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC); if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &f, sizeof(f))) { @@ -1398,7 +1398,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli) cli_sendv(cli, "interface %s has MTU of %i, should be %i\r\n", ifname, ifr.ifr_mtu, ETH_DATA_LEN); log_error("pppoe: interface %s has MTU of %i, should be %i\n", ifname, ifr.ifr_mtu, ETH_DATA_LEN); } - + if (ioctl(sock, SIOCGIFINDEX, &ifr)) { if (cli) cli_sendv(cli, "ioctl(SIOCGIFINDEX): %s\r\n", strerror(errno)); @@ -1464,7 +1464,7 @@ static void _server_stop(struct pppoe_serv_t *serv) if (serv->stopping) return; - + serv->stopping = 1; triton_md_disable_handler(&serv->hnd, MD_MODE_READ | MD_MODE_WRITE); @@ -1578,11 +1578,11 @@ static void load_config(void) opt = conf_get_opt("pppoe", "PADO-Delay"); if (opt) dpado_parse(opt); - + opt = conf_get_opt("pppoe", "tr101"); if (opt) conf_tr101 = atoi(opt); - + opt = conf_get_opt("pppoe", "padi-limit"); if (opt) conf_padi_limit = atoi(opt); @@ -1590,7 +1590,7 @@ static void load_config(void) opt = conf_get_opt("pppoe", "sid-uppercase"); if (opt) conf_sid_uppercase = atoi(opt); - + opt = conf_get_opt("pppoe", "cookie-timeout"); if (opt) conf_cookie_timeout = atoi(opt); @@ -1665,7 +1665,7 @@ static void pppoe_init(void) log_error("pppoe: no configuration, disabled...\n"); return; } - + load_config(); connlimit_loaded = triton_module_loaded("connlimit"); diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index 19deb3db..94cfd7fd 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -78,7 +78,7 @@ static void disconnect(struct pptp_conn_t *conn) log_ppp_debug("pptp: disconnect\n"); triton_md_unregister_handler(&conn->hnd, 1); - + if (conn->timeout_timer.tpd) triton_timer_del(&conn->timeout_timer); @@ -93,14 +93,14 @@ static void disconnect(struct pptp_conn_t *conn) __sync_sub_and_fetch(&stat_starting, 1); triton_event_fire(EV_CTRL_FINISHED, &conn->ppp.ses); - + log_ppp_info1("disconnected\n"); triton_context_unregister(&conn->ctx); if (conn->ppp.ses.chan_name) _free(conn->ppp.ses.chan_name); - + _free(conn->in_buf); _free(conn->out_buf); _free(conn->ctrl.calling_station_id); @@ -178,7 +178,7 @@ static int pptp_stop_ctrl_conn_rqst(struct pptp_conn_t *conn) } static int pptp_stop_ctrl_conn_rply(struct pptp_conn_t *conn) -{ +{ struct pptp_stop_ctrl_conn *msg = (struct pptp_stop_ctrl_conn*)conn->in_buf; if (conf_verbose) log_ppp_info2("recv [PPTP Stop-Ctrl-Conn-Reply <Result %i> <Error %i>]\n", msg->reason_result, msg->error_code); @@ -342,7 +342,7 @@ static int pptp_out_call_rqst(struct pptp_conn_t *conn) conn->state = STATE_PPP; __sync_sub_and_fetch(&stat_starting, 1); __sync_add_and_fetch(&stat_active, 1); - + if (conn->timeout_timer.tpd) triton_timer_del(&conn->timeout_timer); @@ -366,7 +366,7 @@ static int send_pptp_call_disconnect_notify(struct pptp_conn_t *conn, int result if (conf_verbose) log_ppp_info2("send [PPTP Call-Disconnect-Notify <Call-ID %x> <Result %i> <Error %i> <Cause %i>]\n", ntohs(msg.call_id), msg.result_code, msg.error_code, msg.cause_code); - + return post_msg(conn, &msg, sizeof(msg)); } @@ -409,7 +409,7 @@ static int pptp_echo_rqst(struct pptp_conn_t *conn) static int pptp_echo_rply(struct pptp_conn_t *conn) { struct pptp_echo_rply *msg = (struct pptp_echo_rply *)conn->in_buf; - + if (conf_verbose) log_ppp_debug("recv [PPTP Echo-Reply <Identifier %x>]\n", msg->identifier); @@ -678,13 +678,13 @@ static int pptp_connect(struct triton_md_handler_t *h) conn->ctrl.ppp = 1; conn->ctrl.name = "pptp"; conn->ctrl.mppe = conf_mppe; - + conn->ctrl.calling_station_id = _malloc(17); conn->ctrl.called_station_id = _malloc(17); u_inet_ntoa(addr.sin_addr.s_addr, conn->ctrl.calling_station_id); getsockname(sock, &addr, &size); u_inet_ntoa(addr.sin_addr.s_addr, conn->ctrl.called_station_id); - + ppp_init(&conn->ppp); conn->ppp.ses.ctrl = &conn->ctrl; @@ -739,7 +739,7 @@ static void load_config(void) opt = conf_get_opt("pptp", "timeout"); if (opt && atoi(opt) > 0) conf_timeout = atoi(opt); - + opt = conf_get_opt("pptp", "echo-interval"); if (opt && atoi(opt) >= 0) conf_echo_interval = atoi(opt); @@ -787,7 +787,7 @@ static void pptp_init(void) } fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC); - + addr.sin_family = AF_INET; opt = conf_get_opt("pptp", "bind"); @@ -801,8 +801,8 @@ static void pptp_init(void) addr.sin_port = htons(atoi(opt)); else addr.sin_port = htons(PPTP_PORT); - - setsockopt(serv.hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv.hnd.fd, 4); + + setsockopt(serv.hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv.hnd.fd, 4); if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { log_emerg("pptp: failed to bind socket: %s\n", strerror(errno)); close(serv.hnd.fd); @@ -820,7 +820,7 @@ static void pptp_init(void) close(serv.hnd.fd); return; } - + conn_pool = mempool_create(sizeof(struct pptp_conn_t)); load_config(); @@ -831,7 +831,7 @@ static void pptp_init(void) triton_context_wakeup(&serv.ctx); cli_register_simple_cmd2(show_stat_exec, NULL, 2, "show", "stat"); - + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); } diff --git a/accel-pppd/extra/chap-secrets.c b/accel-pppd/extra/chap-secrets.c index d48ecf6b..b693a326 100644 --- a/accel-pppd/extra/chap-secrets.c +++ b/accel-pppd/extra/chap-secrets.c @@ -71,7 +71,7 @@ static char *skip_word(char *ptr) *ptr = ' '; break; } - } else if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') + } else if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') break; } @@ -95,9 +95,9 @@ static int split(char *buf, char **ptr) buf = skip_word(buf); if (!*buf) return i; - + *buf = 0; - + buf = skip_space(buf + 1); if (!*buf) return i; @@ -135,7 +135,7 @@ static struct cs_pd_t *create_pd(struct ap_session *ses, const char *username) if (!conf_chap_secrets) return NULL; - + #ifdef CRYPTO_OPENSSL if (conf_encrypted && !list_empty(&hash_chain)) { unsigned int size = 0; @@ -153,7 +153,7 @@ static struct cs_pd_t *create_pd(struct ap_session *ses, const char *username) username = username_hash; } #endif - + f = fopen(conf_chap_secrets, "r"); if (!f) { log_error("chap-secrets: open '%s': %s\n", conf_chap_secrets, strerror(errno)); @@ -166,7 +166,7 @@ static struct cs_pd_t *create_pd(struct ap_session *ses, const char *username) fclose(f); return NULL; } - + while (fgets(buf, 4096, f)) { if (buf[0] == '#') continue; @@ -209,14 +209,14 @@ found: _free(pd); goto out; } - + for (i = 0; i < 16; i++) { c = ptr[1][i*2 + 2]; ptr[1][i*2 + 2] = 0; pd->passwd[i] = strtol(ptr[1] + i*2, NULL, 16); ptr[1][i*2 + 2] = c; } - } else + } else #endif { pd->passwd = _strdup(ptr[1]); @@ -290,7 +290,7 @@ static void ev_ses_pre_up(struct ap_session *ses) static struct ipv4db_item_t *get_ip(struct ap_session *ses) { struct cs_pd_t *pd; - + if (!conf_gw_ip_address && ses->ctrl->ppp) return NULL; @@ -319,10 +319,10 @@ static char* get_passwd(struct pwdb_t *pwdb, struct ap_session *ses, const char if (!pd) pd = create_pd(ses, username); - + if (!pd) return NULL; - + return _strdup(pd->passwd); } @@ -353,7 +353,7 @@ static void des_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *outpu DES_set_key_checked(&cb, &ks); memcpy(cb, input, 8); DES_ecb_encrypt(&cb, &res, &ks, DES_ENCRYPT); - memcpy(output, res, 8); + memcpy(output, res, 8); } static int auth_pap(struct cs_pd_t *pd, const char *username, va_list args) @@ -363,7 +363,7 @@ static int auth_pap(struct cs_pd_t *pd, const char *username, va_list args) unsigned char z_hash[21]; char *u_passwd; int i, len = strlen(passwd); - + u_passwd = _malloc(len * 2); for (i = 0; i< len; i++) { u_passwd[i * 2] = passwd[i]; @@ -380,10 +380,10 @@ static int auth_pap(struct cs_pd_t *pd, const char *username, va_list args) /*des_encrypt(ad->val, z_hash, nt_hash); des_encrypt(ad->val, z_hash + 7, nt_hash + 8); des_encrypt(ad->val, z_hash + 14, nt_hash + 16);*/ - + if (memcmp(z_hash, pd->passwd, 16)) return PWDB_DENIED; - + return PWDB_SUCCESS; } @@ -421,7 +421,7 @@ static void derive_mppe_keys_mschap_v1(struct ap_session *ses, const uint8_t *z_ SHA1_Update(&sha_ctx, digest, 16); SHA1_Update(&sha_ctx, digest, 16); SHA1_Update(&sha_ctx, challenge, challenge_len); - SHA1_Final(digest, &sha_ctx); + SHA1_Final(digest, &sha_ctx); triton_event_fire(EV_MPPE_KEYS, &ev_mppe); } @@ -439,7 +439,7 @@ int auth_mschap_v1(struct ap_session *ses, struct cs_pd_t *pd, const char *usern memcpy(z_hash, pd->passwd, 16); memset(z_hash + 16, 0, sizeof(z_hash) - 16); - + des_encrypt(challenge, z_hash, nt_hash); des_encrypt(challenge, z_hash + 7, nt_hash + 8); des_encrypt(challenge, z_hash + 14, nt_hash + 16); @@ -460,7 +460,7 @@ static void generate_mschap_response(const uint8_t *nt_response, const uint8_t * uint8_t pw_hash[MD4_DIGEST_LENGTH]; uint8_t response[SHA_DIGEST_LENGTH]; int i; - + uint8_t magic1[39] = {0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65, @@ -489,7 +489,7 @@ static void generate_mschap_response(const uint8_t *nt_response, const uint8_t * SHA1_Update(&sha_ctx, c_hash, 8); SHA1_Update(&sha_ctx, magic2, 41); SHA1_Final(response, &sha_ctx); - + for (i = 0; i < 20; i++) sprintf(authenticator + i*2, "%02X", response[i]); } @@ -502,7 +502,7 @@ static void derive_mppe_keys_mschap_v2(struct ap_session *ses, const uint8_t *z_ uint8_t digest[20]; uint8_t send_key[20]; uint8_t recv_key[20]; - + uint8_t pad1[40] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -548,7 +548,7 @@ static void derive_mppe_keys_mschap_v2(struct ap_session *ses, const uint8_t *z_ .recv_key = recv_key, .send_key = send_key, }; - + //NtPasswordHashHash MD4_Init(&md4_ctx); MD4_Update(&md4_ctx, z_hash, 16); @@ -602,7 +602,7 @@ int auth_mschap_v2(struct ap_session *ses, struct cs_pd_t *pd, const char *usern memcpy(z_hash, pd->passwd, 16); memset(z_hash + 16, 0, sizeof(z_hash) - 16); - + des_encrypt(c_hash, z_hash, nt_hash); des_encrypt(c_hash, z_hash + 7, nt_hash + 8); des_encrypt(c_hash, z_hash + 14, nt_hash + 16); @@ -613,7 +613,7 @@ int auth_mschap_v2(struct ap_session *ses, struct cs_pd_t *pd, const char *usern if (ses->ctrl->ppp) derive_mppe_keys_mschap_v2(ses, z_hash, response); - generate_mschap_response(response, c_hash, z_hash, authenticator); + generate_mschap_response(response, c_hash, z_hash, authenticator); return PWDB_SUCCESS; } @@ -626,7 +626,7 @@ static int check_passwd(struct pwdb_t *pwdb, struct ap_session *ses, pwdb_callba if (!conf_encrypted) return PWDB_NO_IMPL; - + pd = find_pd(ses); if (!pd) @@ -634,7 +634,7 @@ static int check_passwd(struct pwdb_t *pwdb, struct ap_session *ses, pwdb_callba if (!pd) return PWDB_NO_IMPL; - + va_copy(args, _args); switch (type) { @@ -656,7 +656,7 @@ static int check_passwd(struct pwdb_t *pwdb, struct ap_session *ses, pwdb_callba } break; } - + va_end(args); return r; @@ -692,7 +692,7 @@ static void parse_hash_chain(const char *opt) char *ptr1 = str, *ptr2; struct hash_chain *hc; int f = 0; - + while (!f) { for (ptr2 = ptr1 + 1; *ptr2 && *ptr2 != ','; ptr2++); f = *ptr2 == 0; @@ -748,13 +748,13 @@ static void load_config(void) else { conf_gw_ip_address = 0; } - + opt = conf_get_opt("chap-secrets", "encrypted"); if (opt) conf_encrypted = atoi(opt); else conf_encrypted = 0; - + #ifdef CRYPTO_OPENSSL clear_hash_chain(); opt = conf_get_opt("chap-secrets", "username-hash"); @@ -769,7 +769,7 @@ static void init(void) pwdb_register(&pwdb); ipdb_register(&ipdb); - + triton_event_register_handler(EV_SES_FINISHED, (triton_event_func)ev_ses_finished); triton_event_register_handler(EV_SES_PRE_UP, (triton_event_func)ev_ses_pre_up); triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); diff --git a/accel-pppd/extra/connlimit.c b/accel-pppd/extra/connlimit.c index fd7c952b..49871dd8 100644 --- a/accel-pppd/extra/connlimit.c +++ b/accel-pppd/extra/connlimit.c @@ -35,7 +35,7 @@ int __export connlimit_check(uint64_t key) LIST_HEAD(tmp_list); int r = 1; - + clock_gettime(CLOCK_MONOTONIC, &ts); pthread_mutex_lock(&lock); @@ -87,13 +87,13 @@ int __export connlimit_check(uint64_t key) r = 0; } - + if (r == 0) log_debug("connlimit: accept %" PRIu64 "\n", key); else log_debug("connlimit: drop %" PRIu64 "\n", key); - + while (!list_empty(&tmp_list)) { it = list_entry(tmp_list.next, typeof(*it), entry); list_del(&it->entry); @@ -113,10 +113,10 @@ static int parse_limit(const char *opt, int *limit, int *time) *time = 1; return 0; } - + if (*endptr != '/') goto out_err; - + opt = endptr + 1; *time = strtol(opt, &endptr, 10); @@ -125,18 +125,18 @@ static int parse_limit(const char *opt, int *limit, int *time) if (*endptr == 's') return 0; - + if (*endptr == 'm') { *time *= 60; return 0; } - + if (*endptr == 'h') { *time *= 3600; return 0; } - -out_err: + +out_err: log_error("connlimit: failed to parse '%s'\n", opt); return -1; } @@ -156,7 +156,7 @@ static void load_config() opt = conf_get_opt("connlimit", "burst"); if (opt) conf_burst = atoi(opt); - + opt = conf_get_opt("connlimit", "timeout"); if (opt) conf_burst_timeout = atoi(opt) * 1000; diff --git a/accel-pppd/extra/ippool.c b/accel-pppd/extra/ippool.c index 15238025..c192e8d4 100644 --- a/accel-pppd/extra/ippool.c +++ b/accel-pppd/extra/ippool.c @@ -87,7 +87,7 @@ struct ippool_t *find_pool(const char *name, int create) if (create) return create_pool(name); - + return NULL; } @@ -95,7 +95,7 @@ static void parse_gw_ip_address(const char *val) { if (!val) return; - + conf_gw_ip_address = inet_addr(val); } @@ -103,7 +103,7 @@ static void parse_gw_ip_address(const char *val) static int parse1(const char *str, uint32_t *begin, uint32_t *end) { int n, f1, f2, f3, f4, m, mask = 0; - + n = sscanf(str, "%u.%u.%u.%u/%u",&f1, &f2, &f3, &f4, &m); if (n != 5) return -1; @@ -117,7 +117,7 @@ static int parse1(const char *str, uint32_t *begin, uint32_t *end) return -1; if (m == 0 || m > 32) return -1; - + *begin = (f4 << 24) | (f3 << 16) | (f2 << 8) | f1; mask = htonl(~((1 << (32 - m)) - 1)); @@ -145,7 +145,7 @@ static int parse2(const char *str, uint32_t *begin, uint32_t *end) return -1; if (m < f4 || m > 255) return -1; - + *begin = ntohl((f4 << 24) | (f3 << 16) | (f2 << 8) | f1); *end = ntohl((m << 24) | (f3 << 16) | (f2 << 8) | f1); @@ -184,12 +184,12 @@ static uint8_t get_random() if (pos == 0) read(urandom_fd, buf, 128); - + r = buf[pos++]; if (pos == 128) pos = 0; - + return r; } @@ -224,17 +224,17 @@ static void generate_pool_p2p(struct ippool_t *p) pos1 = pos1->next; pos2 = pos2->prev; - + if (r >= 64) continue; - + peer_addr = list_entry(pos, typeof(*peer_addr), entry); if (pos == pos1) pos1 = pos1->next; - + if (pos == pos2) pos2 = pos2->prev; - + list_del(&peer_addr->entry); t = 0; } else { @@ -304,13 +304,13 @@ static void generate_pool_net30(struct ippool_t *p) it->it.peer_addr = addr[2]->addr; list_add_tail(&it->entry, &p->items); - + for (i = 0; i < 4; i++) { if (addr[i]) free(addr[i]); } } - + for (i = 0; i < 4; i++) { if (addr[i]) free(addr[i]); @@ -514,7 +514,7 @@ static int parse_vendor_opt(const char *opt) vendor = rad_dict_find_vendor_name(opt); if (vendor) return vendor->id; - + return atoi(opt); } #endif @@ -568,7 +568,7 @@ static void ippool_init2(void) char *pool_name = NULL; char *allocator = NULL; void (*generate)(struct ippool_t *pool); - + if (!s) return; @@ -581,7 +581,7 @@ static void ippool_init2(void) conf_vendor = parse_vendor_opt(opt->val); continue; } - + if (!strcmp(opt->name, "attr")) { conf_attr = parse_attr_opt(opt->val); continue; @@ -625,7 +625,7 @@ static void ippool_init2(void) _free(allocator); } } - + if (def_pool->generate) def_pool->generate(def_pool); diff --git a/accel-pppd/extra/ipv6pool.c b/accel-pppd/extra/ipv6pool.c index 0ca270c0..6887ea32 100644 --- a/accel-pppd/extra/ipv6pool.c +++ b/accel-pppd/extra/ipv6pool.c @@ -79,7 +79,7 @@ static void generate_ippool(struct in6_addr *addr, int mask, int prefix_len) *(uint64_t *)(step.s6_addr + 8) = htobe64(1llu << (128 - prefix_len)); else *(uint64_t *)step.s6_addr = htobe64(1llu << (64 - prefix_len)); - + while (in6_addr_cmp(&ip, &end) <= 0) { it = malloc(sizeof(*it)); it->it.owner = &ipdb; @@ -115,7 +115,7 @@ static void generate_dppool(struct in6_addr *addr, int mask, int prefix_len) *(uint64_t *)(step.s6_addr + 8) = htobe64(1llu << (128 - prefix_len)); else *(uint64_t *)step.s6_addr = htobe64(1llu << (64 - prefix_len)); - + while (in6_addr_cmp(&ip, &end) <= 0) { it = malloc(sizeof(*it)); it->it.owner = &ipdb; @@ -138,34 +138,34 @@ static void add_prefix(int type, const char *_val) struct in6_addr addr; int prefix_len; int mask; - + ptr1 = strchr(val, '/'); if (!ptr1) goto err; - + *ptr1 = 0; ptr2 = strchr(ptr1 + 1, ','); if (!ptr2) goto err; - + *ptr2 = 0; if (inet_pton(AF_INET6, val, &addr) == 0) goto err; - + if (sscanf(ptr1 + 1, "%i", &mask) != 1) goto err; - + if (mask < 7 || mask > 127) goto err; - + if (sscanf(ptr2 + 1, "%i", &prefix_len) != 1) goto err; - + if (prefix_len > 128 || prefix_len < mask) goto err; - + if (type) generate_dppool(&addr, mask, prefix_len); else @@ -173,7 +173,7 @@ static void add_prefix(int type, const char *_val) _free(val); return; - + err: log_error("ipv6_pool: failed to parse '%s'\n", _val); _free(val); @@ -245,7 +245,7 @@ static void ippool_init(void) if (!s) return; - + list_for_each_entry(opt, &s->items, entry) { if (!strcmp(opt->name, "delegate")) add_prefix(1, opt->val); diff --git a/accel-pppd/extra/net-snmp/agent.c b/accel-pppd/extra/net-snmp/agent.c index 9f8b1a74..162cdbc0 100644 --- a/accel-pppd/extra/net-snmp/agent.c +++ b/accel-pppd/extra/net-snmp/agent.c @@ -45,7 +45,7 @@ static int snmp_term = 0; static int agent_log(int major, int minor, void *serv_arg, void *cl_arg) { struct snmp_log_message *m = serv_arg; - + switch (m->priority) { case LOG_EMERG: log_emerg("net-snmp: %s", m->msg); @@ -96,7 +96,7 @@ static void *snmp_thread(void *a) snmp_enable_calllog(); //snmp_set_do_debugging(1); //netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); - + if (!conf_master) netsnmp_enable_subagent(); @@ -117,11 +117,11 @@ static void *snmp_thread(void *a) if (conf_master) init_master_agent(); - + while (!snmp_term) { agent_check_and_process(1); } - + snmp_shutdown(conf_agent_name); SOCK_CLEANUP; @@ -152,11 +152,11 @@ static void init(void) opt = conf_get_opt("snmp", "agent-name"); if (opt) conf_agent_name = opt; - + /*opt = conf_get_opt("snmp", "oid-prefix") if (opt) conf_oid_prefix = opt;*/ - + pthread_create(&snmp_thr, NULL, snmp_thread, NULL); triton_context_register(&ctx, NULL); triton_context_wakeup(&ctx); diff --git a/accel-pppd/extra/net-snmp/exec_cli.c b/accel-pppd/extra/net-snmp/exec_cli.c index 63a89587..28e53383 100644 --- a/accel-pppd/extra/net-snmp/exec_cli.c +++ b/accel-pppd/extra/net-snmp/exec_cli.c @@ -36,7 +36,7 @@ static void set_action(const char *cmd, size_t len) memcpy(cc.cmdline, cmd, len); cc.cmdline[len] = 0; - + cli_process_cmd(&cc); _free(cc.cmdline); @@ -69,7 +69,7 @@ handle_cli(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: diff --git a/accel-pppd/extra/net-snmp/sessionTable.c b/accel-pppd/extra/net-snmp/sessionTable.c index dc7d62bd..954ca1e3 100644 --- a/accel-pppd/extra/net-snmp/sessionTable.c +++ b/accel-pppd/extra/net-snmp/sessionTable.c @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 14170 $ of $ + * version : 14170 $ of $ * * $Id:$ */ @@ -42,7 +42,7 @@ init_sessionTable(void) /* * TODO:300:o: Perform sessionTable one-time module initialization. */ - + /* * here we initialize all the tables we're planning on supporting */ @@ -63,7 +63,7 @@ shutdown_sessionTable(void) } /** - * Initialize the table sessionTable + * Initialize the table sessionTable * (Define its contents and how it's structured) */ void @@ -88,13 +88,13 @@ initialize_table_sessionTable(void) * string token is used to add, find or remove pointers. */ user_context = netsnmp_create_data_list("sessionTable", NULL, NULL); - + /* * No support for any flags yet, but in the future you would * set any flags here. */ flags = 0; - + /* * call interface initialization code */ @@ -102,7 +102,7 @@ initialize_table_sessionTable(void) } /* initialize_table_sessionTable */ /** - * Shutdown the table sessionTable + * Shutdown the table sessionTable */ void shutdown_table_sessionTable(void) @@ -129,7 +129,7 @@ sessionTable_rowreq_ctx_init(sessionTable_rowreq_ctx *rowreq_ctx, DEBUGMSGTL(("verbose:sessionTable:sessionTable_rowreq_ctx_init","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + /* * TODO:210:o: |-> Perform extra sessionTable rowreq initialization. (eg DEFVALS) */ @@ -146,7 +146,7 @@ void sessionTable_rowreq_ctx_cleanup(sessionTable_rowreq_ctx *rowreq_ctx) DEBUGMSGTL(("verbose:sessionTable:sessionTable_rowreq_ctx_cleanup","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + /* * TODO:211:o: |-> Perform extra sessionTable rowreq cleanup. */ diff --git a/accel-pppd/extra/net-snmp/sessionTable.h b/accel-pppd/extra/net-snmp/sessionTable.h index 645ddd35..2635f21c 100644 --- a/accel-pppd/extra/net-snmp/sessionTable.h +++ b/accel-pppd/extra/net-snmp/sessionTable.h @@ -124,9 +124,9 @@ typedef struct sessionTable_rowreq_ctx_s { /** this must be first for container compare to work */ netsnmp_index oid_idx; oid oid_tmp[MAX_sessionTable_IDX_LEN]; - + sessionTable_mib_index tbl_idx; - + sessionTable_data * data; /* @@ -138,7 +138,7 @@ typedef struct sessionTable_rowreq_ctx_s { /* * TODO:131:o: | |-> Add useful data to sessionTable rowreq context. */ - + /* * storage for future expansion */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_access.c b/accel-pppd/extra/net-snmp/sessionTable_data_access.c index ac7e94af..edc5e6b2 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_access.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_access.c @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 14170 $ of $ + * version : 14170 $ of $ * * $Id:$ */ @@ -24,7 +24,7 @@ * * These routines are used to locate the data used to satisfy * requests. - * + * * @{ */ /********************************************************************** @@ -107,7 +107,7 @@ sessionTable_container_init(netsnmp_container **container_ptr_ptr, netsnmp_cache *cache) { DEBUGMSGTL(("verbose:sessionTable:sessionTable_container_init","called\n")); - + if (NULL == container_ptr_ptr) { snmp_log(LOG_ERR,"bad container param to sessionTable_container_init\n"); return; @@ -155,7 +155,7 @@ void sessionTable_container_shutdown(netsnmp_container *container_ptr) { DEBUGMSGTL(("verbose:sessionTable:sessionTable_container_shutdown","called\n")); - + if (NULL == container_ptr) { snmp_log(LOG_ERR,"bad params to sessionTable_container_shutdown\n"); return; @@ -218,7 +218,7 @@ sessionTable_container_load(netsnmp_container *container) sessionTable_release_rowreq_ctx(rowreq_ctx); continue; } - + strcpy(rowreq_ctx->data->ifname, ses->ifname); if (ses->username) diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_get.c b/accel-pppd/extra/net-snmp/sessionTable_data_get.c index d467ad05..e2b1cbc6 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_get.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_get.c @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 12088 $ of $ + * version : 12088 $ of $ * * $Id:$ */ @@ -121,7 +121,7 @@ sessionTable_indexes_set_tbl_idx(sessionTable_mib_index *tbl_idx, char *sesSID_v } tbl_idx->sesSID_len = sesSID_val_ptr_len; memcpy( tbl_idx->sesSID, sesSID_val_ptr, sesSID_val_ptr_len* sizeof(sesSID_val_ptr[0]) ); - + return MFD_SUCCESS; } /* sessionTable_indexes_set_tbl_idx */ @@ -314,7 +314,7 @@ sesUsername_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesUsername_val_ptr } (* sesUsername_val_ptr_len_ptr ) = len; memcpy( (* sesUsername_val_ptr_ptr ), rowreq_ctx->data->username, len); - + return MFD_SUCCESS; } /* sesUsername_get */ @@ -484,7 +484,7 @@ sesState_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesState_val_ptr ) DEBUGMSGTL(("verbose:sessionTable:sesState_get","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + (* sesState_val_ptr ) = rowreq_ctx->data->state; return MFD_SUCCESS; diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_set.c b/accel-pppd/extra/net-snmp/sessionTable_data_set.c index ebfeeeaa..2f3bfa02 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_set.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_set.c @@ -18,7 +18,7 @@ * * These routines are used to set the value for individual objects. The * row context is passed, along with the new value. - * + * * @{ */ /** @} */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_set.h b/accel-pppd/extra/net-snmp/sessionTable_data_set.h index 70534baa..c77b466c 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_set.h +++ b/accel-pppd/extra/net-snmp/sessionTable_data_set.h @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 12077 $ of $ + * version : 12077 $ of $ * * $Id:$ */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_enums.h b/accel-pppd/extra/net-snmp/sessionTable_enums.h index c7ce8450..7897ff02 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_enums.h +++ b/accel-pppd/extra/net-snmp/sessionTable_enums.h @@ -41,20 +41,20 @@ extern "C" { #ifndef IANATUNNELTYPE_ENUMS #define IANATUNNELTYPE_ENUMS -#define IANATUNNELTYPE_OTHER 1 -#define IANATUNNELTYPE_DIRECT 2 -#define IANATUNNELTYPE_GRE 3 -#define IANATUNNELTYPE_MINIMAL 4 -#define IANATUNNELTYPE_L2TP 5 -#define IANATUNNELTYPE_PPTP 6 -#define IANATUNNELTYPE_L2F 7 -#define IANATUNNELTYPE_UDP 8 -#define IANATUNNELTYPE_ATMP 9 -#define IANATUNNELTYPE_MSDP 10 -#define IANATUNNELTYPE_SIXTOFOUR 11 -#define IANATUNNELTYPE_SIXOVERFOUR 12 -#define IANATUNNELTYPE_ISATAP 13 -#define IANATUNNELTYPE_TEREDO 14 +#define IANATUNNELTYPE_OTHER 1 +#define IANATUNNELTYPE_DIRECT 2 +#define IANATUNNELTYPE_GRE 3 +#define IANATUNNELTYPE_MINIMAL 4 +#define IANATUNNELTYPE_L2TP 5 +#define IANATUNNELTYPE_PPTP 6 +#define IANATUNNELTYPE_L2F 7 +#define IANATUNNELTYPE_UDP 8 +#define IANATUNNELTYPE_ATMP 9 +#define IANATUNNELTYPE_MSDP 10 +#define IANATUNNELTYPE_SIXTOFOUR 11 +#define IANATUNNELTYPE_SIXOVERFOUR 12 +#define IANATUNNELTYPE_ISATAP 13 +#define IANATUNNELTYPE_TEREDO 14 #endif /* IANATUNNELTYPE_ENUMS */ @@ -69,9 +69,9 @@ extern "C" { #ifndef SESSTATE_ENUMS #define SESSTATE_ENUMS -#define SESSTATE_STARTING 1 -#define SESSTATE_ACTIVE 2 -#define SESSTATE_FINISHING 3 +#define SESSTATE_STARTING 1 +#define SESSTATE_ACTIVE 2 +#define SESSTATE_FINISHING 3 #endif /* SESSTATE_ENUMS */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_interface.c b/accel-pppd/extra/net-snmp/sessionTable_interface.c index cf60f910..420336da 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_interface.c +++ b/accel-pppd/extra/net-snmp/sessionTable_interface.c @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 15899 $ of $ + * version : 15899 $ of $ * * $Id:$ */ @@ -60,7 +60,7 @@ typedef struct sessionTable_interface_ctx_s { netsnmp_cache *cache; sessionTable_registration * user_ctx; - + netsnmp_table_registration_info tbl_info; netsnmp_baby_steps_access_methods access_multiplexer; @@ -110,7 +110,7 @@ static Netsnmp_Node_Handler _mfd_sessionTable_object_lookup; static Netsnmp_Node_Handler _mfd_sessionTable_get_values; /** * @internal - * Initialize the table sessionTable + * Initialize the table sessionTable * (Define its contents and how it's structured) */ void @@ -160,7 +160,7 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long snmp_log(LOG_ERR,"could not initialize container for sessionTable\n"); return; } - + /* * access_multiplexer: REQUIRED wrapper for get request handling */ @@ -179,7 +179,7 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long * Create a registration, save our reg data, register table. */ DEBUGMSGTL(("sessionTable:init_sessionTable", - "Registering sessionTable as a mibs-for-dummies table.\n")); + "Registering sessionTable as a mibs-for-dummies table.\n")); handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); reginfo = netsnmp_handler_registration_create("sessionTable", handler, sessionTable_oid, @@ -210,14 +210,14 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long mfd_modes |= BABY_STEP_PRE_REQUEST; if( access_multiplexer->post_request ) mfd_modes |= BABY_STEP_POST_REQUEST; - + if( access_multiplexer->undo_setup ) mfd_modes |= BABY_STEP_UNDO_SETUP; if( access_multiplexer->undo_cleanup ) mfd_modes |= BABY_STEP_UNDO_CLEANUP; if( access_multiplexer->undo_sets ) mfd_modes |= BABY_STEP_UNDO_SETS; - + if( access_multiplexer->row_creation ) mfd_modes |= BABY_STEP_ROW_CREATE; if( access_multiplexer->consistency_checks ) @@ -226,7 +226,7 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long mfd_modes |= BABY_STEP_COMMIT; if( access_multiplexer->undo_commit ) mfd_modes |= BABY_STEP_UNDO_COMMIT; - + handler = netsnmp_baby_steps_handler_get(mfd_modes); netsnmp_inject_handler(reginfo, handler); @@ -291,7 +291,7 @@ sessionTable_index_to_oid(netsnmp_index *oid_idx, sessionTable_mib_index *mib_idx) { int err = SNMP_ERR_NOERROR; - + /* * temp storage for parsing indexes */ @@ -343,7 +343,7 @@ sessionTable_index_from_oid(netsnmp_index *oid_idx, sessionTable_mib_index *mib_idx) { int err = SNMP_ERR_NOERROR; - + /* * temp storage for parsing indexes */ @@ -460,7 +460,7 @@ sessionTable_release_rowreq_ctx(sessionTable_rowreq_ctx *rowreq_ctx) DEBUGMSGTL(("internal:sessionTable:sessionTable_release_rowreq_ctx","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + sessionTable_rowreq_ctx_cleanup(rowreq_ctx); /* @@ -469,7 +469,7 @@ sessionTable_release_rowreq_ctx(sessionTable_rowreq_ctx *rowreq_ctx) if ((rowreq_ctx->data) && !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) sessionTable_release_data(rowreq_ctx->data); - + /* * free index oid pointer */ @@ -493,13 +493,13 @@ _mfd_sessionTable_pre_request(netsnmp_mib_handler *handler, DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_pre_request", "called\n")); - + if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { DEBUGMSGTL(("internal:sessionTable", "skipping additional pre_request\n")); return SNMP_ERR_NOERROR; } - + rc = sessionTable_pre_request(sessionTable_if_ctx.user_ctx); if (MFD_SUCCESS != rc) { /* @@ -509,7 +509,7 @@ _mfd_sessionTable_pre_request(netsnmp_mib_handler *handler, "sessionTable_pre_request\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } - + return SNMP_ERR_NOERROR; } /* _mfd_sessionTable_pre_request */ @@ -544,7 +544,7 @@ _mfd_sessionTable_post_request(netsnmp_mib_handler *handler, "waiting for last post_request\n")); return SNMP_ERR_NOERROR; } - + packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); rc = sessionTable_post_request(sessionTable_if_ctx.user_ctx,packet_rc); if (MFD_SUCCESS != rc) { @@ -554,7 +554,7 @@ _mfd_sessionTable_post_request(netsnmp_mib_handler *handler, DEBUGMSGTL(("sessionTable","error %d from " "sessionTable_post_request\n", rc)); } - + return SNMP_ERR_NOERROR; } /* _mfd_sessionTable_post_request */ @@ -571,7 +571,7 @@ _mfd_sessionTable_object_lookup(netsnmp_mib_handler *handler, int rc = SNMP_ERR_NOERROR; sessionTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); - + DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_object_lookup","called\n")); /* @@ -606,7 +606,7 @@ _sessionTable_get_column( sessionTable_rowreq_ctx *rowreq_ctx, netsnmp_variable_list *var, int column ) { int rc = SNMPERR_SUCCESS; - + DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_get_column", "called for %d\n", column)); @@ -712,7 +712,7 @@ _mfd_sessionTable_get_values(netsnmp_mib_handler *handler, DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_get_values","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + for(;requests; requests = requests->next) { /* * save old pointer, so we can free it if replaced @@ -734,7 +734,7 @@ _mfd_sessionTable_get_values(netsnmp_mib_handler *handler, tri = netsnmp_extract_table_info(requests); if(NULL == tri) continue; - + rc = _sessionTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum); if(rc) { if(MFD_SKIP == rc) { @@ -798,7 +798,7 @@ _cache_load(netsnmp_cache *cache, void *vmagic) /** should only be called for an invalid or expired cache */ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); - + /* * call user code */ @@ -856,7 +856,7 @@ _container_free(netsnmp_container *container) * call user code */ sessionTable_container_free(container); - + /* * free all items. inefficient, but easy. */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_interface.h b/accel-pppd/extra/net-snmp/sessionTable_interface.h index ebd1143d..2b99dde6 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_interface.h +++ b/accel-pppd/extra/net-snmp/sessionTable_interface.h @@ -9,7 +9,7 @@ * \warning This code should not be modified, called directly, * or used to interpret functionality. It is subject to * change at any time. - * + * * @{ */ /* diff --git a/accel-pppd/extra/net-snmp/sessionTable_oids.h b/accel-pppd/extra/net-snmp/sessionTable_oids.h index 42ec6e53..0fc5c284 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_oids.h +++ b/accel-pppd/extra/net-snmp/sessionTable_oids.h @@ -16,27 +16,27 @@ extern "C" { #define SESSIONTABLE_OID 1,3,6,1,4,1,8072,100,2,1 #define COLUMN_SESSID 1 - + #define COLUMN_SESIFNAME 2 - + #define COLUMN_SESUSERNAME 3 - + #define COLUMN_SESIP 4 - + #define COLUMN_SESTYPE 5 - + #define COLUMN_SESSTATE 6 - + #define COLUMN_SESUPTIME 7 - + #define COLUMN_SESCALLINGSID 8 - + #define COLUMN_SESCALLEDSID 9 - + #define SESSIONTABLE_MIN_COL COLUMN_SESSID #define SESSIONTABLE_MAX_COL COLUMN_SESCALLEDSID - + #ifdef __cplusplus diff --git a/accel-pppd/extra/net-snmp/shutdown.c b/accel-pppd/extra/net-snmp/shutdown.c index 82f85407..06c87c51 100644 --- a/accel-pppd/extra/net-snmp/shutdown.c +++ b/accel-pppd/extra/net-snmp/shutdown.c @@ -35,7 +35,7 @@ handle_shutdown(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: diff --git a/accel-pppd/extra/net-snmp/statCore.c b/accel-pppd/extra/net-snmp/statCore.c index 74a6b35b..55109f6a 100644 --- a/accel-pppd/extra/net-snmp/statCore.c +++ b/accel-pppd/extra/net-snmp/statCore.c @@ -55,7 +55,7 @@ handle_statCoreUpTime(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: @@ -84,7 +84,7 @@ handle_statCoreCPU(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: @@ -119,7 +119,7 @@ handle_statCoreMemRss(netsnmp_mib_handler *handler, fscanf(f, "%lu %lu", &vmsize, &vmrss); fclose(f); } - + vmrss *= page_size; /* We are never called for a GETNEXT if it's registered as a @@ -127,7 +127,7 @@ handle_statCoreMemRss(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: diff --git a/accel-pppd/extra/net-snmp/statIPOE.c b/accel-pppd/extra/net-snmp/statIPOE.c index be41085e..24f154fd 100644 --- a/accel-pppd/extra/net-snmp/statIPOE.c +++ b/accel-pppd/extra/net-snmp/statIPOE.c @@ -22,8 +22,8 @@ static unsigned int *stat_starting; static unsigned int *stat_active; /* - * Our initialization routine, called automatically by the agent - * (Note that the function name must match init_FILENAME()) + * Our initialization routine, called automatically by the agent + * (Note that the function name must match init_FILENAME()) */ void init_statIPOE(void) @@ -36,7 +36,7 @@ init_statIPOE(void) /* * a debugging statement. Run the agent with -DstatIPOE to see - * the output of this debugging statement. + * the output of this debugging statement. */ DEBUGMSGTL(("statIPOE", "Initializing the statIPOE module\n")); diff --git a/accel-pppd/extra/net-snmp/statL2TP.c b/accel-pppd/extra/net-snmp/statL2TP.c index a91d336a..59998386 100644 --- a/accel-pppd/extra/net-snmp/statL2TP.c +++ b/accel-pppd/extra/net-snmp/statL2TP.c @@ -23,8 +23,8 @@ static unsigned int *stat_starting; static unsigned int *stat_active; /* - * Our initialization routine, called automatically by the agent - * (Note that the function name must match init_FILENAME()) + * Our initialization routine, called automatically by the agent + * (Note that the function name must match init_FILENAME()) */ void init_statL2TP(void) @@ -37,7 +37,7 @@ init_statL2TP(void) /* * a debugging statement. Run the agent with -DstatL2TP to see - * the output of this debugging statement. + * the output of this debugging statement. */ DEBUGMSGTL(("statL2TP", "Initializing the statL2TP module\n")); diff --git a/accel-pppd/extra/net-snmp/statPPP.c b/accel-pppd/extra/net-snmp/statPPP.c index db8918b7..37e4630c 100644 --- a/accel-pppd/extra/net-snmp/statPPP.c +++ b/accel-pppd/extra/net-snmp/statPPP.c @@ -11,8 +11,8 @@ #include "ppp.h" /* - * Our initialization routine, called automatically by the agent - * (Note that the function name must match init_FILENAME()) + * Our initialization routine, called automatically by the agent + * (Note that the function name must match init_FILENAME()) */ void init_statPPP(void) @@ -26,7 +26,7 @@ init_statPPP(void) /* * a debugging statement. Run the agent with -DstatPPP to see - * the output of this debugging statement. + * the output of this debugging statement. */ DEBUGMSGTL(("statPPP", "Initializing the statPPP module\n")); diff --git a/accel-pppd/extra/net-snmp/statPPPOE.c b/accel-pppd/extra/net-snmp/statPPPOE.c index 0ca2dd86..6042dc5b 100644 --- a/accel-pppd/extra/net-snmp/statPPPOE.c +++ b/accel-pppd/extra/net-snmp/statPPPOE.c @@ -22,8 +22,8 @@ static unsigned int *stat_starting; static unsigned int *stat_active; /* - * Our initialization routine, called automatically by the agent - * (Note that the function name must match init_FILENAME()) + * Our initialization routine, called automatically by the agent + * (Note that the function name must match init_FILENAME()) */ void init_statPPPOE(void) @@ -36,7 +36,7 @@ init_statPPPOE(void) /* * a debugging statement. Run the agent with -DstatPPPOE to see - * the output of this debugging statement. + * the output of this debugging statement. */ DEBUGMSGTL(("statPPPOE", "Initializing the statPPPOE module\n")); diff --git a/accel-pppd/extra/net-snmp/statPPTP.c b/accel-pppd/extra/net-snmp/statPPTP.c index 1a13ad06..48642202 100644 --- a/accel-pppd/extra/net-snmp/statPPTP.c +++ b/accel-pppd/extra/net-snmp/statPPTP.c @@ -22,8 +22,8 @@ static unsigned int *stat_starting; static unsigned int *stat_active; /* - * Our initialization routine, called automatically by the agent - * (Note that the function name must match init_FILENAME()) + * Our initialization routine, called automatically by the agent + * (Note that the function name must match init_FILENAME()) */ void init_statPPTP(void) @@ -36,7 +36,7 @@ init_statPPTP(void) /* * a debugging statement. Run the agent with -DstatPPTP to see - * the output of this debugging statement. + * the output of this debugging statement. */ DEBUGMSGTL(("statPPTP", "Initializing the statPPTP module\n")); diff --git a/accel-pppd/extra/net-snmp/terminate.c b/accel-pppd/extra/net-snmp/terminate.c index 23d355a2..e7e5d12c 100644 --- a/accel-pppd/extra/net-snmp/terminate.c +++ b/accel-pppd/extra/net-snmp/terminate.c @@ -63,7 +63,7 @@ static void terminate_by_ip(const char *val, size_t len) str[len] = 0; addr = inet_addr(str); - + pthread_rwlock_rdlock(&ses_lock); list_for_each_entry(ses, &ses_list, entry) { if (!ses->ipv4 || ses->ipv4->peer_addr != addr) @@ -139,7 +139,7 @@ handle_termBySID(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: @@ -200,7 +200,7 @@ handle_termByIfName(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: @@ -262,7 +262,7 @@ handle_termByIP(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: @@ -326,7 +326,7 @@ handle_termByUsername(netsnmp_mib_handler *handler, /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ - + switch(reqinfo->mode) { case MODE_GET: diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c index e48029bb..482a7080 100644 --- a/accel-pppd/extra/pppd_compat.c +++ b/accel-pppd/extra/pppd_compat.c @@ -113,7 +113,7 @@ static void ip_change_handler(struct sigchld_handler_t *h, int status) static void ev_ses_starting(struct ap_session *ses) { struct pppd_compat_pd *pd; - + pd = _malloc(sizeof(*pd)); if (!pd) { log_emerg("pppd_compat: out of memory\n"); @@ -139,7 +139,7 @@ static void ev_ses_pre_up(struct ap_session *ses) char ipaddr[17]; char peer_ipaddr[17]; struct pppd_compat_pd *pd = find_pd(ses); - + if (!pd) return; @@ -169,7 +169,7 @@ static void ev_ses_pre_up(struct ap_session *ses) argv[4] = ipaddr; argv[5] = peer_ipaddr; fill_argv(argv, pd, conf_ip_up); - + fill_env(env, env_mem, pd); if (conf_ip_pre_up) { @@ -210,14 +210,14 @@ static void ev_ses_started(struct ap_session *ses) char ipaddr[17]; char peer_ipaddr[17]; struct pppd_compat_pd *pd = find_pd(ses); - + if (!pd) return; - + argv[4] = ipaddr; argv[5] = peer_ipaddr; fill_argv(argv, pd, conf_ip_up); - + fill_env(env, env_mem, pd); if (conf_ip_up) { @@ -240,7 +240,7 @@ static void ev_ses_started(struct ap_session *ses) } else log_error("pppd_compat: fork: %s\n", strerror(errno)); } - + pd->started = 1; } @@ -253,10 +253,10 @@ static void ev_ses_finished(struct ap_session *ses) char ipaddr[17]; char peer_ipaddr[17]; struct pppd_compat_pd *pd = find_pd(ses); - + if (!pd) return; - + if (!pd->started) goto skip; @@ -312,7 +312,7 @@ skip: if (pd->radattr_saved) remove_radattr(pd); #endif - + list_del(&pd->pd.entry); _free(pd); } @@ -339,7 +339,7 @@ static void ev_radius_coa(struct ev_radius_t *ev) char ipaddr[17]; char peer_ipaddr[17]; struct pppd_compat_pd *pd = find_pd(ev->ses); - + if (!pd) return; @@ -373,7 +373,7 @@ static void ev_radius_coa(struct ev_radius_t *ev) static void remove_radattr(struct pppd_compat_pd *pd) { char *fname; - + if (pd->tmp_fname) { unlink(pd->tmp_fname); _free(pd->tmp_fname); @@ -464,7 +464,7 @@ static void write_radattr(struct pppd_compat_pd *pd, struct rad_packet_t *pack) fclose(f); } else log_ppp_warn("pppd_compat: failed to create '%s': %s\n", fname1, strerror(errno)); - + if (ses->state == AP_STATE_ACTIVE) { _free(fname1); _free(fname2); @@ -484,7 +484,7 @@ static struct pppd_compat_pd *find_pd(struct ap_session *ses) return cpd; } } - + //log_ppp_warn("pppd_compat: pd not found\n"); return NULL; } @@ -516,10 +516,10 @@ static void fill_env(char **env, char *mem, struct pppd_compat_pd *pd) struct ap_session *ses = pd->ses; uint64_t tx_bytes, rx_bytes; int n = 0; - + tx_bytes = (uint64_t)ses->acct_tx_bytes + 4294967296llu*ses->acct_output_gigawords; rx_bytes = (uint64_t)ses->acct_rx_bytes + 4294967296llu*ses->acct_input_gigawords; - + env[n++] = mem; mem += sprintf(mem, "PEERNAME=%s", pd->ses->username) + 1; env[n++] = mem; @@ -546,7 +546,7 @@ static void fill_env(char **env, char *mem, struct pppd_compat_pd *pd) inet_ntop(AF_INET6, &a->addr, mem, ENV_MEM); mem = strchr(mem, 0); mem += sprintf(mem, "/%i", a->prefix_len) + 1; } - + if (pd->ses->stop_time) { env[n++] = mem; mem += sprintf(mem, "CONNECT_TIME=%lu", pd->ses->stop_time - pd->ses->start_time) + 1; diff --git a/accel-pppd/extra/sigchld.c b/accel-pppd/extra/sigchld.c index d6b0df5f..cfce2cd2 100644 --- a/accel-pppd/extra/sigchld.c +++ b/accel-pppd/extra/sigchld.c @@ -34,7 +34,7 @@ static void* sigchld_thread(void *arg) sigaddset(&set, SIGCHLD); sigaddset(&set, SIGQUIT); - while (1) { + while (1) { pid = waitpid(-1, &status, 0); if (pid < 0) { if (errno == EINTR) diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h index b2ee1b6b..12f2937e 100644 --- a/accel-pppd/include/ap_session.h +++ b/accel-pppd/include/ap_session.h @@ -95,7 +95,7 @@ struct ap_session int terminate_cause; struct list_head pd_list; - + uint32_t acct_rx_bytes; uint32_t acct_tx_bytes; uint32_t acct_input_gigawords; diff --git a/accel-pppd/include/ppp_auth.h b/accel-pppd/include/ppp_auth.h index 9c684668..839a8817 100644 --- a/accel-pppd/include/ppp_auth.h +++ b/accel-pppd/include/ppp_auth.h @@ -9,7 +9,7 @@ struct auth_data_t { struct list_head entry; int proto; - int state; + int state; struct ppp_auth_handler_t *h; }; diff --git a/accel-pppd/iprange.c b/accel-pppd/iprange.c index c3bf2fec..6ea2c2f9 100644 --- a/accel-pppd/iprange.c +++ b/accel-pppd/iprange.c @@ -30,7 +30,7 @@ static struct iprange_t *parse1(const char *str) int n,f1,f2,f3,f4,m; struct iprange_t *r; int mask; - + n = sscanf(str, "%u.%u.%u.%u/%u",&f1, &f2, &f3, &f4, &m); if (n != 5) return NULL; @@ -44,14 +44,14 @@ static struct iprange_t *parse1(const char *str) return NULL; if (m > 32) return NULL; - + r = _malloc(sizeof(*r)); r->begin = (f4 << 24) | (f3 << 16) | (f2 << 8) | f1; - + mask = htonl(~((1 << (32 - m)) - 1)); r->end = ntohl(r->begin | ~mask); r->begin = ntohl(r->begin); - + return r; } @@ -74,7 +74,7 @@ static struct iprange_t *parse2(const char *str) return NULL; if (m < f4 || m > 255) return NULL; - + r = _malloc(sizeof(*r)); r->begin = ntohl((f4 << 24) | (f3 << 16) | (f2 << 8) | f1); r->end = ntohl((m << 24) | (f3 << 16) | (f2 << 8) | f1); @@ -118,7 +118,7 @@ static int check_range(struct list_head *list, in_addr_t ipaddr) { struct iprange_t *r; uint32_t a = ntohl(ipaddr); - + list_for_each_entry(r, list, entry) { if (a >= r->begin && a <= r->end) return 0; diff --git a/accel-pppd/ipv6/dhcpv6.h b/accel-pppd/ipv6/dhcpv6.h index 82e366e7..1166445c 100644 --- a/accel-pppd/ipv6/dhcpv6.h +++ b/accel-pppd/ipv6/dhcpv6.h @@ -158,7 +158,7 @@ struct dhcpv6_packet { struct ap_session *ses; struct dhcpv6_pd *pd; struct sockaddr_in6 addr; - + struct dhcpv6_msg_hdr *hdr; struct dhcpv6_opt_clientid *clientid; struct dhcpv6_opt_serverid *serverid; diff --git a/accel-pppd/ipv6/dhcpv6_packet.c b/accel-pppd/ipv6/dhcpv6_packet.c index 71184911..16db5cb9 100644 --- a/accel-pppd/ipv6/dhcpv6_packet.c +++ b/accel-pppd/ipv6/dhcpv6_packet.c @@ -69,7 +69,7 @@ static void *parse_option(void *ptr, void *endptr, struct list_head *opt_list) log_warn("dhcpv6: invalid packet received\n"); return NULL; } - + opt = _malloc(sizeof(*opt)); if (!opt) { log_emerg("out of memory\n"); @@ -85,7 +85,7 @@ static void *parse_option(void *ptr, void *endptr, struct list_head *opt_list) if (dopt->code == ntohs(opth->code)) break; } - + if (dopt->len) { endptr = ptr + sizeof(*opth) + ntohs(opth->len); ptr += dopt->len; @@ -96,7 +96,7 @@ static void *parse_option(void *ptr, void *endptr, struct list_head *opt_list) } } else ptr += sizeof(*opth) + ntohs(opth->len); - + return ptr; } @@ -148,13 +148,13 @@ struct dhcpv6_packet *dhcpv6_packet_parse(const void *buf, size_t size) struct dhcpv6_option *dhcpv6_option_alloc(struct dhcpv6_packet *pkt, int code, int len) { struct dhcpv6_option *opt; - + opt = _malloc(sizeof(*opt)); if (!opt) { log_emerg("out of memory\n"); return NULL; } - + memset(opt, 0, sizeof(*opt)); INIT_LIST_HEAD(&opt->opt_list); @@ -172,13 +172,13 @@ struct dhcpv6_option *dhcpv6_option_alloc(struct dhcpv6_packet *pkt, int code, i struct dhcpv6_option *dhcpv6_nested_option_alloc(struct dhcpv6_packet *pkt, struct dhcpv6_option *popt, int code, int len) { struct dhcpv6_option *opt; - + opt = _malloc(sizeof(*opt)); if (!opt) { log_emerg("out of memory\n"); return NULL; } - + memset(opt, 0, sizeof(*opt)); INIT_LIST_HEAD(&opt->opt_list); opt->parent = popt; @@ -204,7 +204,7 @@ struct dhcpv6_packet *dhcpv6_packet_alloc_reply(struct dhcpv6_packet *req, int t { struct dhcpv6_packet *pkt = _malloc(sizeof(*pkt)); struct dhcpv6_option *opt; - + if (!pkt) { log_emerg("out of memory\n"); return NULL; @@ -306,7 +306,7 @@ void dhcpv6_packet_print(struct dhcpv6_packet *pkt, void (*print)(const char *fm print("Unknown"); else print("%s", type_name[pkt->hdr->type - 1]); - + print(" XID=%x", pkt->hdr->trans_id); print_options(&pkt->opt_list, 0, print); @@ -320,7 +320,7 @@ static void print_clientid(struct dhcpv6_option *opt, void (*print)(const char * struct dhcpv6_opt_clientid *o = (struct dhcpv6_opt_clientid *)opt->hdr; print(" %i:", htons(o->duid.type)); - + for (i = 0; i < ntohs(o->hdr.len) - 2; i++) print("%02x", o->duid.u.raw[i]); } @@ -358,7 +358,7 @@ static void print_oro(struct dhcpv6_option *opt, void (*print)(const char *fmt, for (; ptr < end_ptr; ptr++) { if (f) print(","); - else + else print(" "); for (dopt = known_options; dopt->code; dopt++) { diff --git a/accel-pppd/libnetlink/genl.c b/accel-pppd/libnetlink/genl.c index 7d745566..68405ba1 100644 --- a/accel-pppd/libnetlink/genl.c +++ b/accel-pppd/libnetlink/genl.c @@ -83,12 +83,12 @@ int __export genl_resolve_mcg(const char *family, const char *name, int *fam_id) if (!tb[CTRL_ATTR_MCAST_GROUPS]) goto out; - + if (fam_id) *fam_id = *(uint32_t *)(RTA_DATA(tb[CTRL_ATTR_FAMILY_ID])); - + parse_rtattr_nested(tb2, GENL_MAX_FAM_GRPS, tb[CTRL_ATTR_MCAST_GROUPS]); - + for (i = 1; i < GENL_MAX_FAM_GRPS; i++) { if (tb2[i]) { parse_rtattr_nested(tb3, CTRL_ATTR_MCAST_GRP_MAX, tb2[i]); diff --git a/accel-pppd/libnetlink/ipset.c b/accel-pppd/libnetlink/ipset.c index 73125352..7834b644 100644 --- a/accel-pppd/libnetlink/ipset.c +++ b/accel-pppd/libnetlink/ipset.c @@ -41,7 +41,7 @@ static int __ipset_cmd(const char *name, in_addr_t addr, int cmd, int flags) log_error("ipset: cannot open rtnetlink\n"); return -1; } - + memset(&req, 0, sizeof(req) - 4096); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); @@ -53,18 +53,18 @@ static int __ipset_cmd(const char *name, in_addr_t addr, int cmd, int flags) addattr_l(&req.n, 4096, IPSET_ATTR_PROTOCOL, &protocol, 1); addattr_l(&req.n, 4096, IPSET_ATTR_SETNAME, name, strlen(name) + 1); - + tail1 = addattr_nest(&req.n, MAX_MSG, IPSET_ATTR_DATA | NLA_F_NESTED); tail2 = addattr_nest(&req.n, MAX_MSG, IPSET_ATTR_IP | NLA_F_NESTED); addattr32(&req.n, 4096, IPSET_ATTR_IPADDR_IPV4 | NLA_F_NET_BYTEORDER, addr); addattr_nest_end(&req.n, tail2); - + addattr_nest_end(&req.n, tail1); - + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) goto out_err; - + rtnl_close(&rth); return 0; @@ -100,7 +100,7 @@ int __export ipset_flush(const char *name) log_error("ipset: cannot open rtnetlink\n"); return -1; } - + memset(&req, 0, sizeof(req) - 4096); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); @@ -112,10 +112,10 @@ int __export ipset_flush(const char *name) addattr_l(&req.n, 4096, IPSET_ATTR_PROTOCOL, &protocol, 1); addattr_l(&req.n, 4096, IPSET_ATTR_SETNAME, name, strlen(name) + 1); - + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) goto out_err; - + rtnl_close(&rth); return 0; diff --git a/accel-pppd/libnetlink/libnetlink.c b/accel-pppd/libnetlink/libnetlink.c index 026df82b..0536783a 100644 --- a/accel-pppd/libnetlink/libnetlink.c +++ b/accel-pppd/libnetlink/libnetlink.c @@ -139,7 +139,7 @@ int __export rtnl_send_check(struct rtnl_handle *rth, const char *buf, int len) struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) log_debug("libnetlink: ""ERROR truncated\n"); - else + else errno = -err->error; return -1; } diff --git a/accel-pppd/log.c b/accel-pppd/log.c index dcb2b113..0d481ad9 100644 --- a/accel-pppd/log.c +++ b/accel-pppd/log.c @@ -256,7 +256,7 @@ void __export log_free_msg(struct log_msg_t *m) struct _log_msg_t *msg = (struct _log_msg_t *)m->lpd; //printf("free msg %p\n", m); - + mempool_free(m->hdr); _log_free_msg(msg); @@ -270,7 +270,7 @@ static void _log_free_msg(struct _log_msg_t *msg) if (__sync_sub_and_fetch(&msg->refs, 1)) return; - + while(!list_empty(&msg->chunks)) { chunk = list_entry(msg->chunks.next, typeof(*chunk), entry); list_del(&chunk->entry); @@ -287,13 +287,13 @@ static struct log_msg_t *clone_msg(struct _log_msg_t *msg) log_emerg("log: out of memory\n"); return NULL; } - + m->hdr = mempool_alloc(chunk_pool); if (!m->hdr) { log_emerg("log: out of memory\n"); mempool_free(m); return NULL; - } + } m->hdr->len = 0; m->lpd = msg; @@ -311,14 +311,14 @@ static int add_msg(struct _log_msg_t *msg, const char *buf) { struct log_chunk_t *chunk; int i, chunk_cnt, len = strlen(buf); - + if (!list_empty(&msg->chunks)) { chunk = list_entry(msg->chunks.prev, typeof(*chunk), entry); i = min(len, LOG_CHUNK_SIZE - chunk->len); memcpy(chunk->msg + chunk->len, buf, i); chunk->len += i; chunk->msg[chunk->len] = 0; - + if (i == len) return 0; @@ -358,10 +358,10 @@ static void write_msg(FILE *f, struct _log_msg_t *msg, struct ap_session *ses) if (ses) fprintf(f, "%s: %s: ", ses->ifname, ses->sessionid); - + list_for_each_entry(chunk, &msg->chunks, entry) fwrite(chunk->msg, chunk->len, 1, f); - + fflush(f); pthread_mutex_unlock(&lock); } @@ -444,7 +444,7 @@ static void ev_ppp_authorized(struct ap_session *ses) struct _log_msg_t *msg; struct log_msg_t *m; struct log_target_t *t; - + list_for_each_entry(t, &targets, entry) if (t->session_start) t->session_start(ppp); diff --git a/accel-pppd/log.h b/accel-pppd/log.h index 0b4c1cee..5f3fd967 100644 --- a/accel-pppd/log.h +++ b/accel-pppd/log.h @@ -19,7 +19,7 @@ struct log_msg_t struct timeval timestamp; int level; struct log_chunk_t *hdr; - struct list_head *chunks; + struct list_head *chunks; }; struct log_chunk_t diff --git a/accel-pppd/logs/log_file.c b/accel-pppd/logs/log_file.c index 518f2c99..30bfde46 100644 --- a/accel-pppd/logs/log_file.c +++ b/accel-pppd/logs/log_file.c @@ -91,15 +91,15 @@ static int log_file_open(struct log_file_t *lf, const char *fname) if (lf->fd < 0) { log_emerg("log_file: open '%s': %s\n", fname, strerror(errno)); return -1; - } - + } + return 0; } static void purge(struct list_head *list) { struct log_msg_t *msg; - + while (!list_empty(list)) { msg = list_first_entry(list, typeof(*msg), entry); list_del(&msg->entry); @@ -117,7 +117,7 @@ static void *log_thread(void *unused) LIST_HEAD(msg_list); LIST_HEAD(free_list); sigset_t set; - + sigfillset(&set); sigdelset(&set, SIGKILL); sigdelset(&set, SIGSTOP); @@ -132,7 +132,7 @@ static void *log_thread(void *unused) pthread_mutex_unlock(&lock); iov_cnt = 0; - + while (1) { if (lf->new_fd != -1) { close(lf->fd); @@ -156,13 +156,13 @@ static void *log_thread(void *unused) mempool_free(lf->lpd); } else spin_unlock(&lf->lock); - + break; } - + list_splice_init(&lf->msgs, &msg_list); spin_unlock(&lf->lock); - + while (!list_empty(&msg_list)) { msg = list_first_entry(&msg_list, typeof(*msg), entry); @@ -183,7 +183,7 @@ static void *log_thread(void *unused) purge(&free_list); } } - + list_move_tail(&msg->entry, &free_list); } } @@ -243,7 +243,7 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses) localtime_r(&msg->timestamp.tv_sec, &tm); strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", &tm); - sprintf(msg->hdr->msg, "%s[%s]: %s: %s%s%s", conf_color ? level_color[msg->level] : "", + sprintf(msg->hdr->msg, "%s[%s]: %s: %s%s%s", conf_color ? level_color[msg->level] : "", timestamp, level_name[msg->level], ses ? ses->ifname : "", ses ? ": " : "", @@ -319,7 +319,7 @@ static void per_user_log(struct log_target_t *t, struct log_msg_t *msg, struct a static void per_session_log(struct log_target_t *t, struct log_msg_t *msg, struct ap_session *ses) { struct log_file_pd_t *lpd; - + if (!ses) { log_free_msg(msg); return; @@ -339,7 +339,7 @@ static void per_session_log(struct log_target_t *t, struct log_msg_t *msg, struc static void fail_log(struct log_target_t *t, struct log_msg_t *msg, struct ap_session *ses) { struct fail_log_pd_t *fpd; - + if (!ses || !conf_fail_log) { log_free_msg(msg); return; @@ -365,7 +365,7 @@ static void fail_reopen(void) log_emerg("log_file: open '%s': %s\n", fname, strerror(errno)); return; } - + spin_lock(&fail_log_file->lock); if (fail_log_file->queued) fail_log_file->new_fd = fd; @@ -434,7 +434,7 @@ static void ev_ses_authorized2(struct ap_session *ses) fpd = find_fpd(ses, &pd_key3); if (!fpd) return; - + while (!list_empty(&fpd->msgs)) { msg = list_entry(fpd->msgs.next, typeof(*msg), entry); list_del(&msg->entry); @@ -453,7 +453,7 @@ static void ev_ses_authorized1(struct ap_session *ses) lpd = find_lpd(ses, &pd_key1); if (!lpd) return; - + fname = _malloc(PATH_MAX); if (!fname) { log_emerg("log_file: out of memory\n"); @@ -599,7 +599,7 @@ static void ev_ses_starting(struct ap_session *ses) lpd = find_lpd(ses, &pd_key2); if (!lpd) return; - + fname1 = _malloc(PATH_MAX); if (!fname1) { log_emerg("log_file: out of memory\n"); @@ -631,23 +631,23 @@ static void ev_ses_starting(struct ap_session *ses) _free(fname2); } -static struct log_target_t general_target = +static struct log_target_t general_target = { .log = general_log, .reopen = general_reopen, }; -static struct log_target_t per_user_target = +static struct log_target_t per_user_target = { .log = per_user_log, }; -static struct log_target_t per_session_target = +static struct log_target_t per_session_target = { .log = per_session_log, }; -static struct log_target_t fail_log_target = +static struct log_target_t fail_log_target = { .log = fail_log, .reopen = fail_reopen, @@ -659,7 +659,7 @@ static void init(void) const char *opt; pthread_create(&log_thr, NULL, log_thread, NULL); - + lpd_pool = mempool_create(sizeof(struct log_file_pd_t)); fpd_pool = mempool_create(sizeof(struct fail_log_pd_t)); @@ -673,7 +673,7 @@ static void init(void) _exit(EXIT_FAILURE); } } - + opt = conf_get_opt("log", "log-fail-file"); if (opt) { fail_log_file = malloc(sizeof(*fail_log_file)); @@ -685,11 +685,11 @@ static void init(void) } conf_fail_log = 1; } - + opt = conf_get_opt("log","color"); if (opt && atoi(opt) > 0) conf_color = 1; - + opt = conf_get_opt("log", "per-user-dir"); if (opt) conf_per_user_dir = _strdup(opt); @@ -701,23 +701,23 @@ static void init(void) opt = conf_get_opt("log", "per-session"); if (opt && atoi(opt) > 0) conf_per_session = 1; - + opt = conf_get_opt("log", "copy"); if (opt && atoi(opt) > 0) conf_copy = 1; log_register_target(&general_target); - + if (conf_per_user_dir) { log_register_target(&per_user_target); triton_event_register_handler(EV_SES_AUTHORIZED, (triton_event_func)ev_ses_authorized1); } - + if (conf_per_session_dir) { log_register_target(&per_session_target); triton_event_register_handler(EV_SES_STARTING, (triton_event_func)ev_ses_starting); } - + if (conf_fail_log) { log_register_target(&fail_log_target); triton_event_register_handler(EV_SES_AUTHORIZED, (triton_event_func)ev_ses_authorized2); diff --git a/accel-pppd/logs/log_pgsql.c b/accel-pppd/logs/log_pgsql.c index 26c16c06..e4b5a9e9 100644 --- a/accel-pppd/logs/log_pgsql.c +++ b/accel-pppd/logs/log_pgsql.c @@ -68,9 +68,9 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses) msg->hdr->len += strlen(ses->username) + 1; strcpy(msg->hdr->msg + msg->hdr->len, ses->sessionid); msg->hdr->len += strlen(ses->sessionid) + 1; - } else + } else memset(msg->hdr->msg + msg->hdr->len, 0, 2); - + } static void write_next_msg(void) @@ -159,7 +159,7 @@ static int pgsql_flush(struct triton_md_handler_t *h) log_emerg("log_pgsql: %s\n", PQerrorMessage(conn)); if (r == 1) return 0; - + triton_md_disable_handler(&pgsql_hnd, MD_MODE_WRITE); return 0; } @@ -272,7 +272,7 @@ static void pgsql_close(struct triton_context_t *ctx) conn = NULL; triton_context_unregister(&pgsql_ctx); } else - need_close = 1; + need_close = 1; spin_unlock(&queue_lock); } @@ -294,7 +294,7 @@ static void init(void) opt = conf_get_opt("log-pgsql", "connect-inteval"); if (opt && atoi(opt) > 0) connect_timer.period = atoi(opt) * 1000; - + opt = conf_get_opt("log-pgsql", "log-query"); if (opt) conf_query = _strdup(opt); diff --git a/accel-pppd/logs/log_syslog.c b/accel-pppd/logs/log_syslog.c index b0b079aa..36c8775b 100644 --- a/accel-pppd/logs/log_syslog.c +++ b/accel-pppd/logs/log_syslog.c @@ -55,7 +55,7 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses) if (ses) { if (snprintf(msg->hdr->msg, LOG_CHUNK_SIZE, "%s:%s: ", ses->ifname, ses->username ? ses->username : "")) strcpy(msg->hdr->msg + LOG_CHUNK_SIZE - 3, ": "); - } else + } else msg->hdr->msg[0] = 0; } @@ -123,7 +123,7 @@ static void syslog_close(struct triton_context_t *ctx) if (sleeping) { triton_context_unregister(&syslog_ctx); } else - need_close = 1; + need_close = 1; spin_unlock(&queue_lock); } diff --git a/accel-pppd/logs/log_tcp.c b/accel-pppd/logs/log_tcp.c index 5f592d95..616809f0 100644 --- a/accel-pppd/logs/log_tcp.c +++ b/accel-pppd/logs/log_tcp.c @@ -207,9 +207,9 @@ static void start_connect(struct tcp_target_t *t) log_emerg("log-tcp: socket: %s\n", strerror(errno)); return; } - + fcntl(t->hnd.fd, F_SETFD, fcntl(t->hnd.fd, F_GETFD) | FD_CLOEXEC); - + if (fcntl(t->hnd.fd, F_SETFL, O_NONBLOCK)) { log_emerg("log-tcp: failed to set nonblocking mode: %s\n", strerror(errno)); close(t->hnd.fd); @@ -304,7 +304,7 @@ static void init(void) { struct conf_sect_t *s = conf_get_section("log"); struct conf_option_t *opt; - + if (!s) return; diff --git a/accel-pppd/main.c b/accel-pppd/main.c index 7be67670..9eb08e10 100644 --- a/accel-pppd/main.c +++ b/accel-pppd/main.c @@ -111,7 +111,7 @@ static void close_all_fd(void) int fd; sprintf(path, "/proc/%u/fd", getpid()); - + dirp = opendir(path); if (!dirp) return; @@ -162,7 +162,7 @@ static void sigsegv(int num) int status; pthread_sigmask(SIG_SETMASK, &orig_set, NULL); - + if (conf_dump) { FILE *f; unsigned int t = time(NULL); @@ -182,8 +182,8 @@ static void sigsegv(int num) sprintf(cmd, "gdb -x %s %s %d > dump-%u", fname, exec_file, getpid(), t); system(cmd); - - unlink(fname); + + unlink(fname); } out: @@ -242,12 +242,12 @@ int main(int _argc, char **_argv) if (!conf_file) goto usage; - + if (internal) { while (getppid() != 1) sleep(1); } - + if (triton_init(conf_file)) _exit(EXIT_FAILURE); @@ -300,12 +300,12 @@ int main(int _argc, char **_argv) sa.sa_handler = config_reload; sa.sa_mask = set; sigaction(SIGUSR1, &sa, NULL); - + sa.sa_handler = sigsegv; sa.sa_mask = set; sigaction(SIGSEGV, &sa, NULL); - + sigdelset(&set, SIGKILL); sigdelset(&set, SIGSTOP); sigdelset(&set, SIGSEGV); @@ -334,7 +334,7 @@ int main(int _argc, char **_argv) sigwait(&set, &sig); log_info1("terminate, sig = %i\n", sig); - + triton_terminate(); return EXIT_SUCCESS; diff --git a/accel-pppd/memdebug.c b/accel-pppd/memdebug.c index 4b374008..08c6ad05 100644 --- a/accel-pppd/memdebug.c +++ b/accel-pppd/memdebug.c @@ -92,7 +92,7 @@ void __export md_free(void *ptr, const char *fname, int line) mem->size, mem->fname, mem->line, fname, line); abort(); } - + mem->magic1 = 0; mem->magic2 = 0; @@ -232,7 +232,7 @@ void __export md_check(void *ptr) if (!ptr) abort(); - + if (mem->magic1 != MAGIC1) abort(); diff --git a/accel-pppd/ppp/ccp_mppe.c b/accel-pppd/ppp/ccp_mppe.c index 68b95a6b..31bbad4d 100644 --- a/accel-pppd/ppp/ccp_mppe.c +++ b/accel-pppd/ppp/ccp_mppe.c @@ -75,10 +75,10 @@ static struct ccp_option_t *mppe_init(struct ppp_ccp_t *ccp) mppe_opt->mppe = 1; else mppe_opt->mppe = -1; - + if (mppe == MPPE_REQUIRE || mppe == MPPE_PREFER) ccp->ld.passive = 0; - + if (mppe == MPPE_REQUIRE) ccp->ld.optional = 0; @@ -153,7 +153,7 @@ static int __mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, opt32->hdr.id = CI_MPPE; opt32->hdr.len = 6; opt32->val = mppe_opt->mppe ? htonl(MPPE_S | MPPE_H) : 0; - + if (setup_key && mppe_opt->mppe && setup_mppe_key(ccp->ppp->unit_fd, 0, mppe_opt->recv_key)) return 0; @@ -189,7 +189,7 @@ static int mppe_recv_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, u return CCP_OPT_NAK; return CCP_OPT_ACK; } - + if (opt32->hdr.len != 6) return CCP_OPT_REJ; @@ -209,7 +209,7 @@ static int mppe_recv_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, u mppe_opt->mppe = 0; } else return CCP_OPT_REJ; - + if (mppe_opt->mppe) { if (setup_mppe_key(ccp->ppp->unit_fd, 1, mppe_opt->send_key)) return CCP_OPT_REJ; @@ -283,7 +283,7 @@ static void mppe_print(void (*print)(const char *fmt,...),struct ccp_option_t *o bits & MPPE_S ? "+" : "-", bits & MPPE_L ? "+" : "-", bits & MPPE_D ? "+" : "-", - bits & MPPE_C ? "+" : "-" + bits & MPPE_C ? "+" : "-" ); } @@ -304,7 +304,7 @@ static void ev_mppe_keys(struct ev_mppe_keys_t *ev) mppe_opt->mppe = 0; return; } - + if (ccp->ppp->ses.ctrl->mppe == MPPE_UNSET) mppe = conf_mppe; else @@ -348,7 +348,7 @@ static void mppe_opt_init() { ccp_option_register(&mppe_opt_hnd); triton_event_register_handler(EV_MPPE_KEYS, (triton_event_func)ev_mppe_keys); - + load_config(); triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); } diff --git a/accel-pppd/ppp/ipcp_opt_dns.c b/accel-pppd/ppp/ipcp_opt_dns.c index bd5114ac..f4028448 100644 --- a/accel-pppd/ppp/ipcp_opt_dns.c +++ b/accel-pppd/ppp/ipcp_opt_dns.c @@ -109,7 +109,7 @@ static int dns_recv_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *opt, if (dns_opt->addr == opt32->val) return IPCP_OPT_ACK; - + return IPCP_OPT_NAK; } @@ -123,7 +123,7 @@ static void dns1_print(void (*print)(const char *fmt, ...), struct ipcp_option_t in.s_addr = opt32->val; else in.s_addr = dns_opt->addr; - + print("<dns1 %s>", inet_ntoa(in)); } @@ -137,7 +137,7 @@ static void dns2_print(void (*print)(const char *fmt, ...), struct ipcp_option_t in.s_addr = opt32->val; else in.s_addr = dns_opt->addr; - + print("<dns2 %s>", inet_ntoa(in)); } @@ -148,7 +148,7 @@ static void ev_dns(struct ev_dns_t *ev) if (!ev->ses->ctrl->ppp) return; - + ppp = container_of(ev->ses, typeof(*ppp), ses); dns_opt = container_of(ipcp_find_option(ppp, &dns1_opt_hnd), typeof(*dns_opt), opt); @@ -161,11 +161,11 @@ static void ev_dns(struct ev_dns_t *ev) static void load_config(void) { char *opt; - + opt = conf_get_opt("dns", "dns1"); if (opt) conf_dns1 = inet_addr(opt); - + opt = conf_get_opt("dns", "dns2"); if (opt) conf_dns2 = inet_addr(opt); diff --git a/accel-pppd/ppp/ipcp_opt_ipaddr.c b/accel-pppd/ppp/ipcp_opt_ipaddr.c index 8a77848e..7bac55bf 100644 --- a/accel-pppd/ppp/ipcp_opt_ipaddr.c +++ b/accel-pppd/ppp/ipcp_opt_ipaddr.c @@ -86,19 +86,19 @@ static int alloc_ip(struct ppp_t *ppp) log_ppp_warn("ppp: no free IPv4 address\n"); return IPCP_OPT_CLOSE; } - + if (iprange_tunnel_check(ppp->ses.ipv4->peer_addr)) { log_ppp_warn("ppp:ipcp: to avoid kernel soft lockup requested IP cannot be assigned (%i.%i.%i.%i)\n", - ppp->ses.ipv4->peer_addr&0xff, - (ppp->ses.ipv4->peer_addr >> 8)&0xff, - (ppp->ses.ipv4->peer_addr >> 16)&0xff, + ppp->ses.ipv4->peer_addr&0xff, + (ppp->ses.ipv4->peer_addr >> 8)&0xff, + (ppp->ses.ipv4->peer_addr >> 16)&0xff, (ppp->ses.ipv4->peer_addr >> 24)&0xff); return IPCP_OPT_FAIL; } - + if (conf_check_exists && check_exists(ppp, ppp->ses.ipv4->peer_addr)) return IPCP_OPT_FAIL; - + return 0; } @@ -107,13 +107,13 @@ static int ipaddr_send_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *o struct ipaddr_option_t *ipaddr_opt = container_of(opt, typeof(*ipaddr_opt), opt); struct ipcp_opt32_t *opt32 = (struct ipcp_opt32_t *)ptr; int r; - + if (!ipcp->ppp->ses.ipv4) { r = alloc_ip(ipcp->ppp); if (r) return r; } - + opt32->hdr.id = CI_ADDR; opt32->hdr.len = 6; opt32->val = ipcp->ppp->ses.ipv4->addr; @@ -149,7 +149,7 @@ static int ipaddr_recv_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *o ipcp->delay_ack = ccp_ipcp_started(ipcp->ppp); return IPCP_OPT_ACK; } - + return IPCP_OPT_NAK; } @@ -163,7 +163,7 @@ static void ipaddr_print(void (*print)(const char *fmt,...),struct ipcp_option_t in.s_addr = opt32->val; else if (ipaddr_opt->ppp->ses.ipv4) in.s_addr = ipaddr_opt->ppp->ses.ipv4->addr; - + print("<addr %s>",inet_ntoa(in)); } diff --git a/accel-pppd/ppp/ipcp_opt_wins.c b/accel-pppd/ppp/ipcp_opt_wins.c index fd69a8cf..c9a3bb5c 100644 --- a/accel-pppd/ppp/ipcp_opt_wins.c +++ b/accel-pppd/ppp/ipcp_opt_wins.c @@ -109,7 +109,7 @@ static int wins_recv_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *opt if (wins_opt->addr == opt32->val) return IPCP_OPT_ACK; - + return IPCP_OPT_NAK; } @@ -123,7 +123,7 @@ static void wins1_print(void (*print)(const char *fmt, ...), struct ipcp_option_ in.s_addr = opt32->val; else in.s_addr = wins_opt->addr; - + print("<wins1 %s>", inet_ntoa(in)); } @@ -137,7 +137,7 @@ static void wins2_print(void (*print)(const char *fmt, ...), struct ipcp_option_ in.s_addr = opt32->val; else in.s_addr = wins_opt->addr; - + print("<wins2 %s>", inet_ntoa(in)); } @@ -145,7 +145,7 @@ static void ev_wins(struct ev_wins_t *ev) { struct wins_option_t *wins_opt; struct ppp_t *ppp; - + if (!ev->ses->ctrl->ppp) return; @@ -161,11 +161,11 @@ static void ev_wins(struct ev_wins_t *ev) static void load_config(void) { char *opt; - + opt = conf_get_opt("wins", "wins1"); if (opt) conf_wins1 = inet_addr(opt); - + opt = conf_get_opt("wins", "wins2"); if (opt) conf_wins2 = inet_addr(opt); diff --git a/accel-pppd/ppp/ipv6cp_opt_intfid.c b/accel-pppd/ppp/ipv6cp_opt_intfid.c index d2b8127a..aa7afb61 100644 --- a/accel-pppd/ppp/ipv6cp_opt_intfid.c +++ b/accel-pppd/ppp/ipv6cp_opt_intfid.c @@ -159,7 +159,7 @@ static uint64_t generate_intf_id(struct ppp_t *ppp) return id; } - + static uint64_t generate_peer_intf_id(struct ppp_t *ppp) { char str[4]; @@ -168,7 +168,7 @@ static uint64_t generate_peer_intf_id(struct ppp_t *ppp) uint64_t intf_id; uint16_t addr16[4]; } u; - + switch (conf_peer_intf_id) { case INTF_ID_FIXED: return conf_peer_intf_id_val; @@ -204,10 +204,10 @@ static int alloc_ip(struct ppp_t *ppp) if (!ppp->ses.ipv6->intf_id) ppp->ses.ipv6->intf_id = generate_intf_id(ppp); - + if (conf_check_exists && check_exists(ppp)) return IPV6CP_OPT_FAIL; - + return 0; } @@ -216,13 +216,13 @@ static int ipaddr_send_conf_req(struct ppp_ipv6cp_t *ipv6cp, struct ipv6cp_optio struct ipaddr_option_t *ipaddr_opt = container_of(opt, typeof(*ipaddr_opt), opt); struct ipv6cp_opt64_t *opt64 = (struct ipv6cp_opt64_t *)ptr; int r; - + if (!ipv6cp->ppp->ses.ipv6) { r = alloc_ip(ipv6cp->ppp); if (r) return r; } - + opt64->hdr.id = CI_INTFID; opt64->hdr.len = 10; opt64->val = ipv6cp->ppp->ses.ipv6->intf_id; @@ -267,7 +267,7 @@ static int ipaddr_recv_conf_req(struct ppp_ipv6cp_t *ipv6cp, struct ipv6cp_optio ipaddr_opt->started = 1; return IPV6CP_OPT_ACK; } - + return IPV6CP_OPT_NAK; } @@ -281,7 +281,7 @@ static void ipaddr_print(void (*print)(const char *fmt,...), struct ipv6cp_optio *(uint64_t *)(a.s6_addr + 8) = opt64->val; else *(uint64_t *)(a.s6_addr + 8) = ipaddr_opt->ppp->ses.ipv6->intf_id; - + print("<addr %x:%x:%x:%x>", ntohs(a.s6_addr16[4]), ntohs(a.s6_addr16[5]), ntohs(a.s6_addr16[6]), ntohs(a.s6_addr16[7])); } @@ -297,7 +297,7 @@ static uint64_t parse_intfid(const char *opt) if (sscanf(opt, "%x:%x:%x:%x", &n[0], &n[1], &n[2], &n[3]) != 4) goto err; - + for (i = 0; i < 4; i++) { if (n[i] < 0 || n[i] > 0xffff) goto err; @@ -329,7 +329,7 @@ static void load_config(void) conf_intf_id_val = parse_intfid(opt); } } - + opt = conf_get_opt("ppp", "ipv6-peer-intf-id"); if (opt) { if (!strcmp(opt, "random")) @@ -343,7 +343,7 @@ static void load_config(void) conf_peer_intf_id_val = parse_intfid(opt); } } - + opt = conf_get_opt("ppp", "ipv6-accept-peer-intf-id"); if (opt) conf_accept_peer_intf_id = atoi(opt); diff --git a/accel-pppd/ppp/lcp_opt_accomp.c b/accel-pppd/ppp/lcp_opt_accomp.c index 7e605826..f55ed3cf 100644 --- a/accel-pppd/ppp/lcp_opt_accomp.c +++ b/accel-pppd/ppp/lcp_opt_accomp.c @@ -138,7 +138,7 @@ static void accomp_print(void (*print)(const char *fmt, ...), struct lcp_option_ static void load_config(void) { char *opt; - + opt = conf_get_opt("ppp", "accomp"); if (opt) { if (!strcmp(opt, "deny")) diff --git a/accel-pppd/ppp/lcp_opt_magic.c b/accel-pppd/ppp/lcp_opt_magic.c index e2d9bade..52ed26eb 100644 --- a/accel-pppd/ppp/lcp_opt_magic.c +++ b/accel-pppd/ppp/lcp_opt_magic.c @@ -71,7 +71,7 @@ static int magic_send_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, { struct magic_option_t *magic_opt = container_of(opt, typeof(*magic_opt), opt); struct lcp_opt32_t *opt32 = (struct lcp_opt32_t *)ptr; - + if (!magic_opt->magic) return 0; diff --git a/accel-pppd/ppp/lcp_opt_mru.c b/accel-pppd/ppp/lcp_opt_mru.c index 1cd04f82..c9443312 100644 --- a/accel-pppd/ppp/lcp_opt_mru.c +++ b/accel-pppd/ppp/lcp_opt_mru.c @@ -103,7 +103,7 @@ static int mru_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui /*if (!ptr) return LCP_OPT_NAK;*/ - + if (opt16->hdr.len != 4) return LCP_OPT_REJ; @@ -132,7 +132,7 @@ static int mru_recv_conf_ack(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui if (ioctl(sock_fd, SIOCSIFMTU, &ifr)) log_ppp_error("lcp:mru: failed to set MTU: %s\n", strerror(errno)); - + return 0; } @@ -169,11 +169,11 @@ static void load_config(void) opt = conf_get_opt("ppp", "min-mtu"); if (opt && atoi(opt) > 0) conf_min_mtu = atoi(opt); - + opt = conf_get_opt("ppp", "max-mtu"); if (opt && atoi(opt) > 0) conf_max_mtu = atoi(opt); - + if (conf_min_mtu > conf_mru) { log_emerg("min-mtu cann't be greater then mtu/mru\n"); conf_min_mtu = conf_mru; diff --git a/accel-pppd/ppp/lcp_opt_pcomp.c b/accel-pppd/ppp/lcp_opt_pcomp.c index e034622e..28ca98f9 100644 --- a/accel-pppd/ppp/lcp_opt_pcomp.c +++ b/accel-pppd/ppp/lcp_opt_pcomp.c @@ -138,7 +138,7 @@ static void pcomp_print(void (*print)(const char *fmt, ...), struct lcp_option_t static void load_config(void) { char *opt; - + opt = conf_get_opt("ppp", "pcomp"); if (opt) { if (!strcmp(opt, "deny")) diff --git a/accel-pppd/ppp/ppp_auth.c b/accel-pppd/ppp/ppp_auth.c index 442db7ed..a387ba2d 100644 --- a/accel-pppd/ppp/ppp_auth.c +++ b/accel-pppd/ppp/ppp_auth.c @@ -50,7 +50,7 @@ struct auth_layer_data_t struct ppp_t *ppp; }; -static struct lcp_option_handler_t auth_opt_hnd = +static struct lcp_option_handler_t auth_opt_hnd = { .init = auth_init, .send_conf_req = auth_send_conf_req, @@ -63,7 +63,7 @@ static struct lcp_option_handler_t auth_opt_hnd = .print = auth_print, }; -static struct ppp_layer_t auth_layer = +static struct ppp_layer_t auth_layer = { .init = auth_layer_init, .start = auth_layer_start, @@ -156,7 +156,7 @@ static int auth_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, u if (list_empty(&auth_opt->auth_list)) return LCP_OPT_REJ; - + if (!ptr) return LCP_OPT_ACK; @@ -172,7 +172,7 @@ static int auth_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, u return r; } } - + list_for_each_entry(d, &auth_opt->auth_list, entry) { if (d->state != LCP_OPT_NAK) { auth_opt->peer_auth = d; @@ -205,7 +205,7 @@ static int auth_recv_conf_nak(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, u auth_opt->auth->state = LCP_OPT_NAK; if (auth_opt->peer_auth) auth_opt->auth = auth_opt->peer_auth; - + list_for_each_entry(d, &auth_opt->auth_list, entry) { if (d->state != LCP_OPT_NAK) return 0; @@ -224,11 +224,11 @@ static int auth_recv_conf_rej(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, u log_ppp_error("auth: unexcepcted configure-reject\n"); return -1; } - + auth_opt->auth->state = LCP_OPT_NAK; if (auth_opt->peer_auth) auth_opt->auth = auth_opt->peer_auth; - + list_for_each_entry(d, &auth_opt->auth_list, entry) { if (d->state != LCP_OPT_NAK) return 0; @@ -266,7 +266,7 @@ static struct ppp_layer_data_t *auth_layer_init(struct ppp_t *ppp) struct auth_layer_data_t *ad = _malloc(sizeof(*ad)); log_ppp_debug("auth_layer_init\n"); - + memset(ad, 0, sizeof(*ad)); ad->ppp = ppp; @@ -277,9 +277,9 @@ static struct ppp_layer_data_t *auth_layer_init(struct ppp_t *ppp) static int auth_layer_start(struct ppp_layer_data_t *ld) { struct auth_layer_data_t *ad = container_of(ld,typeof(*ad),ld); - + log_ppp_debug("auth_layer_start\n"); - + if (ad->auth_opt.auth) { ad->auth_opt.started = 1; ad->auth_opt.auth->h->start(ad->ppp, ad->auth_opt.auth); @@ -287,19 +287,19 @@ static int auth_layer_start(struct ppp_layer_data_t *ld) log_ppp_debug("auth_layer_started\n"); ppp_layer_started(ad->ppp, ld); } - + return 0; } static void auth_layer_finish(struct ppp_layer_data_t *ld) { struct auth_layer_data_t *ad = container_of(ld, typeof(*ad), ld); - + log_ppp_debug("auth_layer_finish\n"); - + if (ad->auth_opt.auth) ad->auth_opt.auth->h->finish(ad->ppp, ad->auth_opt.auth); - + ad->auth_opt.started = 0; log_ppp_debug("auth_layer_finished\n"); @@ -375,10 +375,10 @@ int __export ppp_auth_restart(struct ppp_t *ppp) if (!ad->auth_opt.auth->h->restart) return -1; - + if (ad->auth_opt.auth->h->restart(ppp, ad->auth_opt.auth)) return -1; - + return 0; } diff --git a/accel-pppd/ppp/ppp_auth.h b/accel-pppd/ppp/ppp_auth.h index af98262a..5049fd5a 100644 --- a/accel-pppd/ppp/ppp_auth.h +++ b/accel-pppd/ppp/ppp_auth.h @@ -9,7 +9,7 @@ struct auth_data_t { struct list_head entry; int proto; - int state; + int state; struct ppp_auth_handler_t *h; }; diff --git a/accel-pppd/ppp/ppp_ccp.c b/accel-pppd/ppp/ppp_ccp.c index ad6e37e2..ceaccee2 100644 --- a/accel-pppd/ppp/ppp_ccp.c +++ b/accel-pppd/ppp/ppp_ccp.c @@ -79,7 +79,7 @@ static int ccp_set_flags(int fd, int isopen, int isup) log_ppp_error("ccp: failed to get flags: %s\n", strerror(errno)); return -1; } - + flags &= ~(SC_CCP_OPEN | SC_CCP_UP); flags |= (isopen ? SC_CCP_OPEN : 0) | (isup ? SC_CCP_UP : 0); @@ -87,7 +87,7 @@ static int ccp_set_flags(int fd, int isopen, int isup) log_ppp_error("ccp: failed to set flags: %s\n", strerror(errno)); return -1; } - + return 0; } @@ -95,24 +95,24 @@ static struct ppp_layer_data_t *ccp_layer_init(struct ppp_t *ppp) { struct ppp_ccp_t *ccp = _malloc(sizeof(*ccp)); memset(ccp, 0, sizeof(*ccp)); - + log_ppp_debug("ccp_layer_init\n"); ccp->ppp = ppp; ccp->fsm.ppp = ppp; - + ccp->hnd.proto = PPP_CCP; ccp->hnd.recv = ccp_recv; ccp->hnd.recv_proto_rej = ccp_recv_proto_rej; - + ppp_register_unit_handler(ppp, &ccp->hnd); - + ccp->ld.passive = 1; ccp->ld.optional = 1; INIT_LIST_HEAD(&ccp->options); ccp_options_init(ccp); - + ccp->fsm.proto = PPP_CCP; ppp_fsm_init(&ccp->fsm); @@ -136,7 +136,7 @@ static struct ppp_layer_data_t *ccp_layer_init(struct ppp_t *ppp) int ccp_layer_start(struct ppp_layer_data_t *ld) { struct ppp_ccp_t *ccp = container_of(ld, typeof(*ccp), ld); - + log_ppp_debug("ccp_layer_start\n"); ccp_set_flags(ccp->ppp->unit_fd, 0, 0); @@ -154,21 +154,21 @@ int ccp_layer_start(struct ppp_layer_data_t *ld) if (ppp_fsm_open(&ccp->fsm)) return -1; } - + if (ccp_set_flags(ccp->ppp->unit_fd, 1, 0)) { ppp_fsm_close(&ccp->fsm); return -1; } - + return 0; } void ccp_layer_finish(struct ppp_layer_data_t *ld) { struct ppp_ccp_t *ccp = container_of(ld, typeof(*ccp), ld); - + log_ppp_debug("ccp_layer_finish\n"); - + ccp_set_flags(ccp->ppp->unit_fd, 0, 0); ccp->fsm.fsm_state = FSM_Closed; @@ -180,7 +180,7 @@ void ccp_layer_finish(struct ppp_layer_data_t *ld) void ccp_layer_free(struct ppp_layer_data_t *ld) { struct ppp_ccp_t *ccp = container_of(ld, typeof(*ccp), ld); - + log_ppp_debug("ccp_layer_free\n"); ppp_unregister_handler(ccp->ppp, &ccp->hnd); @@ -215,7 +215,7 @@ static void ccp_layer_finished(struct ppp_fsm_t *fsm) ppp_layer_passive(ccp->ppp, &ccp->ld); else if (!ccp->ppp->ses.terminating) ap_session_terminate(&ccp->ppp->ses, TERM_USER_ERROR, 0); - + fsm->fsm_state = FSM_Closed; } @@ -258,12 +258,12 @@ static int send_conf_req(struct ppp_fsm_t *fsm) ccp_hdr->code = CONFREQ; ccp_hdr->id = ccp->fsm.id; ccp_hdr->len = 0; - + ptr = (uint8_t*)(ccp_hdr + 1); if (conf_ppp_verbose) log_ppp_info2("send [CCP ConfReq id=%x", ccp_hdr->id); - + list_for_each_entry(lopt, &ccp->options, entry) { n = lopt->h->send_conf_req(ccp, lopt, ptr); if (n < 0) @@ -276,10 +276,10 @@ static int send_conf_req(struct ppp_fsm_t *fsm) } ptr += n; } - + if (conf_ppp_verbose) log_ppp_info2("]\n"); - + ccp_hdr->len = htons(ptr - buf - 2); ppp_unit_send(ccp->ppp, ccp_hdr, ptr - buf); @@ -315,7 +315,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) ccp_hdr->code = CONFNAK; ccp_hdr->id = ccp->fsm.recv_id; ccp_hdr->len = 0; - + ptr += sizeof(*ccp_hdr); list_for_each_entry(lopt, &ccp->options, entry) { @@ -327,7 +327,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) ptr += lopt->h->send_conf_nak(ccp, lopt, ptr); } } - + if (conf_ppp_verbose) log_ppp_info2("]\n"); @@ -394,7 +394,7 @@ static int ccp_recv_conf_req(struct ppp_ccp_t *ccp, uint8_t *data, int size) ropt = _malloc(sizeof(*ropt)); memset(ropt, 0, sizeof(*ropt)); - + ropt->hdr = hdr; ropt->len = hdr->len; ropt->state = CCP_OPT_NONE; @@ -403,7 +403,7 @@ static int ccp_recv_conf_req(struct ppp_ccp_t *ccp, uint8_t *data, int size) data += hdr->len; size -= hdr->len; } - + if (conf_ppp_verbose) log_ppp_info2("recv [CCP ConfReq id=%x", ccp->fsm.recv_id); @@ -483,7 +483,7 @@ static int ccp_recv_conf_rej(struct ppp_ccp_t *ccp, uint8_t *data, int size) while (size > 0) { hdr = (struct ccp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -524,7 +524,7 @@ static int ccp_recv_conf_nak(struct ppp_ccp_t *ccp, uint8_t *data, int size) while (size > 0) { hdr = (struct ccp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -567,7 +567,7 @@ static int ccp_recv_conf_ack(struct ppp_ccp_t *ccp, uint8_t *data, int size) while (size > 0) { hdr = (struct ccp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -656,9 +656,9 @@ static void ccp_recv(struct ppp_handler_t*h) return; ccp->fsm.recv_id = hdr->id; - + switch(hdr->code) { - case CONFREQ: + case CONFREQ: r = ccp_recv_conf_req(ccp, (uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN); if (ccp->ld.passive) { ccp->ld.passive = 0; @@ -684,7 +684,7 @@ static void ccp_recv(struct ppp_handler_t*h) } } ccp_free_conf_req(ccp); - + if (r == CCP_OPT_FAIL) ap_session_terminate(&ccp->ppp->ses, TERM_USER_ERROR, 0); break; @@ -738,7 +738,7 @@ static void ccp_recv_proto_rej(struct ppp_handler_t *h) if (ccp->fsm.fsm_state == FSM_Initial || ccp->fsm.fsm_state == FSM_Closed) return; - + ppp_fsm_lower_down(&ccp->fsm); ppp_fsm_close(&ccp->fsm); } @@ -748,9 +748,9 @@ int ccp_option_register(struct ccp_option_handler_t *h) /*struct ccp_option_drv_t *p; list_for_each_entry(p,option_drv_list,entry) - if (p->id==h->id) + if (p->id==h->id) return -1;*/ - + list_add_tail(&h->entry,&option_handlers); return 0; @@ -764,11 +764,11 @@ struct ccp_option_t *ccp_find_option(struct ppp_t *ppp, struct ccp_option_handle { struct ppp_ccp_t *ccp = container_of(ppp_find_layer_data(ppp, &ccp_layer), typeof(*ccp), ld); struct ccp_option_t *opt; - + list_for_each_entry(opt, &ccp->options, entry) if (opt->h == h) return opt; - + log_emerg("ccp: BUG: option not found\n"); abort(); } @@ -795,7 +795,7 @@ static void load_config(void) opt = conf_get_opt("ppp", "ccp"); if (opt && atoi(opt) >= 0) conf_ccp = atoi(opt); - + opt = conf_get_opt("ppp", "ccp-max-configure"); if (opt && atoi(opt) > 0) conf_ccp_max_configure = atoi(opt); diff --git a/accel-pppd/ppp/ppp_ccp.h b/accel-pppd/ppp/ppp_ccp.h index acc56ff0..cb5b1644 100644 --- a/accel-pppd/ppp/ppp_ccp.h +++ b/accel-pppd/ppp/ppp_ccp.h @@ -82,7 +82,7 @@ struct ppp_ccp_t struct list_head ropt_list; // last received ConfReq int ropt_len; - + int conf_req_len; int starting:1; int started:1; diff --git a/accel-pppd/ppp/ppp_fsm.c b/accel-pppd/ppp/ppp_fsm.c index b0331d90..bb45d5cb 100644 --- a/accel-pppd/ppp/ppp_fsm.c +++ b/accel-pppd/ppp/ppp_fsm.c @@ -54,7 +54,7 @@ int ppp_fsm_lower_up(struct ppp_fsm_t *layer) //if (layer->init_req_cnt) layer->init_req_cnt(layer); init_req_counter(layer,layer->max_configure); --layer->restart_counter; - if (layer->send_conf_req) + if (layer->send_conf_req) if (layer->send_conf_req(layer)) return -1; layer->fsm_state=FSM_Req_Sent; @@ -509,7 +509,7 @@ static void init_req_counter(struct ppp_fsm_t *layer,int timeout) static void zero_req_counter(struct ppp_fsm_t *layer) { layer->restart_counter=0; - + if (!layer->restart_timer.tpd) triton_timer_add(layer->ppp->ses.ctrl->ctx, &layer->restart_timer, 0); } diff --git a/accel-pppd/ppp/ppp_fsm.h b/accel-pppd/ppp/ppp_fsm.h index 95da7b63..57abb869 100644 --- a/accel-pppd/ppp/ppp_fsm.h +++ b/accel-pppd/ppp/ppp_fsm.h @@ -25,7 +25,7 @@ struct ppp_fsm_t struct ppp_t *ppp; FSM_STATE fsm_state; uint16_t proto; - + struct triton_timer_t restart_timer; int restart_counter; int max_terminate; diff --git a/accel-pppd/ppp/ppp_ifcfg.c b/accel-pppd/ppp/ppp_ifcfg.c index aa2aff7b..f6eba064 100644 --- a/accel-pppd/ppp/ppp_ifcfg.c +++ b/accel-pppd/ppp/ppp_ifcfg.c @@ -21,7 +21,7 @@ struct in6_ifreq { struct in6_addr ifr6_addr; __u32 ifr6_prefixlen; - int ifr6_ifindex; + int ifr6_ifindex; }; static void devconf(struct ppp_t *ppp, const char *attr, const char *val) @@ -58,7 +58,7 @@ void ppp_ifup(struct ppp_t *ppp) struct in6_ifreq ifr6; struct npioctl np; struct sockaddr_in addr; - + triton_event_fire(EV_SES_ACCT_START, ppp); if (ppp->stop_time) return; @@ -69,19 +69,19 @@ void ppp_ifup(struct ppp_t *ppp) memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, ppp->ifname); - + if (ppp->ses.ipv4) { memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = ppp->ses.ipv4->addr; memcpy(&ifr.ifr_addr,&addr,sizeof(addr)); - + if (ioctl(sock_fd, SIOCSIFADDR, &ifr)) log_ppp_error("ppp: failed to set IPv4 address: %s\n", strerror(errno)); - + addr.sin_addr.s_addr = ppp->ses.ipv4->peer_addr; memcpy(&ifr.ifr_dstaddr,&addr,sizeof(addr)); - + if (ioctl(sock_fd, SIOCSIFDSTADDR, &ifr)) log_ppp_error("ppp: failed to set peer IPv4 address: %s\n", strerror(errno)); } @@ -99,7 +99,7 @@ void ppp_ifup(struct ppp_t *ppp) if (ioctl(sock6_fd, SIOCSIFADDR, &ifr6)) log_ppp_error("ppp: failed to set LL IPv6 address: %s\n", strerror(errno)); - + list_for_each_entry(a, &ppp->ses.ipv6->addr_list, entry) { if (a->prefix_len == 128) continue; @@ -127,7 +127,7 @@ void ppp_ifup(struct ppp_t *ppp) if (ioctl(ppp->unit_fd, PPPIOCSNPMODE, &np)) log_ppp_error("ppp: failed to set NP (IPv4) mode: %s\n", strerror(errno)); } - + if (ppp->ses.ipv6) { np.protocol = PPP_IPV6; np.mode = NPMODE_PASS; @@ -135,7 +135,7 @@ void ppp_ifup(struct ppp_t *ppp) if (ioctl(ppp->unit_fd, PPPIOCSNPMODE, &np)) log_ppp_error("ppp: failed to set NP (IPv6) mode: %s\n", strerror(errno)); } - + ppp->ses.ctrl->started(ppp); triton_event_fire(EV_SES_STARTED, ppp); @@ -167,7 +167,7 @@ void __export ppp_ifdown(struct ppp_t *ppp) ifr6.ifr6_ifindex = ppp->ifindex; ioctl(sock6_fd, SIOCDIFADDR, &ifr6); - + list_for_each_entry(a, &ppp->ses.ipv6->addr_list, entry) { if (a->prefix_len == 128) continue; diff --git a/accel-pppd/ppp/ppp_ipcp.c b/accel-pppd/ppp/ppp_ipcp.c index 6cb86a4b..416fba93 100644 --- a/accel-pppd/ppp/ppp_ipcp.c +++ b/accel-pppd/ppp/ppp_ipcp.c @@ -54,7 +54,7 @@ static void ipcp_options_init(struct ppp_ipcp_t *ipcp) struct ipcp_option_handler_t *h; ipcp->conf_req_len = sizeof(struct ipcp_hdr_t); - + list_for_each_entry(h,&option_handlers,entry) { lopt = h->init(ipcp); if (lopt) { @@ -80,16 +80,16 @@ static struct ppp_layer_data_t *ipcp_layer_init(struct ppp_t *ppp) { struct ppp_ipcp_t *ipcp = _malloc(sizeof(*ipcp)); memset(ipcp, 0, sizeof(*ipcp)); - + log_ppp_debug("ipcp_layer_init\n"); ipcp->ppp = ppp; ipcp->fsm.ppp = ppp; - + ipcp->hnd.proto = PPP_IPCP; ipcp->hnd.recv = ipcp_recv; ipcp->hnd.recv_proto_rej = ipcp_recv_proto_rej; - + ppp_register_unit_handler(ppp, &ipcp->hnd); INIT_LIST_HEAD(&ipcp->options); @@ -111,7 +111,7 @@ static struct ppp_layer_data_t *ipcp_layer_init(struct ppp_t *ppp) INIT_LIST_HEAD(&ipcp->ropt_list); ipcp->ld.passive = conf_ipv4 == IPV4_ALLOW || conf_ipv4 == IPV4_DENY; - + return &ipcp->ld; } @@ -128,7 +128,7 @@ static void ipcp_start_timeout(struct triton_timer_t *t) int ipcp_layer_start(struct ppp_layer_data_t *ld) { struct ppp_ipcp_t *ipcp = container_of(ld, typeof(*ipcp), ld); - + log_ppp_debug("ipcp_layer_start\n"); ipcp->starting = 1; @@ -144,18 +144,18 @@ int ipcp_layer_start(struct ppp_layer_data_t *ld) return -1; } } - + return 0; } void ipcp_layer_finish(struct ppp_layer_data_t *ld) { struct ppp_ipcp_t *ipcp = container_of(ld, typeof(*ipcp), ld); - + log_ppp_debug("ipcp_layer_finish\n"); ipcp->fsm.fsm_state = FSM_Closed; - + log_ppp_debug("ipcp_layer_finished\n"); ppp_layer_finished(ipcp->ppp, &ipcp->ld); } @@ -163,9 +163,9 @@ void ipcp_layer_finish(struct ppp_layer_data_t *ld) void ipcp_layer_free(struct ppp_layer_data_t *ld) { struct ppp_ipcp_t *ipcp = container_of(ld, typeof(*ipcp), ld); - + log_ppp_debug("ipcp_layer_free\n"); - + ppp_unregister_handler(ipcp->ppp, &ipcp->hnd); ipcp_options_free(ipcp); ppp_fsm_free(&ipcp->fsm); @@ -189,7 +189,7 @@ static void __ipcp_layer_up(struct ppp_ipcp_t *ipcp) static void ipcp_layer_up(struct ppp_fsm_t *fsm) { struct ppp_ipcp_t *ipcp = container_of(fsm, typeof(*ipcp), fsm); - + if (!ipcp->delay_ack) __ipcp_layer_up(ipcp); } @@ -207,7 +207,7 @@ static void ipcp_layer_finished(struct ppp_fsm_t *fsm) ppp_layer_passive(ipcp->ppp, &ipcp->ld); } else if (!ipcp->ppp->ses.terminating) ap_session_terminate(&ipcp->ppp->ses, TERM_USER_ERROR, 0); - + fsm->fsm_state = FSM_Closed; } @@ -244,7 +244,7 @@ static int send_conf_req(struct ppp_fsm_t *fsm) ipcp_hdr->code = CONFREQ; ipcp_hdr->id = ipcp->fsm.id; ipcp_hdr->len = 0; - + ptr += sizeof(*ipcp_hdr); list_for_each_entry(lopt, &ipcp->options, entry) { @@ -318,7 +318,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) ipcp_hdr->code = CONFNAK; ipcp_hdr->id = ipcp->fsm.recv_id; ipcp_hdr->len = 0; - + ptr += sizeof(*ipcp_hdr); list_for_each_entry(ropt, &ipcp->ropt_list, entry) { @@ -331,7 +331,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) } } } - + if (conf_ppp_verbose) log_ppp_info2("]\n"); @@ -407,7 +407,7 @@ static int ipcp_recv_conf_req(struct ppp_ipcp_t *ipcp, uint8_t *data, int size) data += hdr->len; size -= hdr->len; } - + list_for_each_entry(lopt, &ipcp->options, entry) lopt->state=IPCP_OPT_NONE; @@ -454,7 +454,7 @@ static int ipcp_recv_conf_req(struct ppp_ipcp_t *ipcp, uint8_t *data, int size) if (r < ret) ret = r; break; - } + } } if (!ropt->lopt) { ropt->state = IPCP_OPT_REJ; @@ -504,7 +504,7 @@ static int ipcp_recv_conf_rej(struct ppp_ipcp_t *ipcp, uint8_t *data, int size) while (size > 0) { hdr = (struct ipcp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -545,7 +545,7 @@ static int ipcp_recv_conf_nak(struct ppp_ipcp_t *ipcp, uint8_t *data, int size) while (size > 0) { hdr = (struct ipcp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -588,7 +588,7 @@ static int ipcp_recv_conf_ack(struct ppp_ipcp_t *ipcp, uint8_t *data, int size) while (size > 0) { hdr = (struct ipcp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -644,7 +644,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm) if (conf_ppp_verbose) log_ppp_info2("send [IPCP TermAck id=%x]\n", hdr.id); - + ppp_unit_send(ipcp->ppp, &hdr, 6); } @@ -675,12 +675,12 @@ static void ipcp_recv(struct ppp_handler_t*h) log_ppp_warn("IPCP: short packet received\n"); return; } - + if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && hdr->id != ipcp->fsm.id) return; ipcp->fsm.recv_id = hdr->id; - + switch(hdr->code) { case CONFREQ: r = ipcp_recv_conf_req(ipcp,(uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN); @@ -763,7 +763,7 @@ static void ipcp_recv_proto_rej(struct ppp_handler_t*h) if (ipcp->fsm.fsm_state == FSM_Initial || ipcp->fsm.fsm_state == FSM_Closed) return; - + ppp_fsm_lower_down(&ipcp->fsm); ppp_fsm_close(&ipcp->fsm); } @@ -773,9 +773,9 @@ int ipcp_option_register(struct ipcp_option_handler_t *h) /*struct ipcp_option_drv_t *p; list_for_each_entry(p,option_drv_list,entry) - if (p->id==h->id) + if (p->id==h->id) return -1;*/ - + list_add_tail(&h->entry, &option_handlers); return 0; @@ -785,11 +785,11 @@ struct ipcp_option_t *ipcp_find_option(struct ppp_t *ppp, struct ipcp_option_han { struct ppp_ipcp_t *ipcp = container_of(ppp_find_layer_data(ppp, &ipcp_layer), typeof(*ipcp), ld); struct ipcp_option_t *opt; - + list_for_each_entry(opt, &ipcp->options, entry) if (opt->h == h) return opt; - + log_emerg("ipcp: BUG: option not found\n"); abort(); } diff --git a/accel-pppd/ppp/ppp_ipcp.h b/accel-pppd/ppp/ppp_ipcp.h index 74127020..a46d9b6d 100644 --- a/accel-pppd/ppp/ppp_ipcp.h +++ b/accel-pppd/ppp/ppp_ipcp.h @@ -91,7 +91,7 @@ struct ppp_ipcp_t struct list_head ropt_list; // last received ConfReq int ropt_len; - + int conf_req_len; int starting:1; int started:1; diff --git a/accel-pppd/ppp/ppp_ipv6cp.c b/accel-pppd/ppp/ppp_ipv6cp.c index 9a879227..1194b314 100644 --- a/accel-pppd/ppp/ppp_ipv6cp.c +++ b/accel-pppd/ppp/ppp_ipv6cp.c @@ -54,7 +54,7 @@ static void ipv6cp_options_init(struct ppp_ipv6cp_t *ipv6cp) struct ipv6cp_option_handler_t *h; ipv6cp->conf_req_len = sizeof(struct ipv6cp_hdr_t); - + list_for_each_entry(h,&option_handlers,entry) { lopt = h->init(ipv6cp); if (lopt) { @@ -80,16 +80,16 @@ static struct ppp_layer_data_t *ipv6cp_layer_init(struct ppp_t *ppp) { struct ppp_ipv6cp_t *ipv6cp = _malloc(sizeof(*ipv6cp)); memset(ipv6cp, 0, sizeof(*ipv6cp)); - + log_ppp_debug("ipv6cp_layer_init\n"); ipv6cp->ppp = ppp; ipv6cp->fsm.ppp = ppp; - + ipv6cp->hnd.proto = PPP_IPV6CP; ipv6cp->hnd.recv = ipv6cp_recv; ipv6cp->hnd.recv_proto_rej = ipv6cp_recv_proto_rej; - + ppp_register_unit_handler(ppp, &ipv6cp->hnd); ipv6cp->fsm.proto = PPP_IPV6CP; @@ -109,7 +109,7 @@ static struct ppp_layer_data_t *ipv6cp_layer_init(struct ppp_t *ppp) INIT_LIST_HEAD(&ipv6cp->ropt_list); ipv6cp->ld.passive = conf_ipv6 == IPV6_ALLOW || conf_ipv6 == IPV6_DENY; - + return &ipv6cp->ld; } @@ -118,7 +118,7 @@ static void ipv6cp_start_timeout(struct triton_timer_t *t) struct ppp_ipv6cp_t *ipv6cp = container_of(t, typeof(*ipv6cp), timeout); triton_timer_del(t); - + if (ipv6cp->ppp->ses.state == AP_STATE_STARTING) ap_session_terminate(&ipv6cp->ppp->ses, TERM_USER_ERROR, 0); } @@ -126,7 +126,7 @@ static void ipv6cp_start_timeout(struct triton_timer_t *t) int ipv6cp_layer_start(struct ppp_layer_data_t *ld) { struct ppp_ipv6cp_t *ipv6cp = container_of(ld, typeof(*ipv6cp), ld); - + log_ppp_debug("ipv6cp_layer_start\n"); ipv6cp_options_init(ipv6cp); @@ -144,18 +144,18 @@ int ipv6cp_layer_start(struct ppp_layer_data_t *ld) return -1; } } - + return 0; } void ipv6cp_layer_finish(struct ppp_layer_data_t *ld) { struct ppp_ipv6cp_t *ipv6cp = container_of(ld, typeof(*ipv6cp), ld); - + log_ppp_debug("ipv6cp_layer_finish\n"); ipv6cp->fsm.fsm_state = FSM_Closed; - + log_ppp_debug("ipv6cp_layer_finished\n"); ppp_layer_finished(ipv6cp->ppp, &ipv6cp->ld); } @@ -163,9 +163,9 @@ void ipv6cp_layer_finish(struct ppp_layer_data_t *ld) void ipv6cp_layer_free(struct ppp_layer_data_t *ld) { struct ppp_ipv6cp_t *ipv6cp = container_of(ld, typeof(*ipv6cp), ld); - + log_ppp_debug("ipv6cp_layer_free\n"); - + ppp_unregister_handler(ipv6cp->ppp, &ipv6cp->hnd); ipv6cp_options_free(ipv6cp); ppp_fsm_free(&ipv6cp->fsm); @@ -189,7 +189,7 @@ static void __ipv6cp_layer_up(struct ppp_ipv6cp_t *ipv6cp) static void ipv6cp_layer_up(struct ppp_fsm_t *fsm) { struct ppp_ipv6cp_t *ipv6cp = container_of(fsm, typeof(*ipv6cp), fsm); - + if (!ipv6cp->delay_ack) __ipv6cp_layer_up(ipv6cp); } @@ -207,7 +207,7 @@ static void ipv6cp_layer_finished(struct ppp_fsm_t *fsm) ppp_layer_passive(ipv6cp->ppp, &ipv6cp->ld); } else if (!ipv6cp->ppp->ses.terminating) ap_session_terminate(&ipv6cp->ppp->ses, TERM_USER_ERROR, 0); - + fsm->fsm_state = FSM_Closed; } @@ -244,7 +244,7 @@ static int send_conf_req(struct ppp_fsm_t *fsm) ipv6cp_hdr->code = CONFREQ; ipv6cp_hdr->id = ipv6cp->fsm.id; ipv6cp_hdr->len = 0; - + ptr += sizeof(*ipv6cp_hdr); list_for_each_entry(lopt, &ipv6cp->options, entry) { @@ -318,7 +318,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) ipv6cp_hdr->code = CONFNAK; ipv6cp_hdr->id = ipv6cp->fsm.recv_id; ipv6cp_hdr->len = 0; - + ptr += sizeof(*ipv6cp_hdr); list_for_each_entry(ropt, &ipv6cp->ropt_list, entry) { @@ -331,7 +331,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) } } } - + if (conf_ppp_verbose) log_ppp_info2("]\n"); @@ -407,7 +407,7 @@ static int ipv6cp_recv_conf_req(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int data += hdr->len; size -= hdr->len; } - + list_for_each_entry(lopt, &ipv6cp->options, entry) lopt->state=IPV6CP_OPT_NONE; @@ -454,7 +454,7 @@ static int ipv6cp_recv_conf_req(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int if (r < ret) ret = r; break; - } + } } if (!ropt->lopt) { ropt->state = IPV6CP_OPT_REJ; @@ -504,7 +504,7 @@ static int ipv6cp_recv_conf_rej(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int while (size > 0) { hdr = (struct ipv6cp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -545,7 +545,7 @@ static int ipv6cp_recv_conf_nak(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int while (size > 0) { hdr = (struct ipv6cp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -588,7 +588,7 @@ static int ipv6cp_recv_conf_ack(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int while (size > 0) { hdr = (struct ipv6cp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -644,7 +644,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm) if (conf_ppp_verbose) log_ppp_info2("send [IPV6CP TermAck id=%x]\n", hdr.id); - + ppp_unit_send(ipv6cp->ppp, &hdr, 6); } @@ -675,12 +675,12 @@ static void ipv6cp_recv(struct ppp_handler_t*h) log_ppp_warn("IPV6CP: short packet received\n"); return; } - + if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && hdr->id != ipv6cp->fsm.id) return; ipv6cp->fsm.recv_id = hdr->id; - + switch(hdr->code) { case CONFREQ: r = ipv6cp_recv_conf_req(ipv6cp,(uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN); @@ -763,7 +763,7 @@ static void ipv6cp_recv_proto_rej(struct ppp_handler_t*h) if (ipv6cp->fsm.fsm_state == FSM_Initial || ipv6cp->fsm.fsm_state == FSM_Closed) return; - + ppp_fsm_lower_down(&ipv6cp->fsm); ppp_fsm_close(&ipv6cp->fsm); } @@ -773,9 +773,9 @@ int ipv6cp_option_register(struct ipv6cp_option_handler_t *h) /*struct ipv6cp_option_drv_t *p; list_for_each_entry(p,option_drv_list,entry) - if (p->id==h->id) + if (p->id==h->id) return -1;*/ - + list_add_tail(&h->entry, &option_handlers); return 0; @@ -785,11 +785,11 @@ struct ipv6cp_option_t *ipv6cp_find_option(struct ppp_t *ppp, struct ipv6cp_opti { struct ppp_ipv6cp_t *ipv6cp = container_of(ppp_find_layer_data(ppp, &ipv6cp_layer), typeof(*ipv6cp), ld); struct ipv6cp_option_t *opt; - + list_for_each_entry(opt, &ipv6cp->options, entry) if (opt->h == h) return opt; - + log_emerg("ipv6cp: BUG: option not found\n"); abort(); } diff --git a/accel-pppd/ppp/ppp_ipv6cp.h b/accel-pppd/ppp/ppp_ipv6cp.h index 6f676053..57bb73b4 100644 --- a/accel-pppd/ppp/ppp_ipv6cp.h +++ b/accel-pppd/ppp/ppp_ipv6cp.h @@ -97,7 +97,7 @@ struct ppp_ipv6cp_t struct list_head ropt_list; // last received ConfReq int ropt_len; - + int conf_req_len; int starting:1; int started:1; diff --git a/accel-pppd/ppp/ppp_lcp.c b/accel-pppd/ppp/ppp_lcp.c index 3dd8708b..2641cf34 100644 --- a/accel-pppd/ppp/ppp_lcp.c +++ b/accel-pppd/ppp/ppp_lcp.c @@ -80,15 +80,15 @@ static struct ppp_layer_data_t *lcp_layer_init(struct ppp_t *ppp) { struct ppp_lcp_t *lcp = _malloc(sizeof(*lcp)); memset(lcp, 0, sizeof(*lcp)); - + log_ppp_debug("lcp_layer_init\n"); lcp->ppp = ppp; lcp->fsm.ppp = ppp; - + lcp->hnd.proto = PPP_LCP; lcp->hnd.recv = lcp_recv; - + ppp_register_chan_handler(ppp, &lcp->hnd); lcp->fsm.proto = PPP_LCP; @@ -113,14 +113,14 @@ static struct ppp_layer_data_t *lcp_layer_init(struct ppp_t *ppp) int lcp_layer_start(struct ppp_layer_data_t *ld) { struct ppp_lcp_t *lcp = container_of(ld, typeof(*lcp), ld); - + log_ppp_debug("lcp_layer_start\n"); lcp_options_init(lcp); ppp_fsm_lower_up(&lcp->fsm); if (ppp_fsm_open(&lcp->fsm)) return -1; - + return 0; } @@ -132,7 +132,7 @@ static void _lcp_layer_finished(struct ppp_lcp_t *lcp) void lcp_layer_finish(struct ppp_layer_data_t *ld) { struct ppp_lcp_t *lcp = container_of(ld,typeof(*lcp),ld); - + log_ppp_debug("lcp_layer_finish\n"); if (lcp->started) { @@ -145,7 +145,7 @@ void lcp_layer_finish(struct ppp_layer_data_t *ld) void lcp_layer_free(struct ppp_layer_data_t *ld) { struct ppp_lcp_t *lcp = container_of(ld, typeof(*lcp), ld); - + log_ppp_debug("lcp_layer_free\n"); stop_echo(lcp); @@ -153,7 +153,7 @@ void lcp_layer_free(struct ppp_layer_data_t *ld) lcp_options_free(lcp); ppp_fsm_free(&lcp->fsm); triton_cancel_call(lcp->ppp->ses.ctrl->ctx, (triton_event_func)_lcp_layer_finished); - + _free(lcp); } @@ -219,7 +219,7 @@ static int send_conf_req(struct ppp_fsm_t *fsm) lcp_hdr->code = CONFREQ; lcp_hdr->id = lcp->fsm.id; lcp_hdr->len = 0; - + ptr += sizeof(*lcp_hdr); list_for_each_entry(lopt, &lcp->options, entry) { @@ -232,7 +232,7 @@ static int send_conf_req(struct ppp_fsm_t *fsm) } else lopt->print = 0; } - + if (conf_ppp_verbose) { log_ppp_info2("send [LCP ConfReq id=%x", lcp_hdr->id); list_for_each_entry(lopt,&lcp->options,entry) { @@ -293,13 +293,13 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) lcp_hdr->code = CONFNAK; lcp_hdr->id = lcp->fsm.recv_id; lcp_hdr->len = 0; - + ptr += sizeof(*lcp_hdr); list_for_each_entry(lopt, &lcp->options, entry) { if (lopt->state == LCP_OPT_NAK) { n = lopt->h->send_conf_nak(lcp, lopt, ptr); - + if (conf_ppp_verbose && n) { log_ppp_info2(" "); lopt->h->print(log_ppp_info2, lopt, ptr); @@ -308,7 +308,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) ptr += n; } } - + if (conf_ppp_verbose) log_ppp_info2("]\n"); @@ -385,7 +385,7 @@ static int lcp_recv_conf_req(struct ppp_lcp_t *lcp, uint8_t *data, int size) data += hdr->len; size -= hdr->len; } - + list_for_each_entry(lopt, &lcp->options, entry) lopt->state = LCP_OPT_NONE; @@ -465,7 +465,7 @@ static int lcp_recv_conf_rej(struct ppp_lcp_t *lcp, uint8_t *data, int size) if (!hdr->len || hdr->len > size) break; - + list_for_each_entry(lopt, &lcp->options, entry) { if (lopt->id == hdr->id) { if (conf_ppp_verbose) { @@ -510,7 +510,7 @@ static int lcp_recv_conf_nak(struct ppp_lcp_t *lcp, uint8_t *data, int size) if (!hdr->len || hdr->len > size) break; - + list_for_each_entry(lopt,&lcp->options,entry) { if (lopt->id == hdr->id) { if (conf_ppp_verbose) { @@ -553,7 +553,7 @@ static int lcp_recv_conf_ack(struct ppp_lcp_t *lcp, uint8_t *data, int size) if (!hdr->len || hdr->len > size) break; - + list_for_each_entry(lopt, &lcp->options, entry) { if (lopt->id == hdr->id) { if (conf_ppp_verbose) { @@ -730,7 +730,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm) if (conf_ppp_verbose) log_ppp_info2("send [LCP TermAck id=%i]\n", hdr.id); - + ppp_chan_send(lcp->ppp, &hdr, 6); } @@ -761,13 +761,13 @@ static void lcp_recv(struct ppp_handler_t*h) struct ppp_lcp_t *lcp = container_of(h, typeof(*lcp), hnd); int r; char *term_msg; - + if (lcp->ppp->buf_size < PPP_HEADERLEN + 2) { log_ppp_warn("LCP: short packet received\n"); return; } - hdr = (struct lcp_hdr_t *)lcp->ppp->buf; + hdr = (struct lcp_hdr_t *)lcp->ppp->buf; if (ntohs(hdr->len) < PPP_HEADERLEN) { log_ppp_warn("LCP: short packet received\n"); return; @@ -775,7 +775,7 @@ static void lcp_recv(struct ppp_handler_t*h) if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && hdr->id != lcp->fsm.id) return; - + if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && lcp->started) return; @@ -887,9 +887,9 @@ int lcp_option_register(struct lcp_option_handler_t *h) /*struct lcp_option_drv_t *p; list_for_each_entry(p,option_drv_list,entry) - if (p->id==h->id) + if (p->id==h->id) return -1;*/ - + list_add_tail(&h->entry, &option_handlers); return 0; @@ -922,7 +922,7 @@ static void load_config(void) opt = conf_get_opt("ppp", "lcp-echo-failure"); if (opt && atoi(opt) >= 0) conf_echo_failure = atoi(opt); - + opt = conf_get_opt("ppp", "lcp-echo-timeout"); if (opt && atoi(opt) >= 0) conf_echo_timeout = atoi(opt); diff --git a/accel-pppd/ppp/ppp_lcp.h b/accel-pppd/ppp/ppp_lcp.h index 465f0e9a..cfc81229 100644 --- a/accel-pppd/ppp/ppp_lcp.h +++ b/accel-pppd/ppp/ppp_lcp.h @@ -125,7 +125,7 @@ struct ppp_lcp_t struct list_head ropt_list; // last received ConfReq int ropt_len; - + int conf_req_len; int started:1; }; diff --git a/accel-pppd/ppp/ppp_pd.c b/accel-pppd/ppp/ppp_pd.c index f7702083..c33ae968 100644 --- a/accel-pppd/ppp/ppp_pd.c +++ b/accel-pppd/ppp/ppp_pd.c @@ -9,6 +9,6 @@ int ppp_store_pd(struct ppp_t *ppp, pd_key_t key, void *data) list_for_each_entry(pd, &ppp->pd_list, entry) if (pd->key == key) return -1; - + } diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c index 7ac6e394..3d194474 100644 --- a/accel-pppd/radius/acct.c +++ b/accel-pppd/radius/acct.c @@ -23,7 +23,7 @@ static int req_set_RA(struct rad_req_t *req, const char *secret) { MD5_CTX ctx; - + if (rad_packet_build(req->pack, req->RA)) return -1; @@ -41,7 +41,7 @@ static int req_set_stat(struct rad_req_t *req, struct ap_session *ses) struct radius_pd_t *rpd = req->rpd; struct timespec ts; int ret = 0; - + if (ses->stop_time) ts.tv_sec = ses->stop_time; else @@ -68,7 +68,7 @@ static void rad_acct_sent(struct rad_req_t *req, int res) return; __sync_add_and_fetch(&req->serv->stat_interim_sent, 1); - + if (!req->hnd.tpd) triton_md_register_handler(req->rpd->ses->ctrl->ctx, &req->hnd); @@ -82,7 +82,7 @@ static void rad_acct_sent(struct rad_req_t *req, int res) static void rad_acct_recv(struct rad_req_t *req) { - int dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + + int dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + (req->reply->tv.tv_nsec - req->pack->tv.tv_nsec) / 1000000; stat_accm_add(req->serv->stat_interim_query_1m, dt); @@ -91,7 +91,7 @@ static void rad_acct_recv(struct rad_req_t *req) triton_timer_del(&req->timeout); triton_md_unregister_handler(&req->hnd, 1); - + rad_packet_free(req->reply); req->reply = NULL; } @@ -101,7 +101,7 @@ static void rad_acct_timeout(struct triton_timer_t *t) struct rad_req_t *req = container_of(t, typeof(*req), timeout); time_t dt; struct timespec ts; - + rad_server_req_exit(req); rad_server_timeout(req->serv); @@ -134,8 +134,8 @@ static void rad_acct_timeout(struct triton_timer_t *t) } if (conf_acct_delay_time) - req->pack->id++; - + req->pack->id++; + req->try = 0; if (rad_req_send(req) && conf_acct_timeout) { @@ -152,7 +152,7 @@ static void rad_acct_interim_update(struct triton_timer_t *t) if (rpd->acct_req->entry.next || rpd->acct_req->timeout.tpd) return; - if (rpd->session_timeout.expire_tv.tv_sec && + if (rpd->session_timeout.expire_tv.tv_sec && rpd->session_timeout.expire_tv.tv_sec - (_time() - rpd->ses->start_time) < INTERIM_SAFE_TIME) return; @@ -170,7 +170,7 @@ static void rad_acct_interim_update(struct triton_timer_t *t) if (!rpd->acct_req->before_send) req_set_RA(rpd->acct_req, rpd->acct_req->serv->secret); - + rpd->acct_req->timeout.expire_tv.tv_sec = conf_timeout; rpd->acct_req->try = 0; @@ -185,7 +185,7 @@ static int rad_acct_before_send(struct rad_req_t *req) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - + rad_packet_change_int(req->pack, NULL, "Acct-Delay-Time", ts.tv_sec - req->ts); req_set_RA(req, req->serv->secret); @@ -198,12 +198,12 @@ static void rad_acct_start_sent(struct rad_req_t *req, int res) ap_session_terminate(req->rpd->ses, TERM_NAS_ERROR, 0); return; } - + __sync_add_and_fetch(&req->serv->stat_acct_sent, 1); - + if (!req->hnd.tpd) triton_md_register_handler(req->rpd->ses->ctrl->ctx, &req->hnd); - + triton_md_enable_handler(&req->hnd, MD_MODE_READ); if (req->timeout.tpd) @@ -215,7 +215,7 @@ static void rad_acct_start_sent(struct rad_req_t *req, int res) static void rad_acct_start_recv(struct rad_req_t *req) { struct radius_pd_t *rpd = req->rpd; - int dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + + int dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + (req->reply->tv.tv_nsec - req->pack->tv.tv_nsec) / 1000000; stat_accm_add(req->serv->stat_acct_query_1m, dt); @@ -224,7 +224,7 @@ static void rad_acct_start_recv(struct rad_req_t *req) triton_timer_del(&req->timeout); triton_md_unregister_handler(&req->hnd, 1); - + if (rpd->acct_interim_interval) { rad_packet_free(req->reply); req->reply = NULL; @@ -244,20 +244,20 @@ static void rad_acct_start_recv(struct rad_req_t *req) } rpd->acct_started = 1; - + ap_session_accounting_started(rpd->ses); } static void rad_acct_start_timeout(struct triton_timer_t *t) { struct rad_req_t *req = container_of(t, typeof(*req), timeout); - + rad_server_timeout(req->serv); __sync_add_and_fetch(&req->serv->stat_acct_lost, 1); stat_accm_add(req->serv->stat_acct_lost_1m, 1); stat_accm_add(req->serv->stat_acct_lost_5m, 1); - + if (req->before_send) req->pack->id++; @@ -281,7 +281,7 @@ int rad_acct_start(struct radius_pd_t *rpd) req->before_send = rad_acct_before_send; else if (req_set_RA(req, req->serv->secret)) goto out_err; - + req->recv = rad_acct_start_recv; req->timeout.expire = rad_acct_start_timeout; req->timeout.expire_tv.tv_sec = conf_timeout; @@ -290,7 +290,7 @@ int rad_acct_start(struct radius_pd_t *rpd) if (rad_req_send(req)) goto out_err; - + rpd->acct_req = req; return 0; @@ -305,22 +305,22 @@ static void rad_acct_stop_sent(struct rad_req_t *req, int res) if (res) { if (ap_shutdown) { struct radius_pd_t *rpd = req->rpd; - + rad_req_free(req); - + if (rpd) rpd->acct_req = NULL; } else if (req->rpd) rad_acct_stop_defer(req->rpd); - + return; } - + __sync_add_and_fetch(&req->serv->stat_acct_sent, 1); - + if (!req->hnd.tpd) triton_md_register_handler(req->rpd ? req->rpd->ses->ctrl->ctx : NULL, &req->hnd); - + triton_md_enable_handler(&req->hnd, MD_MODE_READ); if (req->timeout.tpd) @@ -332,7 +332,7 @@ static void rad_acct_stop_sent(struct rad_req_t *req, int res) static void rad_acct_stop_recv(struct rad_req_t *req) { struct radius_pd_t *rpd = req->rpd; - int dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + + int dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + (req->reply->tv.tv_nsec - req->pack->tv.tv_nsec) / 1000000; stat_accm_add(req->serv->stat_acct_query_1m, dt); @@ -360,7 +360,7 @@ static void rad_acct_stop_timeout(struct triton_timer_t *t) __sync_add_and_fetch(&req->serv->stat_acct_lost, 1); stat_accm_add(req->serv->stat_acct_lost_1m, 1); stat_accm_add(req->serv->stat_acct_lost_5m, 1); - + if (req->before_send) req->pack->id++; } @@ -388,7 +388,7 @@ static void start_deferred(struct rad_req_t *req) if (rad_req_read(&req->hnd)) return; } - + triton_timer_add(NULL, &req->timeout, 0); } @@ -416,7 +416,7 @@ int rad_acct_stop(struct radius_pd_t *rpd) if (rpd->acct_interim_timer.tpd) triton_timer_del(&rpd->acct_interim_timer); - if (req) { + if (req) { rad_server_req_cancel(req, 1); clock_gettime(CLOCK_MONOTONIC, &ts); @@ -426,7 +426,7 @@ int rad_acct_stop(struct radius_pd_t *rpd) req = rad_req_alloc(rpd, CODE_ACCOUNTING_REQUEST, rpd->ses->username); if (!req) return -1; - + if (rad_req_acct_fill(req)) { log_ppp_error("radius:acct: failed to fill accounting attributes\n"); rad_req_free(req); @@ -470,13 +470,13 @@ int rad_acct_stop(struct radius_pd_t *rpd) rad_packet_change_val(req->pack, NULL, "Acct-Status-Type", "Stop"); req_set_stat(req, rpd->ses); req_set_RA(req, req->serv->secret); - + req->recv = rad_acct_stop_recv; req->timeout.expire = rad_acct_start_timeout; req->timeout.expire_tv.tv_sec = conf_timeout; req->sent = rad_acct_stop_sent; req->log = conf_verbose ? log_ppp_info1 : NULL; - + if (rad_req_send(req)) { rad_acct_stop_defer(rpd); return -1; diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 43dec233..fbc2fab5 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -22,7 +22,7 @@ static int decrypt_chap_mppe_keys(struct rad_req_t *req, struct rad_attr_t *attr uint8_t sha1[SHA_DIGEST_LENGTH]; uint8_t plain[32]; int i; - + if (attr->len != 32) { log_ppp_warn("radius: %s: incorrect attribute length (%i)\n", attr->attr->name, attr->len); return -1; @@ -37,7 +37,7 @@ static int decrypt_chap_mppe_keys(struct rad_req_t *req, struct rad_attr_t *attr for (i = 0; i < 16; i++) plain[i] ^= md5[i]; - + MD5_Init(&md5_ctx); MD5_Update(&md5_ctx, req->serv->secret, strlen(req->serv->secret)); MD5_Update(&md5_ctx, attr->val.octets, 16); @@ -45,7 +45,7 @@ static int decrypt_chap_mppe_keys(struct rad_req_t *req, struct rad_attr_t *attr for (i = 0; i < 16; i++) plain[i + 16] ^= md5[i]; - + SHA1_Init(&sha1_ctx); SHA1_Update(&sha1_ctx, plain + 8, 16); SHA1_Update(&sha1_ctx, plain + 8, 16); @@ -63,7 +63,7 @@ static int decrypt_mppe_key(struct rad_req_t *req, struct rad_attr_t *attr, uint uint8_t md5[16]; uint8_t plain[32]; int i; - + if (attr->len != 34) { log_ppp_warn("radius: %s: incorrect attribute length (%i)\n", attr->attr->name, attr->len); return -1; @@ -84,7 +84,7 @@ static int decrypt_mppe_key(struct rad_req_t *req, struct rad_attr_t *attr, uint for (i = 0; i < 16; i++) plain[i] ^= md5[i]; - + if (plain[0] != 16) { log_ppp_warn("radius: %s: incorrect key length (%i)\n", attr->attr->name, plain[0]); return -1; @@ -116,7 +116,7 @@ static uint8_t* encrypt_password(const char *passwd, const char *secret, const u *epasswd_len = 0; return (uint8_t *)1; } - + epasswd = _malloc(chunk_cnt * 16); if (!epasswd) { log_emerg("radius: out of memory\n"); @@ -132,7 +132,7 @@ static uint8_t* encrypt_password(const char *passwd, const char *secret, const u MD5_Update(&ctx, secret, strlen(secret)); MD5_Update(&ctx, c, 16); MD5_Final(b, &ctx); - + for(j = 0; j < 16; j++) epasswd[i * 16 + j] ^= b[j]; @@ -164,17 +164,17 @@ static void rad_auth_recv(struct rad_req_t *req) unsigned int dt; triton_timer_del(&req->timeout); - + dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 + (req->reply->tv.tv_nsec - req->pack->tv.tv_nsec) / 1000000; stat_accm_add(req->serv->stat_auth_query_1m, dt); stat_accm_add(req->serv->stat_auth_query_5m, dt); - + if (pack->code == CODE_ACCESS_ACCEPT) { if (rad_proc_attrs(req)) { rad_auth_finalize(req->rpd, PWDB_DENIED); return; } - + struct ev_radius_t ev = { .ses = req->rpd->ses, .request = req->pack, @@ -185,14 +185,14 @@ static void rad_auth_recv(struct rad_req_t *req) rad_auth_finalize(req->rpd, PWDB_DENIED); return; } - + if (req->rpd->auth_ctx->recv && req->rpd->auth_ctx->recv(req)) { rad_auth_finalize(req->rpd, PWDB_DENIED); return; } - + req->rpd->authenticated = 1; - + rad_auth_finalize(req->rpd, PWDB_SUCCESS); } @@ -201,7 +201,7 @@ static void rad_auth_timeout(struct triton_timer_t *t) struct rad_req_t *req = container_of(t, typeof(*req), timeout); rad_server_timeout(req->serv); - + __sync_add_and_fetch(&req->serv->stat_auth_lost, 1); stat_accm_add(req->serv->stat_auth_lost_1m, 1); stat_accm_add(req->serv->stat_auth_lost_5m, 1); @@ -216,14 +216,14 @@ static void rad_auth_sent(struct rad_req_t *req, int res) rad_auth_finalize(req->rpd, PWDB_DENIED); return; } - + __sync_add_and_fetch(&req->serv->stat_auth_sent, 1); - + if (!req->hnd.tpd) triton_md_register_handler(req->rpd->ses->ctrl->ctx, &req->hnd); - + triton_md_enable_handler(&req->hnd, MD_MODE_READ); - + if (req->timeout.tpd) triton_timer_mod(&req->timeout, 0); else @@ -233,10 +233,10 @@ static void rad_auth_sent(struct rad_req_t *req, int res) static struct rad_req_t *rad_auth_req_alloc(struct radius_pd_t *rpd, const char *username, int (*recv)(struct rad_req_t *)) { struct rad_req_t *req = rad_req_alloc(rpd, CODE_ACCESS_REQUEST, username); - + if (!req) return NULL; - + if (conf_sid_in_auth) { if (rad_packet_add_str(req->pack, NULL, "Acct-Session-Id", rpd->ses->sessionid)) goto out; @@ -275,7 +275,7 @@ int rad_auth_pap(struct radius_pd_t *rpd, const char *username, va_list args) if (!req) return PWDB_DENIED; - + epasswd = encrypt_password(passwd, req->serv->secret, req->RA, &epasswd_len); if (!epasswd) return PWDB_DENIED; @@ -283,7 +283,7 @@ int rad_auth_pap(struct radius_pd_t *rpd, const char *username, va_list args) r = rad_packet_add_octets(req->pack, NULL, "User-Password", epasswd, epasswd_len); if (epasswd_len) _free(epasswd); - + if (r) return PWDB_DENIED; @@ -301,7 +301,7 @@ int rad_auth_chap_md5(struct radius_pd_t *rpd, const char *username, va_list arg uint8_t *challenge = va_arg(args, uint8_t *); int challenge_len = va_arg(args, int); uint8_t *response = va_arg(args, uint8_t *); - + if (!req) return PWDB_DENIED; @@ -316,7 +316,7 @@ int rad_auth_chap_md5(struct radius_pd_t *rpd, const char *username, va_list arg if (rad_packet_add_octets(req->pack, NULL, "CHAP-Password", chap_password, 17)) return PWDB_DENIED; - + if (rad_req_send(req)) return PWDB_DENIED; @@ -410,10 +410,10 @@ int rad_auth_mschap_v1(struct radius_pd_t *rpd, const char *username, va_list ar if (rad_packet_add_octets(req->pack, "Microsoft", "MS-CHAP-Challenge", challenge, challenge_len)) return PWDB_DENIED; - + if (rad_packet_add_octets(req->pack, "Microsoft", "MS-CHAP-Response", response, sizeof(response))) return PWDB_DENIED; - + if (rad_req_send(req)) return PWDB_DENIED; @@ -481,10 +481,10 @@ int rad_auth_mschap_v2(struct radius_pd_t *rpd, const char *username, va_list ar if (rad_packet_add_octets(req->pack, "Microsoft", "MS-CHAP-Challenge", challenge, 16)) return PWDB_DENIED; - + if (rad_packet_add_octets(req->pack, "Microsoft", "MS-CHAP2-Response", mschap_response, sizeof(mschap_response))) return PWDB_DENIED; - + if (rad_req_send(req)) return PWDB_DENIED; @@ -494,7 +494,7 @@ int rad_auth_mschap_v2(struct radius_pd_t *rpd, const char *username, va_list ar int rad_auth_null(struct radius_pd_t *rpd, const char *username, va_list args) { struct rad_req_t *req = rad_auth_req_alloc(rpd, username, NULL); - + if (!req) return PWDB_DENIED; diff --git a/accel-pppd/radius/backup.c b/accel-pppd/radius/backup.c index a44a7606..93ab3eb0 100644 --- a/accel-pppd/radius/backup.c +++ b/accel-pppd/radius/backup.c @@ -40,29 +40,29 @@ static int session_save(struct ap_session *ses, struct backup_mod *m) return -2; add_tag(RAD_TAG_INTERIM_INTERVAL, &rpd->acct_interim_interval, 4); - + if (rpd->session_timeout.tpd) add_tag(RAD_TAG_SESSION_TIMEOUT, &session_timeout, 8); - + if (rpd->idle_timeout.tpd) add_tag(RAD_TAG_IDLE_TIMEOUT, &idle_timeout, 4); - + if (ses->ipv4 == &rpd->ipv4_addr) add_tag(RAD_TAG_IPV4_ADDR, NULL, 0); - + if (ses->ipv6 == &rpd->ipv6_addr) add_tag(RAD_TAG_IPV6_ADDR, NULL, 0); - + /*if (rpd->ipv6_pd_assigned) { }*/ if (rpd->attr_class) add_tag(RAD_TAG_ATTR_CLASS, rpd->attr_class, rpd->attr_class_len); - + if (rpd->attr_state) add_tag(RAD_TAG_ATTR_CLASS, rpd->attr_state, rpd->attr_state_len); - + add_tag(RAD_TAG_TERMINATION_ACTION, &rpd->termination_action, 4); if (rpd->acct_req) { @@ -109,7 +109,7 @@ void radius_restore_session(struct ap_session *ses, struct radius_pd_t *rpd) if (!m) return; - + list_for_each_entry(tag, &m->tag_list, entry) { switch (tag->id) { case RAD_TAG_INTERIM_INTERVAL: @@ -149,10 +149,10 @@ void radius_restore_session(struct ap_session *ses, struct radius_pd_t *rpd) break; } } - + if (acct_addr) rpd->acct_req = rad_req_alloc2(rpd, CODE_ACCOUNTING_REQUEST, rpd->ses->username, acct_addr, acct_port); - + rpd->authenticated = 1; } diff --git a/accel-pppd/radius/dict.c b/accel-pppd/radius/dict.c index 32af3445..7f4849cd 100644 --- a/accel-pppd/radius/dict.c +++ b/accel-pppd/radius/dict.c @@ -15,7 +15,7 @@ static struct rad_dict_t *dict; static char *skip_word(char *ptr) { for(; *ptr; ptr++) - if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') + if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') break; return ptr; } @@ -34,9 +34,9 @@ static int split(char *buf, char **ptr) buf = skip_word(buf); if (!*buf) return i; - + *buf = 0; - + buf = skip_space(buf + 1); if (!*buf) return i; @@ -82,7 +82,7 @@ static int dict_load(const char *fname) log_emerg("radius: open dictioanary '%s': %s\n", fname, strerror(errno)); return -1; } - + items = &dict->items; while (fgets(buf, BUF_SIZE, f)) { @@ -301,7 +301,7 @@ __export struct rad_dict_attr_t *rad_dict_find_attr_id(struct rad_dict_vendor_t { struct rad_dict_attr_t *attr; struct list_head *items = vendor ? &vendor->items : &dict->items; - + list_for_each_entry(attr, items, entry) if (attr->id == id) return attr; diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c index 0235ba4a..fd59bf11 100644 --- a/accel-pppd/radius/dm_coa.c +++ b/accel-pppd/radius/dm_coa.c @@ -36,7 +36,7 @@ static int dm_coa_check_RA(struct rad_packet_t *pack, const char *secret) MD5_CTX ctx; memset(RA, 0, 16); - + MD5_Init(&ctx); MD5_Update(&ctx, pack->buf, 4); MD5_Update(&ctx, RA, 16); @@ -69,7 +69,7 @@ static int dm_coa_send_ack(int fd, struct rad_packet_t *req, struct sockaddr_in return -1; reply->id = req->id; - + if (rad_packet_build(reply, RA)) { rad_packet_free(reply); return -1; @@ -83,7 +83,7 @@ static int dm_coa_send_ack(int fd, struct rad_packet_t *req, struct sockaddr_in } rad_packet_send(reply, fd, addr); - + rad_packet_free(reply); return 0; @@ -118,7 +118,7 @@ static int dm_coa_send_nak(int fd, struct rad_packet_t *req, struct sockaddr_in } rad_packet_send(reply, fd, addr); - + rad_packet_free(reply); return 0; @@ -135,7 +135,7 @@ static void disconnect_request(struct radius_pd_t *rpd) dm_coa_send_ack(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr); rad_packet_free(rpd->dm_coa_req); - + pthread_mutex_lock(&rpd->lock); rpd->dm_coa_req = NULL; pthread_mutex_unlock(&rpd->lock); @@ -183,7 +183,7 @@ static void coa_request(struct radius_pd_t *rpd) dm_coa_send_ack(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr); } - + rad_packet_free(rpd->dm_coa_req); pthread_mutex_lock(&rpd->lock); @@ -232,14 +232,14 @@ static int dm_coa_read(struct triton_md_handler_t *h) err_code = 403; goto out_err; } - + rpd = rad_find_session_pack(pack); if (!rpd) { log_warn("radius:dm_coa: session not found\n"); err_code = 503; goto out_err; } - + if (rpd->dm_coa_req) { pthread_mutex_unlock(&rpd->lock); goto out_err_no_reply; @@ -292,7 +292,7 @@ static void init(void) log_emerg("radius:dm_coa: socket: %s\n", strerror(errno)); return; } - + fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC); addr.sin_family = AF_INET; @@ -312,7 +312,7 @@ static void init(void) close(serv.hnd.fd); return; } - + triton_context_register(&serv.ctx, NULL); triton_md_register_handler(&serv.ctx, &serv.hnd); triton_md_enable_handler(&serv.hnd, MD_MODE_READ); diff --git a/accel-pppd/radius/packet.c b/accel-pppd/radius/packet.c index 87c337fe..92e43e2b 100644 --- a/accel-pppd/radius/packet.c +++ b/accel-pppd/radius/packet.c @@ -61,7 +61,7 @@ int rad_packet_build(struct rad_packet_t *pack, uint8_t *RA) log_emerg("radius:packet: out of memory\n"); return -1; } - + pack->buf = ptr; } else ptr = pack->buf; @@ -76,7 +76,7 @@ int rad_packet_build(struct rad_packet_t *pack, uint8_t *RA) *ptr = 26; ptr++; *ptr = attr->len + 2 + 6; ptr++; *(uint32_t *)ptr = htonl(attr->vendor->id); ptr+=4; - } + } *ptr = attr->attr->id; ptr++; *ptr = attr->len + 2; ptr++; switch(attr->attr->type) { @@ -133,7 +133,7 @@ int rad_packet_recv(int fd, struct rad_packet_t **p, struct sockaddr_in *addr) log_emerg("radius:packet: out of memory\n"); goto out_err; } - + pack->buf = ptr; clock_gettime(CLOCK_MONOTONIC, &pack->tv); @@ -225,7 +225,7 @@ int rad_packet_recv(int fd, struct rad_packet_t **p, struct sockaddr_in *addr) goto out_err; } memcpy(attr->val.octets, ptr, len); - break; + break; case ATTR_TYPE_DATE: case ATTR_TYPE_INTEGER: attr->val.integer = ntohl(*(uint32_t*)ptr); @@ -260,7 +260,7 @@ out_err: void rad_packet_free(struct rad_packet_t *pack) { struct rad_attr_t *attr; - + if (pack->buf) mempool_free(pack->buf); //munmap(pack->buf, REQ_LENGTH_MAX); @@ -286,7 +286,7 @@ void rad_packet_print(struct rad_packet_t *pack, struct rad_server_t *s, void (* uint16_t u16[4]; } ifid_u; in_addr_t addr; - + if (s) print("[RADIUS(%i) ", s->id); else @@ -392,7 +392,7 @@ int __export rad_packet_add_int(struct rad_packet_t *pack, const char *vendor_na if (!attr) return -1; - + ra = mempool_alloc(attr_pool); if (!ra) return -1; @@ -411,7 +411,7 @@ int __export rad_packet_add_int(struct rad_packet_t *pack, const char *vendor_na int __export rad_packet_change_int(struct rad_packet_t *pack, const char *vendor_name, const char *name, int val) { struct rad_attr_t *ra; - + ra = rad_packet_find_attr(pack, vendor_name, name); if (!ra) return -1; @@ -439,10 +439,10 @@ int __export rad_packet_add_octets(struct rad_packet_t *pack, const char *vendor vendor = NULL; attr = rad_dict_find_attr(name); } - + if (!attr) return -1; - + ra = mempool_alloc(attr_pool); if (!ra) { log_emerg("radius: out of memory\n"); @@ -473,7 +473,7 @@ int __export rad_packet_add_octets(struct rad_packet_t *pack, const char *vendor int __export rad_packet_change_octets(struct rad_packet_t *pack, const char *vendor_name, const char *name, const uint8_t *val, int len) { struct rad_attr_t *ra; - + ra = rad_packet_find_attr(pack, vendor_name, name); if (!ra) return -1; @@ -487,7 +487,7 @@ int __export rad_packet_change_octets(struct rad_packet_t *pack, const char *ven log_emerg("radius: out of memory\n"); return -1; } - + pack->len += len - ra->len; ra->len = len; } @@ -521,7 +521,7 @@ int __export rad_packet_add_str(struct rad_packet_t *pack, const char *vendor_na if (!attr) return -1; - + ra = mempool_alloc(attr_pool); if (!ra) { log_emerg("radius: out of memory\n"); @@ -549,7 +549,7 @@ int __export rad_packet_add_str(struct rad_packet_t *pack, const char *vendor_na int __export rad_packet_change_str(struct rad_packet_t *pack, const char *vendor_name, const char *name, const char *val, int len) { struct rad_attr_t *ra; - + ra = rad_packet_find_attr(pack, vendor_name, name); if (!ra) return -1; @@ -563,7 +563,7 @@ int __export rad_packet_change_str(struct rad_packet_t *pack, const char *vendor log_emerg("radius: out of memory\n"); return -1; } - + pack->len += len - ra->len; ra->len = len; } @@ -593,14 +593,14 @@ int __export rad_packet_add_val(struct rad_packet_t *pack, const char *vendor_na vendor = NULL; attr = rad_dict_find_attr(name); } - + if (!attr) return -1; v = rad_dict_find_val_name(attr, val); if (!v) return -1; - + ra = mempool_alloc(attr_pool); if (!ra) return -1; @@ -620,7 +620,7 @@ int __export rad_packet_change_val(struct rad_packet_t *pack, const char *vendor { struct rad_attr_t *ra; struct rad_dict_value_t *v; - + ra = rad_packet_find_attr(pack, vendor_name, name); if (!ra) return -1; @@ -630,7 +630,7 @@ int __export rad_packet_change_val(struct rad_packet_t *pack, const char *vendor return -1; ra->val = v->val; - + return 0; } @@ -660,7 +660,7 @@ int rad_packet_add_ifid(struct rad_packet_t *pack, const char *vendor_name, cons if (!attr) return -1; - + ra = mempool_alloc(attr_pool); if (!ra) return -1; @@ -697,7 +697,7 @@ int rad_packet_add_ipv6prefix(struct rad_packet_t *pack, const char *vendor_name if (!attr) return -1; - + ra = mempool_alloc(attr_pool); if (!ra) return -1; @@ -726,14 +726,14 @@ struct rad_attr_t __export *rad_packet_find_attr(struct rad_packet_t *pack, cons return NULL; } else vendor = NULL; - + list_for_each_entry(ra, &pack->attrs, entry) { if (vendor && vendor != ra->vendor) continue; if (strcmp(ra->attr->name, name)) continue; - + return ra; } diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index 02df42f5..83d6d07d 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -126,10 +126,10 @@ int rad_proc_attrs(struct rad_req_t *req) else if (rpd->attr_state_len != attr->len) rpd->attr_state = _realloc(rpd->attr_state, attr->len); memcpy(rpd->attr_state, attr->val.octets, attr->len); - rpd->attr_state_len = attr->len; + rpd->attr_state_len = attr->len; break; case Termination_Action: - rpd->termination_action = attr->val.integer; + rpd->termination_action = attr->val.integer; break; case Framed_Interface_Id: rpd->ipv6_addr.peer_intf_id = attr->val.ifid; @@ -157,7 +157,7 @@ int rad_proc_attrs(struct rad_req_t *req) if (wins.ses) triton_event_fire(EV_WINS, &wins); - + if (!rpd->ses->ipv6_dp && !list_empty(&rpd->ipv6_dp.prefix_list)) rpd->ses->ipv6_dp = &rpd->ipv6_dp; @@ -178,14 +178,14 @@ static int rad_pwdb_check(struct pwdb_t *pwdb, struct ap_session *ses, pwdb_call log_ppp_error("radius: username is too large to append realm\n"); return PWDB_DENIED; } - + memcpy(username1, username, len); username1[len] = '@'; memcpy(username1 + len + 1, conf_default_realm, conf_default_realm_len); username1[len + 1 + conf_default_realm_len] = 0; username = username1; } - + rpd->auth_ctx = mempool_alloc(auth_ctx_pool); memset(rpd->auth_ctx, 0, sizeof(*rpd->auth_ctx)); @@ -232,7 +232,7 @@ static int rad_pwdb_check(struct pwdb_t *pwdb, struct ap_session *ses, pwdb_call static struct ipv4db_item_t *get_ipv4(struct ap_session *ses) { struct radius_pd_t *rpd = find_pd(ses); - + if (rpd->ipv4_addr.peer_addr) return &rpd->ipv4_addr; return NULL; @@ -305,7 +305,7 @@ static void ses_starting(struct ap_session *ses) INIT_LIST_HEAD(&rpd->plugin_list); INIT_LIST_HEAD(&rpd->ipv6_addr.addr_list); INIT_LIST_HEAD(&rpd->ipv6_dp.prefix_list); - + rpd->ipv4_addr.owner = &ipdb; rpd->ipv6_addr.owner = &ipdb; rpd->ipv6_dp.owner = &ipdb; @@ -325,10 +325,10 @@ static void ses_starting(struct ap_session *ses) static void ses_acct_start(struct ap_session *ses) { struct radius_pd_t *rpd = find_pd(ses); - + if (!conf_accounting) return; - + if (!rpd->authenticated) return; @@ -402,13 +402,13 @@ static void ses_finished(struct ap_session *ses) if (rpd->session_timeout.tpd) triton_timer_del(&rpd->session_timeout); - + if (rpd->idle_timeout.tpd) triton_timer_del(&rpd->idle_timeout); if (rpd->attr_class) _free(rpd->attr_class); - + if (rpd->attr_state) _free(rpd->attr_state); @@ -425,7 +425,7 @@ static void ses_finished(struct ap_session *ses) } list_del(&rpd->pd.entry); - + release_pd(rpd); } @@ -458,7 +458,7 @@ void release_pd(struct radius_pd_t *rpd) struct radius_pd_t *rad_find_session(const char *sessionid, const char *username, const char *port_id, int port, in_addr_t ipaddr, const char *csid) { struct radius_pd_t *rpd; - + pthread_rwlock_rdlock(&sessions_lock); list_for_each_entry(rpd, &sessions, entry) { if (!rpd->ses->username) @@ -492,7 +492,7 @@ struct radius_pd_t *rad_find_session_pack(struct rad_packet_t *pack) int port = -1; const char *port_id = NULL; in_addr_t ipaddr = 0; - + list_for_each_entry(attr, &pack->attrs, entry) { if (attr->vendor) continue; @@ -523,7 +523,7 @@ struct radius_pd_t *rad_find_session_pack(struct rad_packet_t *pack) if (username && !sessionid && port == -1 && ipaddr == 0 && !port_id) return NULL; - + return rad_find_session(sessionid, username, port_id, port, ipaddr, csid); } @@ -532,7 +532,7 @@ int rad_check_nas_pack(struct rad_packet_t *pack) struct rad_attr_t *attr; const char *ident = NULL; in_addr_t ipaddr = 0; - + list_for_each_entry(attr, &pack->attrs, entry) { if (!strcmp(attr->attr->name, "NAS-Identifier")) ident = attr->val.string; @@ -548,7 +548,7 @@ int rad_check_nas_pack(struct rad_packet_t *pack) if (conf_nas_ip_address && ipaddr && conf_nas_ip_address != ipaddr) return -1; - + return 0; } @@ -586,9 +586,9 @@ static int parse_server(const char *opt, in_addr_t *addr, int *port, char **secr *p2 = 0; else return -1; - + *addr = inet_addr(str); - + if (p1) { *port = atoi(p1 + 1); if (*port <=0 ) @@ -600,7 +600,7 @@ static int parse_server(const char *opt, in_addr_t *addr, int *port, char **secr *secret = p1; if (p2) _free(p2); - + _free(str); return 0; @@ -613,7 +613,7 @@ static int load_config(void) opt = conf_get_opt("radius", "max-try"); if (opt && atoi(opt) > 0) conf_max_try = atoi(opt); - + opt = conf_get_opt("radius", "timeout"); if (opt && atoi(opt) > 0) conf_timeout = atoi(opt); @@ -633,7 +633,7 @@ static int load_config(void) opt = conf_get_opt("radius", "nas-ip-address"); if (opt) conf_nas_ip_address = inet_addr(opt); - + if (conf_nas_identifier) _free(conf_nas_identifier); opt = conf_get_opt("radius", "nas-identifier"); @@ -641,7 +641,7 @@ static int load_config(void) conf_nas_identifier = _strdup(opt); else conf_nas_identifier = NULL; - + opt = conf_get_opt("radius", "gw-ip-address"); if (opt) conf_gw_ip_address = inet_addr(opt); @@ -661,11 +661,11 @@ static int load_config(void) opt = conf_get_opt("radius", "sid_in_auth"); if (opt) conf_sid_in_auth = atoi(opt); - + opt = conf_get_opt("radius", "require-nas-identification"); if (opt) conf_require_nas_ident = atoi(opt); - + opt = conf_get_opt("radius", "acct-interim-interval"); if (opt && atoi(opt) > 0) conf_acct_interim_interval = atoi(opt); @@ -675,7 +675,7 @@ static int load_config(void) conf_acct_delay_time = atoi(opt); conf_attr_tunnel_type = conf_get_opt("radius", "attr-tunnel-type"); - + conf_default_realm = conf_get_opt("radius", "default-realm"); if (conf_default_realm) conf_default_realm_len = strlen(conf_default_realm); @@ -695,7 +695,7 @@ static void radius_init(void) if (load_config()) _exit(EXIT_FAILURE); - + list_for_each_entry(opt1, &s->items, entry) { if (strcmp(opt1->name, "dictionary") || !opt1->val) continue; diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h index 6f1be672..9687f820 100644 --- a/accel-pppd/radius/radius_p.h +++ b/accel-pppd/radius/radius_p.h @@ -70,9 +70,9 @@ struct rad_req_t { struct radius_pd_t *rpd; struct rad_server_t *serv; - + in_addr_t server_addr; - + int server_port; int type:8; int try:6; @@ -214,7 +214,7 @@ int rad_server_realloc(struct rad_req_t *); void rad_server_fail(struct rad_server_t *); void rad_server_timeout(struct rad_server_t *); void rad_server_reply(struct rad_server_t *); - + void radius_restore_session(struct ap_session *ses, struct radius_pd_t *rpd); struct rtnl_link_stats; diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index 129116b7..a2cf6a77 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -50,7 +50,7 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons if (!req->serv) goto out_err; - + req->server_addr = req->serv->addr; req->server_port = req->serv->auth_port; @@ -73,7 +73,7 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons if (rad_packet_add_str(req->pack, NULL, "User-Name", username)) goto out_err; - + if (conf_nas_identifier) if (rad_packet_add_str(req->pack, NULL, "NAS-Identifier", conf_nas_identifier)) goto out_err; @@ -84,10 +84,10 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons if (rad_packet_add_int(req->pack, NULL, "NAS-Port", rpd->ses->unit_idx)) goto out_err; - + if (rad_packet_add_str(req->pack, NULL, "NAS-Port-Id", rpd->ses->ifname)) goto out_err; - + if (req->rpd->ses->ctrl->type == CTRL_TYPE_IPOE) { if (rad_packet_add_val(req->pack, NULL, "NAS-Port-Type", "Ethernet")) goto out_err; @@ -105,15 +105,15 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons if (rpd->ses->ctrl->calling_station_id) if (rad_packet_add_str(req->pack, NULL, "Calling-Station-Id", rpd->ses->ctrl->calling_station_id)) goto out_err; - + if (rpd->ses->ctrl->called_station_id) if (rad_packet_add_str(req->pack, NULL, "Called-Station-Id", rpd->ses->ctrl->called_station_id)) goto out_err; - + if (rpd->attr_class) if (rad_packet_add_octets(req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len)) goto out_err; - + if (conf_attr_tunnel_type) if (rad_packet_add_str(req->pack, NULL, conf_attr_tunnel_type, rpd->ses->ctrl->name)) goto out_err; @@ -240,7 +240,7 @@ void rad_req_free(struct rad_req_t *req) triton_md_unregister_handler(&req->hnd, 1); else if (req->hnd.fd != -1) close(req->hnd.fd); - + if (req->timeout.tpd) triton_timer_del(&req->timeout); @@ -288,7 +288,7 @@ static int make_socket(struct rad_req_t *req) log_ppp_error("radius: failed to set nonblocking mode: %s\n", strerror(errno)); goto out_err; } - + return 0; out_err: @@ -313,18 +313,18 @@ int __rad_req_send(struct rad_req_t *req, int async) if (req->hnd.fd == -1 && make_socket(req)) return -1; - + if (req->before_send && req->before_send(req)) goto out_err; if (!req->pack->buf && rad_packet_build(req->pack, req->RA)) goto out_err; - + if (req->log) { req->log("send "); rad_packet_print(req->pack, req->serv, req->log); } - + if (req->sent) req->sent(req, 0); @@ -339,7 +339,7 @@ out_err: close(req->hnd.fd); req->hnd.fd = -1; } - + if (async && req->sent) req->sent(req, -1); @@ -355,9 +355,9 @@ int rad_req_send(struct rad_req_t *req) if (req->try++ == conf_max_try) { if (req->active) rad_server_req_exit(req); - + log_ppp_warn("radius: server(%i) not responding\n", req->serv->id); - + if (rad_server_realloc(req)) { if (req->rpd) log_ppp_warn("radius: no available servers\n"); @@ -373,7 +373,7 @@ int rad_req_send(struct rad_req_t *req) if (r >= 0) break; - + if (rad_server_realloc(req)) { if (req->rpd) log_ppp_warn("radius: no available servers\n"); @@ -399,13 +399,13 @@ int rad_req_read(struct triton_md_handler_t *h) return 0; rad_server_reply(req->serv); - + if (pack->id == req->pack->id) break; - + rad_packet_free(pack); } - + req->reply = pack; if (req->active) diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 718a3b2d..c66cc283 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -38,7 +38,7 @@ static struct rad_server_t *__rad_server_get(int type, struct rad_server_t *excl { struct rad_server_t *s, *s0 = NULL, *s1 = NULL; struct timespec ts; - + clock_gettime(CLOCK_MONOTONIC, &ts); list_for_each_entry(s, &serv_list, entry) { @@ -61,7 +61,7 @@ static struct rad_server_t *__rad_server_get(int type, struct rad_server_t *excl else if (!s1) s1 = s; } - + if (!s0) { s0 = s; continue; @@ -113,7 +113,7 @@ static void req_wakeup(struct rad_req_t *req) log_switch(triton_context_self(), NULL); log_ppp_debug("radius(%i): wakeup %p %i\n", req->serv->id, req, req->active); - + if (!req->active) return; @@ -126,13 +126,13 @@ static void req_wakeup(struct rad_req_t *req) req->serv->req_cnt--; log_ppp_debug("radius(%i): server failed\n", req->serv->id); pthread_mutex_unlock(&req->serv->lock); - + req->send(req, -1); return; } pthread_mutex_unlock(&req->serv->lock); - + req->send(req, 1); } @@ -166,7 +166,7 @@ int rad_server_req_cancel(struct rad_req_t *req, int full) if (req->timeout.tpd) triton_timer_del(&req->timeout); - + if (req->hnd.tpd) triton_md_unregister_handler(&req->hnd, 0); @@ -176,7 +176,7 @@ int rad_server_req_cancel(struct rad_req_t *req, int full) int rad_server_req_enter(struct rad_req_t *req) { struct timespec ts; - + if (req->serv->need_free || req->serv->starting) return -1; @@ -195,7 +195,7 @@ int rad_server_req_enter(struct rad_req_t *req) assert(!req->entry.next); pthread_mutex_lock(&req->serv->lock); - + if (ts.tv_sec < req->serv->fail_time) { pthread_mutex_unlock(&req->serv->lock); return -1; @@ -207,13 +207,13 @@ int rad_server_req_enter(struct rad_req_t *req) req->serv->queue_cnt++; log_ppp_debug("radius(%i): queue %p\n", req->serv->id, req); pthread_mutex_unlock(&req->serv->lock); - + if (req->hnd.tpd) triton_md_disable_handler(&req->hnd, MD_MODE_READ); return 0; } - + pthread_mutex_unlock(&req->serv->lock); return 1; } @@ -221,12 +221,12 @@ int rad_server_req_enter(struct rad_req_t *req) req->serv->req_cnt++; log_ppp_debug("radius(%i): req_enter %i\n", req->serv->id, req->serv->req_cnt); pthread_mutex_unlock(&req->serv->lock); - + req->active = 1; - + if (req->send) return req->send(req, 0); - + return 0; } @@ -289,7 +289,7 @@ void rad_server_fail(struct rad_server_t *s) { struct rad_req_t *r; struct timespec ts; - + clock_gettime(CLOCK_MONOTONIC, &ts); pthread_mutex_lock(&s->lock); @@ -329,7 +329,7 @@ void rad_server_reply(struct rad_server_t *s) static int req_set_RA(struct rad_req_t *req, const char *secret) { MD5_CTX ctx; - + if (rad_packet_build(req->pack, req->RA)) return -1; @@ -373,7 +373,7 @@ static void acct_on_timeout(struct triton_timer_t *t) rad_req_free(req); if (s->starting) s->starting = 0; - else + else __free_server(s); return; } @@ -384,7 +384,7 @@ static void acct_on_timeout(struct triton_timer_t *t) static void send_acct_on(struct rad_server_t *s) { struct rad_req_t *req = rad_req_alloc_empty(); - + log_switch(triton_context_self(), NULL); memset(req, 0, sizeof(*req)); @@ -406,10 +406,10 @@ static void send_acct_on(struct rad_server_t *s) req->pack = rad_packet_alloc(CODE_ACCOUNTING_REQUEST); if (!req->pack) goto out_err; - + if (rad_packet_add_val(req->pack, NULL, "Acct-Status-Type", s->starting ? "Accounting-On" : "Accounting-Off")) goto out_err; - + if (conf_nas_identifier) if (rad_packet_add_str(req->pack, NULL, "NAS-Identifier", conf_nas_identifier)) goto out_err; @@ -417,7 +417,7 @@ static void send_acct_on(struct rad_server_t *s) if (conf_nas_ip_address) if (rad_packet_add_ipaddr(req->pack, NULL, "NAS-IP-Address", conf_nas_ip_address)) goto out_err; - + if (req_set_RA(req, s->secret)) goto out_err; @@ -426,7 +426,7 @@ static void send_acct_on(struct rad_server_t *s) triton_timer_add(&s->ctx, &req->timeout, 0); return; - + out_err: rad_req_free(req); } @@ -434,12 +434,12 @@ out_err: static void serv_ctx_close(struct triton_context_t *ctx) { struct rad_server_t *s = container_of(ctx, typeof(*s), ctx); - + if (s->timer.tpd) triton_timer_del(&s->timer); s->need_close = 1; - + if (!s->client_cnt[0] && !s->client_cnt[1]) { if (s->acct_on) { s->acct_on = 0; @@ -467,7 +467,7 @@ static void show_stat(struct rad_server_t *s, void *client) cli_send(client, " state: active\r\n"); cli_sendv(client, " fail count: %lu\r\n", s->stat_fail_cnt); - + cli_sendv(client, " request count: %i\r\n", s->req_cnt); cli_sendv(client, " queue length: %i\r\n", s->queue_cnt); @@ -539,7 +539,7 @@ static void __add_server(struct rad_server_t *s) s->stat_interim_lost_5m = stat_accm_create(5 * 60); s->stat_interim_query_1m = stat_accm_create(60); s->stat_interim_query_5m = stat_accm_create(5 * 60); - + s->ctx.close = serv_ctx_close; triton_context_register(&s->ctx, NULL); @@ -587,9 +587,9 @@ static int parse_server_old(const char *opt, in_addr_t *addr, int *port, char ** *p2 = 0; else return -1; - + *addr = inet_addr(str); - + if (p1) { *port = atoi(p1 + 1); if (*port <=0 ) @@ -646,7 +646,7 @@ static void add_server_old(void) __add_server(s); return; } - + __add_server(s); if (acct_addr) { @@ -670,14 +670,14 @@ static int parse_server1(const char *_opt, struct rad_server_t *s) ptr1 = strchr(opt, ','); if (!ptr1) goto out; - + ptr2 = strchr(ptr1 + 1, ','); if (ptr2) ptr3 = strchr(ptr2 + 1, ','); else ptr3 = NULL; - + *ptr1 = 0; if (ptr2) *ptr2 = 0; @@ -694,7 +694,7 @@ static int parse_server1(const char *_opt, struct rad_server_t *s) } } else s->auth_port = 1812; - + if (ptr3) { if (ptr3[1]) { s->acct_port = strtol(ptr3 + 1, &endptr, 10); @@ -708,7 +708,7 @@ static int parse_server1(const char *_opt, struct rad_server_t *s) s->fail_timeout = conf_fail_timeout; s->req_limit = conf_req_limit; s->max_fail = conf_max_fail; - + return 0; out: @@ -725,7 +725,7 @@ static int parse_server2(const char *_opt, struct rad_server_t *s) ptr1 = strchr(opt, ','); if (!ptr1) goto out; - + ptr2 = strchr(ptr1 + 1, ','); *ptr1 = 0; @@ -770,7 +770,7 @@ static int parse_server2(const char *_opt, struct rad_server_t *s) } else s->fail_timeout = conf_fail_timeout; } - + ptr3 = strstr(ptr2, ",max-fail="); if (ptr3) { s->max_fail = strtol(ptr3 + 10, &endptr, 10); @@ -778,7 +778,7 @@ static int parse_server2(const char *_opt, struct rad_server_t *s) goto out; } else s->max_fail = conf_max_fail; - + ptr3 = strstr(ptr2, ",weight="); if (ptr3) { s->weight = atoi(ptr3 + 8); @@ -788,7 +788,7 @@ static int parse_server2(const char *_opt, struct rad_server_t *s) } } else s->weight = 1; - + ptr3 = strstr(ptr2, ",backup"); if (ptr3) s->backup = 1; @@ -799,7 +799,7 @@ static int parse_server2(const char *_opt, struct rad_server_t *s) *ptr2 = 0; s->secret = _strdup(ptr1 + 1); - + _free(opt); return 0; @@ -813,12 +813,12 @@ out: static void add_server(const char *opt) { struct rad_server_t *s = _malloc(sizeof(*s)); - + memset(s, 0, sizeof(*s)); if (!parse_server1(opt,s)) goto add; - + if (!parse_server2(opt,s)) goto add; @@ -841,13 +841,13 @@ static void load_config(void) list_for_each_entry(s, &serv_list, entry) s->need_free = 1; - + opt1 = conf_get_opt("radius", "acct-on"); if (opt1) conf_acct_on = atoi(opt1); else conf_acct_on = 0; - + opt1 = conf_get_opt("radius", "fail-timeout"); if (!opt1) opt1 = conf_get_opt("radius", "fail-time"); @@ -861,7 +861,7 @@ static void load_config(void) conf_req_limit = atoi(opt1); else conf_req_limit = 0; - + opt1 = conf_get_opt("radius", "max-fail"); if (opt1) conf_max_fail = atoi(opt1); @@ -873,7 +873,7 @@ static void load_config(void) continue; add_server(opt->val); } - + list_for_each_safe(pos, n, &serv_list) { s = list_entry(pos, typeof(*s), entry); if (s->need_free) { @@ -893,9 +893,9 @@ static void load_config(void) } } } - + add_server_old(); - + conf_accounting = 0; list_for_each_entry(s, &serv_list, entry) { if (s->acct_port) { @@ -903,7 +903,7 @@ static void load_config(void) break; } } - + list_for_each_entry(s, &serv_list, entry) { if (s->starting) { if (!conf_accounting || !s->auth_port) diff --git a/accel-pppd/radius/stat_accm.c b/accel-pppd/radius/stat_accm.c index 2388c5d3..fe5da6ed 100644 --- a/accel-pppd/radius/stat_accm.c +++ b/accel-pppd/radius/stat_accm.c @@ -52,7 +52,7 @@ static void stat_accm_clean(struct stat_accm_t *s) { struct item_t *it; struct timespec ts; - + clock_gettime(CLOCK_MONOTONIC, &ts); while (!list_empty(&s->items)) { @@ -71,11 +71,11 @@ void stat_accm_add(struct stat_accm_t *s, unsigned int val) { struct item_t *it; struct timespec ts; - + clock_gettime(CLOCK_MONOTONIC, &ts); pthread_mutex_lock(&s->lock); - + stat_accm_clean(s); it = mempool_alloc(item_pool); @@ -84,7 +84,7 @@ void stat_accm_add(struct stat_accm_t *s, unsigned int val) list_add_tail(&it->entry, &s->items); ++s->items_cnt; s->total += val; - + pthread_mutex_unlock(&s->lock); } @@ -104,7 +104,7 @@ unsigned long stat_accm_get_avg(struct stat_accm_t *s) stat_accm_clean(s); val = s->items_cnt ? s->total/s->items_cnt : 0; pthread_mutex_unlock(&s->lock); - + return val; } diff --git a/accel-pppd/session.c b/accel-pppd/session.c index 8885cb22..12e4fc2b 100644 --- a/accel-pppd/session.c +++ b/accel-pppd/session.c @@ -94,7 +94,7 @@ int __export ap_session_starting(struct ap_session *ses) } ses->ifindex = ifr.ifr_ifindex; } - + if (ses->ifindex != -1) ap_session_set_ifindex(ses); @@ -105,13 +105,13 @@ int __export ap_session_starting(struct ap_session *ses) ses->state = AP_STATE_STARTING; } - + __sync_add_and_fetch(&ap_session_stat.starting, 1); pthread_rwlock_wrlock(&ses_lock); list_add_tail(&ses->entry, &ses_list); pthread_rwlock_unlock(&ses_lock); - + triton_event_fire(EV_SES_STARTING, ses); return 0; @@ -185,12 +185,12 @@ void __export ap_session_finished(struct ap_session *ses) _free(ses->ipv4_pool_name); ses->ipv4_pool_name = NULL; } - + if (ses->ipv6_pool_name) { _free(ses->ipv6_pool_name); ses->ipv6_pool_name = NULL; } - + if (ses->ifname_rename) { _free(ses->ifname_rename); ses->ifname_rename = NULL; @@ -200,7 +200,7 @@ void __export ap_session_finished(struct ap_session *ses) if (ses->backup) ses->backup->storage->free(ses->backup); #endif - + if (ap_shutdown && !ap_session_stat.starting && !ap_session_stat.active && !ap_session_stat.finishing) { if (shutdown_cb) shutdown_cb(); @@ -225,7 +225,7 @@ void __export ap_session_terminate(struct ap_session *ses, int cause, int hard) ses->ctrl->terminate(ses, hard); return; } - + if (ses->state == AP_STATE_ACTIVE) __sync_sub_and_fetch(&ap_session_stat.active, 1); else @@ -271,7 +271,7 @@ static void generate_sessionid(struct ap_session *ses) #else sid = __sync_add_and_fetch(&seq, 1); #endif - + clock_gettime(CLOCK_MONOTONIC, &ts); if (ts.tv_sec - seq_ts.tv_sec > conf_seq_save_timeout) save_seq(); @@ -307,7 +307,7 @@ int __export ap_session_read_stats(struct ap_session *ses, struct rtnl_link_stat log_ppp_warn("failed to get interface statistics\n"); return -1; } - + stats->rx_packets -= ses->acct_rx_packets_i; stats->tx_packets -= ses->acct_tx_packets_i; stats->rx_bytes -= ses->acct_rx_bytes_i; @@ -367,7 +367,7 @@ static void save_seq(void) FILE *f; char path[PATH_MAX]; const char *ptr; - + if (conf_sid_source != SID_SOURCE_SEQ) return; @@ -397,16 +397,16 @@ static void load_config(void) else if (strcmp(opt, "lower")) log_emerg("sid-case: invalid format\n"); } - + opt = conf_get_opt("common", "single-session"); if (opt) { if (!strcmp(opt, "deny")) conf_single_session = 0; else if (!strcmp(opt, "replace")) conf_single_session = 1; - } else + } else conf_single_session = -1; - + opt = conf_get_opt("common", "sid-source"); if (opt) { if (strcmp(opt, "seq") == 0) @@ -417,7 +417,7 @@ static void load_config(void) log_error("unknown sid-source\n"); } else conf_sid_source = SID_SOURCE_SEQ; - + conf_seq_file = conf_get_opt("common", "seq-file"); if (!conf_seq_file) conf_seq_file = "/var/lib/accel-ppp/seq"; @@ -436,7 +436,7 @@ static void init(void) perror("socket"); _exit(EXIT_FAILURE); } - + fcntl(sock_fd, F_SETFD, fcntl(sock_fd, F_GETFD) | FD_CLOEXEC); sock6_fd = socket(AF_INET6, SOCK_DGRAM, 0); @@ -450,7 +450,7 @@ static void init(void) log_emerg("failed to open /dev/urandom: %s\n", strerror(errno)); return; } - + fcntl(urandom_fd, F_SETFD, fcntl(urandom_fd, F_GETFD) | FD_CLOEXEC); load_config(); diff --git a/accel-pppd/session_backup.c b/accel-pppd/session_backup.c index 86073623..dea5b600 100644 --- a/accel-pppd/session_backup.c +++ b/accel-pppd/session_backup.c @@ -52,7 +52,7 @@ static int session_save(struct ap_session *ses, struct backup_mod *m) //add_tag_int(PPP_TAG_UNIT, &ses->unit_idx, sizeof(ses->unit_idx)); //triton_event_fire(EV_PPP_SESSION_SAVE, &ev); - + return 0; } @@ -115,7 +115,7 @@ static int session_restore(struct ap_session *ses, struct backup_mod *m) break;*/ } } - + return 0; //return establish_ses(ses); } diff --git a/accel-pppd/shaper/leaf_qdisc.c b/accel-pppd/shaper/leaf_qdisc.c index a2628e0a..d6b29583 100644 --- a/accel-pppd/shaper/leaf_qdisc.c +++ b/accel-pppd/shaper/leaf_qdisc.c @@ -30,12 +30,12 @@ static int parse_size(const char *str, int *r) if (endptr == str) return -1; - + if (*endptr == 0) { *r = sz; return 0; } - + if (strcmp(endptr, "kb") == 0 || strcmp(endptr, "k") == 0) *r = sz * 1024; else if (strcmp(endptr, "mb") == 0 || strcmp(endptr, "m") == 0) @@ -66,12 +66,12 @@ static int parse_time(const char *str, int *r) if (endptr == str) return -1; - + if (*endptr == 0) { *r = t; return 0; } - + if (strcmp(endptr, "s") == 0 || strcmp(endptr, "sec") == 0) *r = t * TIME_UNITS_PER_SEC; else if (strcmp(endptr, "ms") == 0 || strcmp(endptr, "msec") == 0) @@ -109,17 +109,17 @@ static int parse_sfq(char *str) if (!*str) goto out; - + while (1) { for (ptr1 = str + 1; *ptr1 && *ptr1 != ' '; ptr1++); if (!*ptr1) return -1; - + *ptr1 = 0; for (ptr1++; *ptr1 && *ptr1 == ' '; ptr1++); - + if (!*ptr1) return -1; @@ -160,7 +160,7 @@ static int parse_fq_codel(char *str) char *ptr1, *ptr2; conf_lq_arg6 = -1; - + if (!*str) goto out; @@ -169,11 +169,11 @@ static int parse_fq_codel(char *str) if (!*ptr1) return -1; - + *ptr1 = 0; for (ptr1++; *ptr1 && *ptr1 == ' '; ptr1++); - + if (!*ptr1) return -1; @@ -241,9 +241,9 @@ void leaf_qdisc_parse(const char *opt) #endif } else log_emerg("shaper: unknown leaf-qdisc '%s'\n", str); - + free(str); - + return; out_err: log_emerg("shaper: failed to parse '%s'\n", opt); @@ -256,7 +256,7 @@ static int qdisc_sfq(struct qdisc_opt *qopt, struct nlmsghdr *n) .perturb_period = conf_lq_arg2, .limit = conf_lq_arg3, }; - + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); return 0; @@ -316,12 +316,12 @@ int install_leaf_qdisc(struct rtnl_handle *rth, int ifindex, int parent, int han { if (conf_leaf_qdisc == LEAF_QDISC_SFQ) return install_sfq(rth, ifindex, parent, handle); - + #ifdef TCA_FQ_CODEL_MAX else if (conf_leaf_qdisc == LEAF_QDISC_FQ_CODEL) return install_fq_codel(rth, ifindex, parent, handle); #endif - + return 0; } diff --git a/accel-pppd/shaper/limiter.c b/accel-pppd/shaper/limiter.c index 2398bfea..b0525cb8 100644 --- a/accel-pppd/shaper/limiter.c +++ b/accel-pppd/shaper/limiter.c @@ -59,7 +59,7 @@ static int qdisc_htb_root(struct qdisc_opt *qopt, struct nlmsghdr *n) opt.rate2quantum = qopt->quantum; opt.version = 3; opt.defcls = qopt->defcls; - + tail = NLMSG_TAIL(n); addattr_l(n, TCA_BUF_MAX, TCA_OPTIONS, NULL, 0); addattr_l(n, TCA_BUF_MAX, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt))); @@ -131,9 +131,9 @@ int tc_qdisc_modify(struct rtnl_handle *rth, int ifindex, int cmd, unsigned flag if (opt->handle) req.t.tcm_handle = opt->handle; - + req.t.tcm_parent = opt->parent; - + if (opt->kind) addattr_l(&req.n, sizeof(req), TCA_KIND, opt->kind, strlen(opt->kind) + 1); @@ -171,7 +171,7 @@ static int install_htb(struct rtnl_handle *rth, int ifindex, int rate, int burst .defcls = 1, .qdisc = qdisc_htb_root, }; - + struct qdisc_opt opt2 = { .kind = "htb", .handle = 0x00010001, @@ -185,10 +185,10 @@ static int install_htb(struct rtnl_handle *rth, int ifindex, int rate, int burst if (tc_qdisc_modify(rth, ifindex, RTM_NEWQDISC, NLM_F_EXCL|NLM_F_CREATE, &opt1)) return -1; - + if (tc_qdisc_modify(rth, ifindex, RTM_NEWTCLASS, NLM_F_EXCL|NLM_F_CREATE, &opt2)) return -1; - + return 0; } @@ -211,7 +211,7 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu .handle = 0xffff0000, .parent = TC_H_INGRESS, }; - + struct sel { struct tc_u32_sel sel; struct tc_u32_key key; @@ -220,7 +220,7 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu .sel.flags = TC_U32_TERMINAL, .key.off = 12, }; - + struct tc_police police = { .action = TC_POLICE_SHOT, .rate.rate = rate, @@ -231,7 +231,7 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu if (tc_qdisc_modify(rth, ifindex, RTM_NEWQDISC, NLM_F_EXCL|NLM_F_CREATE, &opt1)) return -1; - + if (tc_calc_rtable(&police.rate, rtab, Rcell_log, mtu, linklayer) < 0) { log_ppp_error("shaper: failed to calculate ceil rate table.\n"); return -1; @@ -246,9 +246,9 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu req.t.tcm_ifindex = ifindex; req.t.tcm_handle = 1; req.t.tcm_parent = 0xffff0000; - + req.t.tcm_info = TC_H_MAKE(100 << 16, ntohs(ETH_P_IP)); - + addattr_l(&req.n, sizeof(req), TCA_KIND, "u32", 4); tail = NLMSG_TAIL(&req.n); @@ -266,15 +266,15 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu addattr_l(&req.n, MAX_MSG, TCA_POLICE_TBF, &police, sizeof(police)); addattr_l(&req.n, MAX_MSG, TCA_POLICE_RATE, rtab, 1024); tail3->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail3; - + tail2->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail2; - + tail1->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail1; addattr_l(&req.n, MAX_MSG, TCA_U32_CLASSID, &flowid, 4); addattr_l(&req.n, MAX_MSG, TCA_U32_SEL, &sel, sizeof(sel)); tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail; - + if (rtnl_talk(rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) return -1; @@ -300,13 +300,13 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, .quantum = conf_quantum, .qdisc = qdisc_htb_class, }; - + struct qdisc_opt opt2 = { .kind = "ingress", .handle = 0xffff0000, .parent = TC_H_INGRESS, }; - + struct sel { struct tc_u32_sel sel; struct tc_u32_key key; @@ -315,11 +315,11 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, .sel.flags = TC_U32_TERMINAL, .key.off = 0, }; - + struct tc_skbedit p1 = { .action = TC_ACT_PIPE, }; - + struct tc_mirred p2 = { .eaction = TCA_EGRESS_REDIR, .action = TC_ACT_STOLEN, @@ -328,10 +328,10 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, if (tc_qdisc_modify(rth, conf_ifb_ifindex, RTM_NEWTCLASS, NLM_F_EXCL|NLM_F_CREATE, &opt1)) return -1; - + if (tc_qdisc_modify(rth, ifindex, RTM_NEWQDISC, NLM_F_EXCL|NLM_F_CREATE, &opt2)) return -1; - + memset(&req, 0, sizeof(req)); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); @@ -341,10 +341,10 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, req.t.tcm_ifindex = ifindex; req.t.tcm_handle = 1; req.t.tcm_parent = 0xffff0000; - + req.t.tcm_info = TC_H_MAKE(100 << 16, ntohs(ETH_P_IP)); - + addattr_l(&req.n, sizeof(req), TCA_KIND, "u32", 4); tail = NLMSG_TAIL(&req.n); @@ -353,7 +353,7 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, tail1 = NLMSG_TAIL(&req.n); addattr_l(&req.n, MAX_MSG, TCA_U32_ACT, NULL, 0); - // action skbedit priority X pipe + // action skbedit priority X pipe tail2 = NLMSG_TAIL(&req.n); addattr_l(&req.n, MAX_MSG, 1, NULL, 0); addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, "skbedit", 8); @@ -363,9 +363,9 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, addattr_l(&req.n, MAX_MSG, TCA_SKBEDIT_PARMS, &p1, sizeof(p1)); addattr_l(&req.n, MAX_MSG, TCA_SKBEDIT_PRIORITY, &priority, sizeof(priority)); tail3->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail3; - + tail2->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail2; - + tail1->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail1; // action mirred egress redirect dev ifb0 @@ -377,16 +377,16 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, addattr_l(&req.n, MAX_MSG, TCA_ACT_OPTIONS, NULL, 0); addattr_l(&req.n, MAX_MSG, TCA_MIRRED_PARMS, &p2, sizeof(p2)); tail3->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail3; - + tail2->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail2; - + tail1->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail1; // addattr32(&req.n, TCA_BUF_MAX, TCA_U32_CLASSID, 1); addattr_l(&req.n, MAX_MSG, TCA_U32_SEL, &sel, sizeof(sel)); tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail; - + if (rtnl_talk(rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) return -1; @@ -410,14 +410,14 @@ static int install_fwmark(struct rtnl_handle *rth, int ifindex, int parent) req.n.nlmsg_type = RTM_NEWTFILTER; req.t.tcm_family = AF_UNSPEC; req.t.tcm_ifindex = ifindex; - req.t.tcm_handle = 1; + req.t.tcm_handle = conf_fwmark; req.t.tcm_parent = parent; req.t.tcm_info = TC_H_MAKE(90 << 16, ntohs(ETH_P_IP)); - + addattr_l(&req.n, sizeof(req), TCA_KIND, "fw", 3); tail = NLMSG_TAIL(&req.n); addattr_l(&req.n, TCA_BUF_MAX, TCA_OPTIONS, NULL, 0); - addattr32(&req.n, TCA_BUF_MAX, TCA_FW_CLASSID, TC_H_MAKE(conf_fwmark << 16, 0)); + addattr32(&req.n, TCA_BUF_MAX, TCA_FW_CLASSID, TC_H_MAKE(1 << 16, 0)); tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail; return rtnl_talk(rth, &req.n, 0, 0, NULL, NULL, NULL, 0); } @@ -428,7 +428,7 @@ static int remove_root(struct rtnl_handle *rth, int ifindex) .handle = 0x00010000, .parent = TC_H_ROOT, }; - + return tc_qdisc_modify(rth, ifindex, RTM_DELQDISC, 0, &opt); } @@ -438,7 +438,7 @@ static int remove_ingress(struct rtnl_handle *rth, int ifindex) .handle = 0xffff0000, .parent = TC_H_INGRESS, }; - + return tc_qdisc_modify(rth, ifindex, RTM_DELQDISC, 0, &opt); } @@ -448,7 +448,7 @@ static int remove_htb_ifb(struct rtnl_handle *rth, int ifindex, int priority) .handle = 0x00010001 + priority, .parent = 0x00010000, }; - + return tc_qdisc_modify(rth, conf_ifb_ifindex, RTM_DELTCLASS, 0, &opt); } @@ -456,7 +456,7 @@ int install_limiter(struct ap_session *ses, int down_speed, int down_burst, int { struct rtnl_handle rth; int r; - + if (rtnl_open(&rth, 0)) { log_ppp_error("shaper: cannot open rtnetlink\n"); return -1; @@ -483,11 +483,9 @@ int install_limiter(struct ap_session *ses, int down_speed, int down_burst, int r = install_leaf_qdisc(&rth, conf_ifb_ifindex, 0x00010001 + ses->unit_idx + 1, (1 + ses->unit_idx + 1) << 16); } - if (conf_fwmark) { + if (conf_fwmark) install_fwmark(&rth, ses->ifindex, 0x00010000); - install_fwmark(&rth, ses->ifindex, TC_H_INGRESS); - } - + rtnl_close(&rth); return r; @@ -504,7 +502,7 @@ int remove_limiter(struct ap_session *ses) remove_root(&rth, ses->ifindex); remove_ingress(&rth, ses->ifindex); - + if (conf_up_limiter == LIM_HTB) remove_htb_ifb(&rth, ses->ifindex, ses->unit_idx + 1); @@ -525,7 +523,7 @@ int init_ifb(const char *name) struct tcmsg t; char buf[TCA_BUF_MAX]; } req; - + struct qdisc_opt opt = { .kind = "htb", .handle = 0x00010000, @@ -536,7 +534,7 @@ int init_ifb(const char *name) if (system("modprobe -q ifb")) log_warn("failed to load ifb kernel module\n"); - + memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, name); @@ -546,7 +544,7 @@ int init_ifb(const char *name) } conf_ifb_ifindex = ifr.ifr_ifindex; - + ifr.ifr_flags |= IFF_UP; if (ioctl(sock_fd, SIOCSIFFLAGS, &ifr)) { @@ -575,7 +573,7 @@ int init_ifb(const char *name) req.t.tcm_handle = 1; req.t.tcm_parent = 0x00010000; req.t.tcm_info = TC_H_MAKE(100 << 16, ntohs(ETH_P_IP)); - + addattr_l(&req.n, sizeof(req), TCA_KIND, "flow", 5); tail = NLMSG_TAIL(&req.n); diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c index fa89e62b..b1eaabee 100644 --- a/accel-pppd/shaper/shaper.c +++ b/accel-pppd/shaper/shaper.c @@ -155,7 +155,7 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int * } return; } - + str1 = strstr(str, "rate-limit output"); if (str1) { val = sscanf(str1, "rate-limit output %u %u %u", &n1, &n2, &n3); @@ -175,7 +175,7 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int * } return; } - + str1 = strstr(str, "rate-limit input"); if (str1) { val = sscanf(str1, "rate-limit input %u %u %u", &n1, &n2, &n3); @@ -183,8 +183,8 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int * *speed = n1/1000; *burst = n2; } + return; } - return; } val = strtol(str, &endptr, 10); @@ -212,7 +212,7 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int * static struct time_range_pd_t *get_tr_pd(struct shaper_pd_t *pd, int id) { struct time_range_pd_t *tr_pd; - + list_for_each_entry(tr_pd, &pd->tr_list, entry) { if (tr_pd->id == id) return tr_pd; @@ -224,7 +224,7 @@ static struct time_range_pd_t *get_tr_pd(struct shaper_pd_t *pd, int id) if (id == time_range_id || id == 0) pd->cur_tr = tr_pd; - + list_add_tail(&tr_pd->entry, &pd->tr_list); return tr_pd; @@ -304,13 +304,13 @@ static void ev_radius_coa(struct ev_radius_t *ev) ev->res = -1; return; } - + clear_tr_pd(pd); check_radius_attrs(pd, ev->request); - + if (pd->temp_down_speed || pd->temp_up_speed) return; - + if (!pd->cur_tr) { if (pd->down_speed || pd->up_speed) { pd->down_speed = 0; @@ -330,7 +330,7 @@ static void ev_radius_coa(struct ev_radius_t *ev) ev->res = -1; return; } - + if (pd->down_speed > 0 || pd->up_speed > 0) { if (install_limiter(ev->ses, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst)) { ev->res= -1; @@ -396,10 +396,10 @@ static void ev_ppp_pre_up(struct ap_session *ses) int down_speed, down_burst; int up_speed, up_burst; struct shaper_pd_t *pd = find_pd(ses, 1); - + if (!pd) return; - + if (temp_down_speed || temp_up_speed) { pd->temp_down_speed = temp_down_speed; pd->temp_up_speed = temp_up_speed; @@ -476,7 +476,7 @@ static void shaper_change(struct shaper_pd_t *pd) pd->down_speed = 0; pd->up_speed = 0; } - + out: if (__sync_sub_and_fetch(&pd->refs, 1) == 0) { clear_tr_pd(pd); @@ -499,10 +499,10 @@ static int shaper_change_exec(const char *cmd, char * const *f, int f_cnt, void //if (down_speed == 0 || up_speed == 0) // return CLI_CMD_INVAL; - + if (!strcmp(f[2], "all")) all = 1; - + if (f_cnt == 5) { if (strcmp(f[4], "temp")) return CLI_CMD_SYNTAX; @@ -583,12 +583,12 @@ static int shaper_restore_exec(const char *cmd, char * const *f, int f_cnt, void if (f_cnt != 3) return CLI_CMD_SYNTAX; - + if (strcmp(f[2], "all")) all = 0; else all = 1; - + pthread_rwlock_rdlock(&shaper_lock); if (all) { temp_down_speed = 0; @@ -612,7 +612,7 @@ static int shaper_restore_exec(const char *cmd, char * const *f, int f_cnt, void if (!all && !found) cli_send(cli, "not found\r\n"); - + return CLI_CMD_OK; } @@ -665,7 +665,7 @@ static void update_shaper_tr(struct shaper_pd_t *pd) goto out; remove_limiter(pd->ses); } - + if (pd->cur_tr && (pd->cur_tr->down_speed || pd->cur_tr->up_speed)) { pd->down_speed = pd->cur_tr->down_speed; pd->up_speed = pd->cur_tr->up_speed; @@ -707,7 +707,7 @@ static void time_range_end_timer(struct triton_timer_t *t) struct shaper_pd_t *pd; time_range_id = 0; - + log_debug("shaper: time_range_end_timer\n"); pthread_rwlock_rdlock(&shaper_lock); @@ -730,7 +730,7 @@ static struct time_range_t *parse_range(time_t t, const char *val) return NULL; if (id <= 0) return NULL; - + localtime_r(&t, &begin_tm); begin_tm.tm_sec = 0; end_tm = begin_tm; @@ -738,11 +738,11 @@ static struct time_range_t *parse_range(time_t t, const char *val) endptr = strptime(endptr + 1, "%H:%M", &begin_tm); if (*endptr != '-') return NULL; - + endptr = strptime(endptr + 1, "%H:%M", &end_tm); if (*endptr) return NULL; - + r = _malloc(sizeof(*r)); memset(r, 0, sizeof(*r)); @@ -766,7 +766,7 @@ static void load_time_ranges(void) if (!s) return; - + time(&ts); while (!list_empty(&time_range_list)) { @@ -813,7 +813,7 @@ static void load_time_ranges(void) r->end.expire_tv.tv_sec += 24 * 60 * 60; triton_timer_add(&shaper_ctx, &r->begin, 1); - + if (r->end.period) triton_timer_add(&shaper_ctx, &r->end, 1); } @@ -851,7 +851,7 @@ static int parse_vendor_opt(const char *opt) vendor = rad_dict_find_vendor_name(opt); if (vendor) return vendor->id; - + return atoi(opt); } #endif @@ -875,7 +875,7 @@ static void load_config(void) opt = conf_get_opt("shaper", "attr-down"); if (opt) conf_attr_down = parse_attr_opt(opt); - + opt = conf_get_opt("shaper", "attr-up"); if (opt) conf_attr_up = parse_attr_opt(opt); @@ -886,13 +886,13 @@ static void load_config(void) } } #endif - + opt = conf_get_opt("shaper", "burst-factor"); if (opt) { conf_down_burst_factor = strtod(opt, NULL); conf_up_burst_factor = conf_down_burst_factor * 10; } - + opt = conf_get_opt("shaper", "down-burst-factor"); if (opt) conf_down_burst_factor = strtod(opt, NULL); @@ -926,13 +926,13 @@ static void load_config(void) conf_quantum = atoi(opt); else conf_quantum = 0; - + opt = conf_get_opt("shaper", "moderate-quantum"); if (opt) conf_moderate_quantum = atoi(opt); else conf_moderate_quantum = 0; - + opt = conf_get_opt("shaper", "cburst"); if (opt && atoi(opt) >= 0) conf_cburst = atoi(opt); @@ -972,19 +972,19 @@ static void load_config(void) opt = conf_get_opt("shaper", "verbose"); if (opt && atoi(opt) >= 0) conf_verbose = atoi(opt) > 0; - + opt = conf_get_opt("shaper", "rate-multiplier"); if (opt && atof(opt) > 0) conf_multiplier = atof(opt); else conf_multiplier = 1; - + opt = conf_get_opt("shaper", "fwmark"); if (opt) - conf_fwmark = atof(opt); + conf_fwmark = atoi(opt); else conf_fwmark = 0; - + triton_context_call(&shaper_ctx, (triton_event_func)load_time_ranges, NULL); } @@ -993,7 +993,7 @@ static void init(void) const char *opt; tc_core_init(); - + opt = conf_get_opt("shaper", "ifb"); if (opt && init_ifb(opt)) _exit(0); diff --git a/accel-pppd/shaper/shaper.h b/accel-pppd/shaper/shaper.h index 4864b86f..87cf45fe 100644 --- a/accel-pppd/shaper/shaper.h +++ b/accel-pppd/shaper/shaper.h @@ -21,7 +21,7 @@ struct qdisc_opt { int quantum; int defcls; int (*qdisc)(struct qdisc_opt *opt, struct nlmsghdr *n); -}; +}; extern int conf_up_limiter; extern int conf_down_limiter; diff --git a/accel-pppd/triton/conf_file.c b/accel-pppd/triton/conf_file.c index 0ca481cb..ebde6af2 100644 --- a/accel-pppd/triton/conf_file.c +++ b/accel-pppd/triton/conf_file.c @@ -10,7 +10,7 @@ struct sect_t { struct list_head entry; - + struct conf_sect_t *sect; }; @@ -51,7 +51,7 @@ static int __conf_load(struct conf_ctx *ctx, const char *fname) } r = load_file(&ctx1); - + fclose(ctx1.file); return r; @@ -92,7 +92,7 @@ static int load_file(struct conf_ctx *ctx) fprintf(stderr, "conf_file:%s:%i: sintax error\n", ctx->fname, ctx->line); return -1; } - + if (cur_sect && ctx->items != &cur_sect->items) { fprintf(stderr, "conf_file:%s:%i: cann't open section inside option\n", ctx->fname, ctx->line); return -1; @@ -145,7 +145,7 @@ static int load_file(struct conf_ctx *ctx) if (sect_add_item(ctx, str, str2, raw)) return -1; } - + return 0; } @@ -261,13 +261,13 @@ static struct conf_sect_t *find_sect(const char *name) static struct conf_sect_t *create_sect(const char *name) { struct sect_t *s = _malloc(sizeof(struct sect_t)); - + s->sect = _malloc(sizeof(struct conf_sect_t)); s->sect->name = (char*)_strdup(name); INIT_LIST_HEAD(&s->sect->items); - + list_add_tail(&s->entry, §ions); - + return s->sect; } @@ -293,7 +293,7 @@ static int sect_add_item(struct conf_ctx *ctx, const char *name, char *val, char opt->val = val ? _strdup(val) : NULL; opt->raw = raw; INIT_LIST_HEAD(&opt->items); - + list_add_tail(&opt->entry, ctx->items); if (len) { @@ -313,7 +313,7 @@ static struct conf_option_t *find_item(struct conf_sect_t *sect, const char *nam if (strcmp(opt->name, name) == 0) return opt; } - + return NULL; } @@ -329,7 +329,7 @@ __export char * conf_get_opt(const char *sect, const char *name) if (!s) return NULL; - + opt = find_item(s, name); if (!opt) return NULL; diff --git a/accel-pppd/triton/event.c b/accel-pppd/triton/event.c index 56472c1c..c8a7c431 100644 --- a/accel-pppd/triton/event.c +++ b/accel-pppd/triton/event.c @@ -66,7 +66,7 @@ int __export triton_event_register_handler(int ev_id, triton_event_func func) if (ev_id >= max_events) return -1; - + ev = events[ev_id]; if (!ev) { return -1; @@ -94,7 +94,7 @@ void __export triton_event_fire(int ev_id, void *arg) if (ev_id >= max_events) return; - + ev = events[ev_id]; if (!ev) return; diff --git a/accel-pppd/triton/list.h b/accel-pppd/triton/list.h index b17afab7..a650037f 100644 --- a/accel-pppd/triton/list.h +++ b/accel-pppd/triton/list.h @@ -29,14 +29,14 @@ typedef struct list_head { } while (0) /* - * Insert a new entry between two known consecutive entries. + * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! */ static void inline prefetch(void *p){} - + static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) @@ -105,7 +105,7 @@ static inline void list_del(struct list_head *entry) static inline void list_del_init(struct list_head *entry) { __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); + INIT_LIST_HEAD(entry); } /** @@ -231,7 +231,7 @@ static inline void list_splice_init(struct list_head *list, #define list_for_each_prev(pos, head) \ for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ pos = pos->prev, prefetch(pos->prev)) - + /** * list_for_each_safe - iterate over a list safe against removal of list entry * @pos: the &struct list_head to use as a loop counter. diff --git a/accel-pppd/triton/loader.c b/accel-pppd/triton/loader.c index 6eb43734..73e767fc 100644 --- a/accel-pppd/triton/loader.c +++ b/accel-pppd/triton/loader.c @@ -96,7 +96,7 @@ int load_modules(const char *name) int __export triton_module_loaded(const char *name) { struct module_t *m; - + list_for_each_entry(m, &modules, entry) { if (strcmp(m->name, name)) continue; diff --git a/accel-pppd/triton/log.c b/accel-pppd/triton/log.c index 668d9e92..f34650f1 100644 --- a/accel-pppd/triton/log.c +++ b/accel-pppd/triton/log.c @@ -66,10 +66,10 @@ void triton_log_error(const char *fmt,...) void triton_log_debug(const char *fmt,...) { va_list ap; - + if (!f_debug) return; - + va_start(ap, fmt); do_log(f_debug, fmt, ap); va_end(ap); diff --git a/accel-pppd/triton/md.c b/accel-pppd/triton/md.c index 6067ff2e..b490d0c0 100644 --- a/accel-pppd/triton/md.c +++ b/accel-pppd/triton/md.c @@ -55,8 +55,8 @@ void md_run(void) void md_terminate(void) { - pthread_cancel(md_thr); - pthread_join(md_thr, NULL); + pthread_cancel(md_thr); + pthread_join(md_thr, NULL); } static void *md_thread(void *arg) @@ -78,7 +78,7 @@ static void *md_thread(void *arg) triton_log_error("md:epoll_wait: %s", strerror(errno)); _exit(-1); } - + for(i = 0; i < n; i++) { h = (struct _triton_md_handler_t *)epoll_events[i].data.ptr; if (!h->ud) @@ -99,7 +99,7 @@ static void *md_thread(void *arg) if (r) triton_thread_wakeup(h->ctx->thread); } - + while (!list_empty(&freed_list2)) { h = list_entry(freed_list2.next, typeof(*h), entry); list_del(&h->entry); @@ -144,7 +144,7 @@ void __export triton_md_unregister_handler(struct triton_md_handler_t *ud, int c close(ud->fd); ud->fd = -1; } - + spin_lock(&h->ctx->lock); h->ud = NULL; list_del(&h->entry); @@ -173,15 +173,15 @@ int __export triton_md_enable_handler(struct triton_md_handler_t *ud, int mode) h->epoll_event.events |= EPOLLIN; if (mode & MD_MODE_WRITE) h->epoll_event.events |= EPOLLOUT; - + if (h->trig_level) h->epoll_event.events |= EPOLLONESHOT; else h->epoll_event.events |= EPOLLET; - + if (events == h->epoll_event.events) return 0; - + if (events) { if (h->armed) r = epoll_ctl(epoll_fd, EPOLL_CTL_MOD, h->ud->fd, &h->epoll_event); @@ -208,15 +208,15 @@ int __export triton_md_disable_handler(struct triton_md_handler_t *ud,int mode) if (!h->epoll_event.events) return 0; - + if (mode & MD_MODE_READ) h->epoll_event.events &= ~EPOLLIN; if (mode & MD_MODE_WRITE) h->epoll_event.events &= ~EPOLLOUT; - + if (!(h->epoll_event.events & (EPOLLIN | EPOLLOUT))) h->epoll_event.events = 0; - + if (events == h->epoll_event.events) return 0; diff --git a/accel-pppd/triton/mempool.c b/accel-pppd/triton/mempool.c index 7c8c56c9..ecc91f34 100644 --- a/accel-pppd/triton/mempool.c +++ b/accel-pppd/triton/mempool.c @@ -84,7 +84,7 @@ mempool_t __export *mempool_create(int size) mempool_t __export *mempool_create2(int size) { struct _mempool_t *p = (struct _mempool_t *)mempool_create(size); - + p->mmap = 1; return (mempool_t *)p; @@ -105,7 +105,7 @@ void __export *mempool_alloc(mempool_t *pool) --p->objects; __sync_sub_and_fetch(&triton_stat.mempool_available, size); - + return it->ptr; #ifdef VALGRIND } @@ -275,7 +275,7 @@ static int mmap_grow(void) } mmap_endptr = ptr + size; - + __sync_add_and_fetch(&triton_stat.mempool_allocated, size); __sync_add_and_fetch(&triton_stat.mempool_available, size); diff --git a/accel-pppd/triton/mempool.h b/accel-pppd/triton/mempool.h index 53eebfb7..9b95af09 100644 --- a/accel-pppd/triton/mempool.h +++ b/accel-pppd/triton/mempool.h @@ -5,7 +5,7 @@ struct mempool_stat_t { - uint32_t allocated; + uint32_t allocated; uint32_t available; }; diff --git a/accel-pppd/triton/options.c b/accel-pppd/triton/options.c index a5214e21..8ff617cf 100644 --- a/accel-pppd/triton/options.c +++ b/accel-pppd/triton/options.c @@ -11,38 +11,38 @@ static struct conf_file_sect_t *sect=NULL; static const char* find_option(const char *name) { struct option_t *opt; - + if (!sect) { sect=conf_file_get_section("options"); if (!sect) return 0; } - + list_for_each_entry(opt,§->items,entry) { if (strcmp(opt->name,name)==0) return opt->val; } - + return NULL; } int triton_get_int_option(const char *str) { const char *val=find_option(str); if (!val) return 0; - + return atoi(val); } const char* triton_get_str_option(const char *str) { const char *val=find_option(str); - + return val; } double triton_get_double_option(const char *str) { const char *val=find_option(str); if (!val) return 0; - + return atof(val); } diff --git a/accel-pppd/triton/timer.c b/accel-pppd/triton/timer.c index 1e4f0612..18599ef3 100644 --- a/accel-pppd/triton/timer.c +++ b/accel-pppd/triton/timer.c @@ -85,7 +85,7 @@ void *timer_thread(void *arg) triton_log_error("timer:epoll_wait: %s", strerror(errno)); _exit(-1); } - + for(i = 0; i < n; i++) { t = (struct _triton_timer_t *)epoll_events[i].data.ptr; if (!t->ud) @@ -141,21 +141,21 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_ return -1; } - if (fcntl(t->fd, F_SETFL, O_NONBLOCK)) { + if (fcntl(t->fd, F_SETFL, O_NONBLOCK)) { triton_log_error("timer: failed to set nonblocking mode: %s", strerror(errno)); goto out_err; } - + __sync_add_and_fetch(&t->ctx->refs, 1); ud->tpd = t; if (triton_timer_mod(ud, abs_time)) goto out_err; - + spin_lock(&t->ctx->lock); list_add_tail(&t->entry, &t->ctx->timers); spin_unlock(&t->ctx->lock); - + if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, t->fd, &t->epoll_event)) { triton_log_error("timer:epoll_ctl: %s", strerror(errno)); spin_lock(&t->ctx->lock); @@ -166,7 +166,7 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_ } triton_stat.timer_count++; - + return 0; out_err: @@ -214,9 +214,9 @@ void __export triton_timer_del(struct triton_timer_t *ud) pthread_mutex_lock(&freed_list_lock); list_add_tail(&t->entry, &freed_list); pthread_mutex_unlock(&freed_list_lock); - + ud->tpd = NULL; - + triton_stat.timer_count--; } diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c index b190187d..7a494a5a 100644 --- a/accel-pppd/triton/triton.c +++ b/accel-pppd/triton/triton.c @@ -121,13 +121,13 @@ static void* triton_thread(struct _triton_thread_t *thread) log_debug2("thread: %p: sleeping\n", thread); if (!terminate) list_add(&thread->entry2, &sleep_threads); - + if (__sync_sub_and_fetch(&triton_stat.thread_active, 1) == 0 && need_config_reload) { spin_unlock(&threads_lock); __config_reload(config_reload_notify); } else spin_unlock(&threads_lock); - + if (terminate) { spin_lock(&threads_lock); list_del(&thread->entry); @@ -209,7 +209,7 @@ static void ctx_thread(struct _triton_context_t *ctx) spin_unlock(&ctx->lock); __sync_sub_and_fetch(&triton_stat.md_handler_pending, 1); - + h->armed = 0; if ((events & (EPOLLIN | EPOLLERR | EPOLLHUP)) && (h->epoll_event.events & EPOLLIN)) { @@ -242,7 +242,7 @@ static void ctx_thread(struct _triton_context_t *ctx) ctx->pending = 0; spin_unlock(&ctx->lock); - break; + break; } spin_lock(&ctx->lock); @@ -293,7 +293,7 @@ int triton_queue_ctx(struct _triton_context_t *ctx) return 0; } - if (list_empty(&sleep_threads) || need_config_reload || triton_stat.thread_active > thread_count || + if (list_empty(&sleep_threads) || need_config_reload || triton_stat.thread_active > thread_count || (ctx->priority == 0 && triton_stat.thread_count > thread_count_max)) { if (ctx->priority) list_add(&ctx->entry2, &ctx_queue); @@ -403,7 +403,7 @@ void __export triton_context_unregister(struct triton_context_t *ud) terminate = 1; } spin_unlock(&ctx_list_lock); - + if (terminate) { spin_lock(&threads_lock); list_for_each_entry(t, &threads, entry) @@ -415,7 +415,7 @@ void __export triton_context_unregister(struct triton_context_t *ud) void __export triton_context_set_priority(struct triton_context_t *ud, int prio) { struct _triton_context_t *ctx = (struct _triton_context_t *)ud->tpd; - + ctx->priority = prio > 0; } @@ -423,7 +423,7 @@ void __export triton_context_schedule() { struct _triton_context_t *ctx = (struct _triton_context_t *)this_ctx->tpd; struct _triton_thread_t *t = NULL; - + log_debug2("ctx %p: enter schedule\n", ctx); __sync_add_and_fetch(&triton_stat.context_sleeping, 1); __sync_sub_and_fetch(&triton_stat.thread_active, 1); @@ -568,7 +568,7 @@ static void ru_update(struct triton_timer_t *t) clock_gettime(CLOCK_MONOTONIC, &ts); dt = (ts.tv_sec - ru_timestamp.tv_sec) * 1000000 + (ts.tv_nsec - ru_timestamp.tv_nsec) / 1000000; - val = (double)((rusage.ru_utime.tv_sec - ru_utime.tv_sec) * 1000000 + (rusage.ru_utime.tv_usec - ru_utime.tv_usec) + + val = (double)((rusage.ru_utime.tv_sec - ru_utime.tv_sec) * 1000000 + (rusage.ru_utime.tv_usec - ru_utime.tv_usec) + (rusage.ru_stime.tv_sec - ru_stime.tv_sec) * 1000000 + (rusage.ru_stime.tv_usec - ru_stime.tv_usec)) / dt * 100; triton_stat.cpu = val; @@ -637,7 +637,7 @@ int __export triton_load_modules(const char *mod_sect) list_del(&i->entry); free(i); } - + return 0; } @@ -721,7 +721,7 @@ void __export triton_terminate() spin_unlock(&threads_lock); sleep(1); } - + md_terminate(); timer_terminate(); } diff --git a/accel-pppd/triton/triton.h b/accel-pppd/triton/triton.h index 89e8577c..b66737cf 100644 --- a/accel-pppd/triton/triton.h +++ b/accel-pppd/triton/triton.h @@ -49,7 +49,7 @@ struct conf_option_t struct conf_sect_t { - const char *name; + const char *name; struct list_head items; }; diff --git a/accel-pppd/triton/triton_p.h b/accel-pppd/triton/triton_p.h index 2bbccbd1..6c9f884d 100644 --- a/accel-pppd/triton/triton_p.h +++ b/accel-pppd/triton/triton_p.h @@ -24,10 +24,10 @@ struct _triton_context_t { struct list_head entry; struct list_head entry2; - + spinlock_t lock; struct _triton_thread_t *thread; - + struct list_head handlers; struct list_head timers; struct list_head pending_handlers; diff --git a/crypto/des.c b/crypto/des.c index 322890d9..d6fe6966 100644 --- a/crypto/des.c +++ b/crypto/des.c @@ -10,14 +10,14 @@ */ #include "tomcrypt.h" -/** +/** @file des.c - LTC_DES code submitted by Dobes Vandermeer + LTC_DES code submitted by Dobes Vandermeer */ #ifdef LTC_DES -#define EN0 0 +#define EN0 0 #define DE1 1 const struct ltc_cipher_descriptor des_desc = @@ -52,7 +52,7 @@ const struct ltc_cipher_descriptor des3_desc = static const ulong32 bytebit[8] = { - 0200, 0100, 040, 020, 010, 04, 02, 01 + 0200, 0100, 040, 020, 010, 04, 02, 01 }; static const ulong32 bigbyte[24] = @@ -62,22 +62,22 @@ static const ulong32 bigbyte[24] = 0x8000UL, 0x4000UL, 0x2000UL, 0x1000UL, 0x800UL, 0x400UL, 0x200UL, 0x100UL, 0x80UL, 0x40UL, 0x20UL, 0x10UL, - 0x8UL, 0x4UL, 0x2UL, 0x1L + 0x8UL, 0x4UL, 0x2UL, 0x1L }; /* Use the key schedule specific in the standard (ANSI X3.92-1981) */ static const unsigned char pc1[56] = { - 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, - 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, + 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, + 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, - 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 + 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 }; static const unsigned char totrot[16] = { 1, 2, 4, 6, - 8, 10, 12, 14, - 15, 17, 19, 21, + 8, 10, 12, 14, + 15, 17, 19, 21, 23, 25, 27, 28 }; @@ -253,1050 +253,1050 @@ static const ulong32 SP8[64] = static const ulong64 des_ip[8][256] = { -{ CONST64(0x0000000000000000), CONST64(0x0000001000000000), CONST64(0x0000000000000010), CONST64(0x0000001000000010), - CONST64(0x0000100000000000), CONST64(0x0000101000000000), CONST64(0x0000100000000010), CONST64(0x0000101000000010), - CONST64(0x0000000000001000), CONST64(0x0000001000001000), CONST64(0x0000000000001010), CONST64(0x0000001000001010), - CONST64(0x0000100000001000), CONST64(0x0000101000001000), CONST64(0x0000100000001010), CONST64(0x0000101000001010), - CONST64(0x0010000000000000), CONST64(0x0010001000000000), CONST64(0x0010000000000010), CONST64(0x0010001000000010), - CONST64(0x0010100000000000), CONST64(0x0010101000000000), CONST64(0x0010100000000010), CONST64(0x0010101000000010), - CONST64(0x0010000000001000), CONST64(0x0010001000001000), CONST64(0x0010000000001010), CONST64(0x0010001000001010), - CONST64(0x0010100000001000), CONST64(0x0010101000001000), CONST64(0x0010100000001010), CONST64(0x0010101000001010), - CONST64(0x0000000000100000), CONST64(0x0000001000100000), CONST64(0x0000000000100010), CONST64(0x0000001000100010), - CONST64(0x0000100000100000), CONST64(0x0000101000100000), CONST64(0x0000100000100010), CONST64(0x0000101000100010), - CONST64(0x0000000000101000), CONST64(0x0000001000101000), CONST64(0x0000000000101010), CONST64(0x0000001000101010), - CONST64(0x0000100000101000), CONST64(0x0000101000101000), CONST64(0x0000100000101010), CONST64(0x0000101000101010), - CONST64(0x0010000000100000), CONST64(0x0010001000100000), CONST64(0x0010000000100010), CONST64(0x0010001000100010), - CONST64(0x0010100000100000), CONST64(0x0010101000100000), CONST64(0x0010100000100010), CONST64(0x0010101000100010), - CONST64(0x0010000000101000), CONST64(0x0010001000101000), CONST64(0x0010000000101010), CONST64(0x0010001000101010), - CONST64(0x0010100000101000), CONST64(0x0010101000101000), CONST64(0x0010100000101010), CONST64(0x0010101000101010), - CONST64(0x1000000000000000), CONST64(0x1000001000000000), CONST64(0x1000000000000010), CONST64(0x1000001000000010), - CONST64(0x1000100000000000), CONST64(0x1000101000000000), CONST64(0x1000100000000010), CONST64(0x1000101000000010), - CONST64(0x1000000000001000), CONST64(0x1000001000001000), CONST64(0x1000000000001010), CONST64(0x1000001000001010), - CONST64(0x1000100000001000), CONST64(0x1000101000001000), CONST64(0x1000100000001010), CONST64(0x1000101000001010), - CONST64(0x1010000000000000), CONST64(0x1010001000000000), CONST64(0x1010000000000010), CONST64(0x1010001000000010), - CONST64(0x1010100000000000), CONST64(0x1010101000000000), CONST64(0x1010100000000010), CONST64(0x1010101000000010), - CONST64(0x1010000000001000), CONST64(0x1010001000001000), CONST64(0x1010000000001010), CONST64(0x1010001000001010), - CONST64(0x1010100000001000), CONST64(0x1010101000001000), CONST64(0x1010100000001010), CONST64(0x1010101000001010), - CONST64(0x1000000000100000), CONST64(0x1000001000100000), CONST64(0x1000000000100010), CONST64(0x1000001000100010), - CONST64(0x1000100000100000), CONST64(0x1000101000100000), CONST64(0x1000100000100010), CONST64(0x1000101000100010), - CONST64(0x1000000000101000), CONST64(0x1000001000101000), CONST64(0x1000000000101010), CONST64(0x1000001000101010), - CONST64(0x1000100000101000), CONST64(0x1000101000101000), CONST64(0x1000100000101010), CONST64(0x1000101000101010), - CONST64(0x1010000000100000), CONST64(0x1010001000100000), CONST64(0x1010000000100010), CONST64(0x1010001000100010), - CONST64(0x1010100000100000), CONST64(0x1010101000100000), CONST64(0x1010100000100010), CONST64(0x1010101000100010), - CONST64(0x1010000000101000), CONST64(0x1010001000101000), CONST64(0x1010000000101010), CONST64(0x1010001000101010), - CONST64(0x1010100000101000), CONST64(0x1010101000101000), CONST64(0x1010100000101010), CONST64(0x1010101000101010), - CONST64(0x0000000010000000), CONST64(0x0000001010000000), CONST64(0x0000000010000010), CONST64(0x0000001010000010), - CONST64(0x0000100010000000), CONST64(0x0000101010000000), CONST64(0x0000100010000010), CONST64(0x0000101010000010), - CONST64(0x0000000010001000), CONST64(0x0000001010001000), CONST64(0x0000000010001010), CONST64(0x0000001010001010), - CONST64(0x0000100010001000), CONST64(0x0000101010001000), CONST64(0x0000100010001010), CONST64(0x0000101010001010), - CONST64(0x0010000010000000), CONST64(0x0010001010000000), CONST64(0x0010000010000010), CONST64(0x0010001010000010), - CONST64(0x0010100010000000), CONST64(0x0010101010000000), CONST64(0x0010100010000010), CONST64(0x0010101010000010), - CONST64(0x0010000010001000), CONST64(0x0010001010001000), CONST64(0x0010000010001010), CONST64(0x0010001010001010), - CONST64(0x0010100010001000), CONST64(0x0010101010001000), CONST64(0x0010100010001010), CONST64(0x0010101010001010), - CONST64(0x0000000010100000), CONST64(0x0000001010100000), CONST64(0x0000000010100010), CONST64(0x0000001010100010), - CONST64(0x0000100010100000), CONST64(0x0000101010100000), CONST64(0x0000100010100010), CONST64(0x0000101010100010), - CONST64(0x0000000010101000), CONST64(0x0000001010101000), CONST64(0x0000000010101010), CONST64(0x0000001010101010), - CONST64(0x0000100010101000), CONST64(0x0000101010101000), CONST64(0x0000100010101010), CONST64(0x0000101010101010), - CONST64(0x0010000010100000), CONST64(0x0010001010100000), CONST64(0x0010000010100010), CONST64(0x0010001010100010), - CONST64(0x0010100010100000), CONST64(0x0010101010100000), CONST64(0x0010100010100010), CONST64(0x0010101010100010), - CONST64(0x0010000010101000), CONST64(0x0010001010101000), CONST64(0x0010000010101010), CONST64(0x0010001010101010), - CONST64(0x0010100010101000), CONST64(0x0010101010101000), CONST64(0x0010100010101010), CONST64(0x0010101010101010), - CONST64(0x1000000010000000), CONST64(0x1000001010000000), CONST64(0x1000000010000010), CONST64(0x1000001010000010), - CONST64(0x1000100010000000), CONST64(0x1000101010000000), CONST64(0x1000100010000010), CONST64(0x1000101010000010), - CONST64(0x1000000010001000), CONST64(0x1000001010001000), CONST64(0x1000000010001010), CONST64(0x1000001010001010), - CONST64(0x1000100010001000), CONST64(0x1000101010001000), CONST64(0x1000100010001010), CONST64(0x1000101010001010), - CONST64(0x1010000010000000), CONST64(0x1010001010000000), CONST64(0x1010000010000010), CONST64(0x1010001010000010), - CONST64(0x1010100010000000), CONST64(0x1010101010000000), CONST64(0x1010100010000010), CONST64(0x1010101010000010), - CONST64(0x1010000010001000), CONST64(0x1010001010001000), CONST64(0x1010000010001010), CONST64(0x1010001010001010), - CONST64(0x1010100010001000), CONST64(0x1010101010001000), CONST64(0x1010100010001010), CONST64(0x1010101010001010), - CONST64(0x1000000010100000), CONST64(0x1000001010100000), CONST64(0x1000000010100010), CONST64(0x1000001010100010), - CONST64(0x1000100010100000), CONST64(0x1000101010100000), CONST64(0x1000100010100010), CONST64(0x1000101010100010), - CONST64(0x1000000010101000), CONST64(0x1000001010101000), CONST64(0x1000000010101010), CONST64(0x1000001010101010), - CONST64(0x1000100010101000), CONST64(0x1000101010101000), CONST64(0x1000100010101010), CONST64(0x1000101010101010), - CONST64(0x1010000010100000), CONST64(0x1010001010100000), CONST64(0x1010000010100010), CONST64(0x1010001010100010), - CONST64(0x1010100010100000), CONST64(0x1010101010100000), CONST64(0x1010100010100010), CONST64(0x1010101010100010), - CONST64(0x1010000010101000), CONST64(0x1010001010101000), CONST64(0x1010000010101010), CONST64(0x1010001010101010), +{ CONST64(0x0000000000000000), CONST64(0x0000001000000000), CONST64(0x0000000000000010), CONST64(0x0000001000000010), + CONST64(0x0000100000000000), CONST64(0x0000101000000000), CONST64(0x0000100000000010), CONST64(0x0000101000000010), + CONST64(0x0000000000001000), CONST64(0x0000001000001000), CONST64(0x0000000000001010), CONST64(0x0000001000001010), + CONST64(0x0000100000001000), CONST64(0x0000101000001000), CONST64(0x0000100000001010), CONST64(0x0000101000001010), + CONST64(0x0010000000000000), CONST64(0x0010001000000000), CONST64(0x0010000000000010), CONST64(0x0010001000000010), + CONST64(0x0010100000000000), CONST64(0x0010101000000000), CONST64(0x0010100000000010), CONST64(0x0010101000000010), + CONST64(0x0010000000001000), CONST64(0x0010001000001000), CONST64(0x0010000000001010), CONST64(0x0010001000001010), + CONST64(0x0010100000001000), CONST64(0x0010101000001000), CONST64(0x0010100000001010), CONST64(0x0010101000001010), + CONST64(0x0000000000100000), CONST64(0x0000001000100000), CONST64(0x0000000000100010), CONST64(0x0000001000100010), + CONST64(0x0000100000100000), CONST64(0x0000101000100000), CONST64(0x0000100000100010), CONST64(0x0000101000100010), + CONST64(0x0000000000101000), CONST64(0x0000001000101000), CONST64(0x0000000000101010), CONST64(0x0000001000101010), + CONST64(0x0000100000101000), CONST64(0x0000101000101000), CONST64(0x0000100000101010), CONST64(0x0000101000101010), + CONST64(0x0010000000100000), CONST64(0x0010001000100000), CONST64(0x0010000000100010), CONST64(0x0010001000100010), + CONST64(0x0010100000100000), CONST64(0x0010101000100000), CONST64(0x0010100000100010), CONST64(0x0010101000100010), + CONST64(0x0010000000101000), CONST64(0x0010001000101000), CONST64(0x0010000000101010), CONST64(0x0010001000101010), + CONST64(0x0010100000101000), CONST64(0x0010101000101000), CONST64(0x0010100000101010), CONST64(0x0010101000101010), + CONST64(0x1000000000000000), CONST64(0x1000001000000000), CONST64(0x1000000000000010), CONST64(0x1000001000000010), + CONST64(0x1000100000000000), CONST64(0x1000101000000000), CONST64(0x1000100000000010), CONST64(0x1000101000000010), + CONST64(0x1000000000001000), CONST64(0x1000001000001000), CONST64(0x1000000000001010), CONST64(0x1000001000001010), + CONST64(0x1000100000001000), CONST64(0x1000101000001000), CONST64(0x1000100000001010), CONST64(0x1000101000001010), + CONST64(0x1010000000000000), CONST64(0x1010001000000000), CONST64(0x1010000000000010), CONST64(0x1010001000000010), + CONST64(0x1010100000000000), CONST64(0x1010101000000000), CONST64(0x1010100000000010), CONST64(0x1010101000000010), + CONST64(0x1010000000001000), CONST64(0x1010001000001000), CONST64(0x1010000000001010), CONST64(0x1010001000001010), + CONST64(0x1010100000001000), CONST64(0x1010101000001000), CONST64(0x1010100000001010), CONST64(0x1010101000001010), + CONST64(0x1000000000100000), CONST64(0x1000001000100000), CONST64(0x1000000000100010), CONST64(0x1000001000100010), + CONST64(0x1000100000100000), CONST64(0x1000101000100000), CONST64(0x1000100000100010), CONST64(0x1000101000100010), + CONST64(0x1000000000101000), CONST64(0x1000001000101000), CONST64(0x1000000000101010), CONST64(0x1000001000101010), + CONST64(0x1000100000101000), CONST64(0x1000101000101000), CONST64(0x1000100000101010), CONST64(0x1000101000101010), + CONST64(0x1010000000100000), CONST64(0x1010001000100000), CONST64(0x1010000000100010), CONST64(0x1010001000100010), + CONST64(0x1010100000100000), CONST64(0x1010101000100000), CONST64(0x1010100000100010), CONST64(0x1010101000100010), + CONST64(0x1010000000101000), CONST64(0x1010001000101000), CONST64(0x1010000000101010), CONST64(0x1010001000101010), + CONST64(0x1010100000101000), CONST64(0x1010101000101000), CONST64(0x1010100000101010), CONST64(0x1010101000101010), + CONST64(0x0000000010000000), CONST64(0x0000001010000000), CONST64(0x0000000010000010), CONST64(0x0000001010000010), + CONST64(0x0000100010000000), CONST64(0x0000101010000000), CONST64(0x0000100010000010), CONST64(0x0000101010000010), + CONST64(0x0000000010001000), CONST64(0x0000001010001000), CONST64(0x0000000010001010), CONST64(0x0000001010001010), + CONST64(0x0000100010001000), CONST64(0x0000101010001000), CONST64(0x0000100010001010), CONST64(0x0000101010001010), + CONST64(0x0010000010000000), CONST64(0x0010001010000000), CONST64(0x0010000010000010), CONST64(0x0010001010000010), + CONST64(0x0010100010000000), CONST64(0x0010101010000000), CONST64(0x0010100010000010), CONST64(0x0010101010000010), + CONST64(0x0010000010001000), CONST64(0x0010001010001000), CONST64(0x0010000010001010), CONST64(0x0010001010001010), + CONST64(0x0010100010001000), CONST64(0x0010101010001000), CONST64(0x0010100010001010), CONST64(0x0010101010001010), + CONST64(0x0000000010100000), CONST64(0x0000001010100000), CONST64(0x0000000010100010), CONST64(0x0000001010100010), + CONST64(0x0000100010100000), CONST64(0x0000101010100000), CONST64(0x0000100010100010), CONST64(0x0000101010100010), + CONST64(0x0000000010101000), CONST64(0x0000001010101000), CONST64(0x0000000010101010), CONST64(0x0000001010101010), + CONST64(0x0000100010101000), CONST64(0x0000101010101000), CONST64(0x0000100010101010), CONST64(0x0000101010101010), + CONST64(0x0010000010100000), CONST64(0x0010001010100000), CONST64(0x0010000010100010), CONST64(0x0010001010100010), + CONST64(0x0010100010100000), CONST64(0x0010101010100000), CONST64(0x0010100010100010), CONST64(0x0010101010100010), + CONST64(0x0010000010101000), CONST64(0x0010001010101000), CONST64(0x0010000010101010), CONST64(0x0010001010101010), + CONST64(0x0010100010101000), CONST64(0x0010101010101000), CONST64(0x0010100010101010), CONST64(0x0010101010101010), + CONST64(0x1000000010000000), CONST64(0x1000001010000000), CONST64(0x1000000010000010), CONST64(0x1000001010000010), + CONST64(0x1000100010000000), CONST64(0x1000101010000000), CONST64(0x1000100010000010), CONST64(0x1000101010000010), + CONST64(0x1000000010001000), CONST64(0x1000001010001000), CONST64(0x1000000010001010), CONST64(0x1000001010001010), + CONST64(0x1000100010001000), CONST64(0x1000101010001000), CONST64(0x1000100010001010), CONST64(0x1000101010001010), + CONST64(0x1010000010000000), CONST64(0x1010001010000000), CONST64(0x1010000010000010), CONST64(0x1010001010000010), + CONST64(0x1010100010000000), CONST64(0x1010101010000000), CONST64(0x1010100010000010), CONST64(0x1010101010000010), + CONST64(0x1010000010001000), CONST64(0x1010001010001000), CONST64(0x1010000010001010), CONST64(0x1010001010001010), + CONST64(0x1010100010001000), CONST64(0x1010101010001000), CONST64(0x1010100010001010), CONST64(0x1010101010001010), + CONST64(0x1000000010100000), CONST64(0x1000001010100000), CONST64(0x1000000010100010), CONST64(0x1000001010100010), + CONST64(0x1000100010100000), CONST64(0x1000101010100000), CONST64(0x1000100010100010), CONST64(0x1000101010100010), + CONST64(0x1000000010101000), CONST64(0x1000001010101000), CONST64(0x1000000010101010), CONST64(0x1000001010101010), + CONST64(0x1000100010101000), CONST64(0x1000101010101000), CONST64(0x1000100010101010), CONST64(0x1000101010101010), + CONST64(0x1010000010100000), CONST64(0x1010001010100000), CONST64(0x1010000010100010), CONST64(0x1010001010100010), + CONST64(0x1010100010100000), CONST64(0x1010101010100000), CONST64(0x1010100010100010), CONST64(0x1010101010100010), + CONST64(0x1010000010101000), CONST64(0x1010001010101000), CONST64(0x1010000010101010), CONST64(0x1010001010101010), CONST64(0x1010100010101000), CONST64(0x1010101010101000), CONST64(0x1010100010101010), CONST64(0x1010101010101010) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000800000000), CONST64(0x0000000000000008), CONST64(0x0000000800000008), - CONST64(0x0000080000000000), CONST64(0x0000080800000000), CONST64(0x0000080000000008), CONST64(0x0000080800000008), - CONST64(0x0000000000000800), CONST64(0x0000000800000800), CONST64(0x0000000000000808), CONST64(0x0000000800000808), - CONST64(0x0000080000000800), CONST64(0x0000080800000800), CONST64(0x0000080000000808), CONST64(0x0000080800000808), - CONST64(0x0008000000000000), CONST64(0x0008000800000000), CONST64(0x0008000000000008), CONST64(0x0008000800000008), - CONST64(0x0008080000000000), CONST64(0x0008080800000000), CONST64(0x0008080000000008), CONST64(0x0008080800000008), - CONST64(0x0008000000000800), CONST64(0x0008000800000800), CONST64(0x0008000000000808), CONST64(0x0008000800000808), - CONST64(0x0008080000000800), CONST64(0x0008080800000800), CONST64(0x0008080000000808), CONST64(0x0008080800000808), - CONST64(0x0000000000080000), CONST64(0x0000000800080000), CONST64(0x0000000000080008), CONST64(0x0000000800080008), - CONST64(0x0000080000080000), CONST64(0x0000080800080000), CONST64(0x0000080000080008), CONST64(0x0000080800080008), - CONST64(0x0000000000080800), CONST64(0x0000000800080800), CONST64(0x0000000000080808), CONST64(0x0000000800080808), - CONST64(0x0000080000080800), CONST64(0x0000080800080800), CONST64(0x0000080000080808), CONST64(0x0000080800080808), - CONST64(0x0008000000080000), CONST64(0x0008000800080000), CONST64(0x0008000000080008), CONST64(0x0008000800080008), - CONST64(0x0008080000080000), CONST64(0x0008080800080000), CONST64(0x0008080000080008), CONST64(0x0008080800080008), - CONST64(0x0008000000080800), CONST64(0x0008000800080800), CONST64(0x0008000000080808), CONST64(0x0008000800080808), - CONST64(0x0008080000080800), CONST64(0x0008080800080800), CONST64(0x0008080000080808), CONST64(0x0008080800080808), - CONST64(0x0800000000000000), CONST64(0x0800000800000000), CONST64(0x0800000000000008), CONST64(0x0800000800000008), - CONST64(0x0800080000000000), CONST64(0x0800080800000000), CONST64(0x0800080000000008), CONST64(0x0800080800000008), - CONST64(0x0800000000000800), CONST64(0x0800000800000800), CONST64(0x0800000000000808), CONST64(0x0800000800000808), - CONST64(0x0800080000000800), CONST64(0x0800080800000800), CONST64(0x0800080000000808), CONST64(0x0800080800000808), - CONST64(0x0808000000000000), CONST64(0x0808000800000000), CONST64(0x0808000000000008), CONST64(0x0808000800000008), - CONST64(0x0808080000000000), CONST64(0x0808080800000000), CONST64(0x0808080000000008), CONST64(0x0808080800000008), - CONST64(0x0808000000000800), CONST64(0x0808000800000800), CONST64(0x0808000000000808), CONST64(0x0808000800000808), - CONST64(0x0808080000000800), CONST64(0x0808080800000800), CONST64(0x0808080000000808), CONST64(0x0808080800000808), - CONST64(0x0800000000080000), CONST64(0x0800000800080000), CONST64(0x0800000000080008), CONST64(0x0800000800080008), - CONST64(0x0800080000080000), CONST64(0x0800080800080000), CONST64(0x0800080000080008), CONST64(0x0800080800080008), - CONST64(0x0800000000080800), CONST64(0x0800000800080800), CONST64(0x0800000000080808), CONST64(0x0800000800080808), - CONST64(0x0800080000080800), CONST64(0x0800080800080800), CONST64(0x0800080000080808), CONST64(0x0800080800080808), - CONST64(0x0808000000080000), CONST64(0x0808000800080000), CONST64(0x0808000000080008), CONST64(0x0808000800080008), - CONST64(0x0808080000080000), CONST64(0x0808080800080000), CONST64(0x0808080000080008), CONST64(0x0808080800080008), - CONST64(0x0808000000080800), CONST64(0x0808000800080800), CONST64(0x0808000000080808), CONST64(0x0808000800080808), - CONST64(0x0808080000080800), CONST64(0x0808080800080800), CONST64(0x0808080000080808), CONST64(0x0808080800080808), - CONST64(0x0000000008000000), CONST64(0x0000000808000000), CONST64(0x0000000008000008), CONST64(0x0000000808000008), - CONST64(0x0000080008000000), CONST64(0x0000080808000000), CONST64(0x0000080008000008), CONST64(0x0000080808000008), - CONST64(0x0000000008000800), CONST64(0x0000000808000800), CONST64(0x0000000008000808), CONST64(0x0000000808000808), - CONST64(0x0000080008000800), CONST64(0x0000080808000800), CONST64(0x0000080008000808), CONST64(0x0000080808000808), - CONST64(0x0008000008000000), CONST64(0x0008000808000000), CONST64(0x0008000008000008), CONST64(0x0008000808000008), - CONST64(0x0008080008000000), CONST64(0x0008080808000000), CONST64(0x0008080008000008), CONST64(0x0008080808000008), - CONST64(0x0008000008000800), CONST64(0x0008000808000800), CONST64(0x0008000008000808), CONST64(0x0008000808000808), - CONST64(0x0008080008000800), CONST64(0x0008080808000800), CONST64(0x0008080008000808), CONST64(0x0008080808000808), - CONST64(0x0000000008080000), CONST64(0x0000000808080000), CONST64(0x0000000008080008), CONST64(0x0000000808080008), - CONST64(0x0000080008080000), CONST64(0x0000080808080000), CONST64(0x0000080008080008), CONST64(0x0000080808080008), - CONST64(0x0000000008080800), CONST64(0x0000000808080800), CONST64(0x0000000008080808), CONST64(0x0000000808080808), - CONST64(0x0000080008080800), CONST64(0x0000080808080800), CONST64(0x0000080008080808), CONST64(0x0000080808080808), - CONST64(0x0008000008080000), CONST64(0x0008000808080000), CONST64(0x0008000008080008), CONST64(0x0008000808080008), - CONST64(0x0008080008080000), CONST64(0x0008080808080000), CONST64(0x0008080008080008), CONST64(0x0008080808080008), - CONST64(0x0008000008080800), CONST64(0x0008000808080800), CONST64(0x0008000008080808), CONST64(0x0008000808080808), - CONST64(0x0008080008080800), CONST64(0x0008080808080800), CONST64(0x0008080008080808), CONST64(0x0008080808080808), - CONST64(0x0800000008000000), CONST64(0x0800000808000000), CONST64(0x0800000008000008), CONST64(0x0800000808000008), - CONST64(0x0800080008000000), CONST64(0x0800080808000000), CONST64(0x0800080008000008), CONST64(0x0800080808000008), - CONST64(0x0800000008000800), CONST64(0x0800000808000800), CONST64(0x0800000008000808), CONST64(0x0800000808000808), - CONST64(0x0800080008000800), CONST64(0x0800080808000800), CONST64(0x0800080008000808), CONST64(0x0800080808000808), - CONST64(0x0808000008000000), CONST64(0x0808000808000000), CONST64(0x0808000008000008), CONST64(0x0808000808000008), - CONST64(0x0808080008000000), CONST64(0x0808080808000000), CONST64(0x0808080008000008), CONST64(0x0808080808000008), - CONST64(0x0808000008000800), CONST64(0x0808000808000800), CONST64(0x0808000008000808), CONST64(0x0808000808000808), - CONST64(0x0808080008000800), CONST64(0x0808080808000800), CONST64(0x0808080008000808), CONST64(0x0808080808000808), - CONST64(0x0800000008080000), CONST64(0x0800000808080000), CONST64(0x0800000008080008), CONST64(0x0800000808080008), - CONST64(0x0800080008080000), CONST64(0x0800080808080000), CONST64(0x0800080008080008), CONST64(0x0800080808080008), - CONST64(0x0800000008080800), CONST64(0x0800000808080800), CONST64(0x0800000008080808), CONST64(0x0800000808080808), - CONST64(0x0800080008080800), CONST64(0x0800080808080800), CONST64(0x0800080008080808), CONST64(0x0800080808080808), - CONST64(0x0808000008080000), CONST64(0x0808000808080000), CONST64(0x0808000008080008), CONST64(0x0808000808080008), - CONST64(0x0808080008080000), CONST64(0x0808080808080000), CONST64(0x0808080008080008), CONST64(0x0808080808080008), - CONST64(0x0808000008080800), CONST64(0x0808000808080800), CONST64(0x0808000008080808), CONST64(0x0808000808080808), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000800000000), CONST64(0x0000000000000008), CONST64(0x0000000800000008), + CONST64(0x0000080000000000), CONST64(0x0000080800000000), CONST64(0x0000080000000008), CONST64(0x0000080800000008), + CONST64(0x0000000000000800), CONST64(0x0000000800000800), CONST64(0x0000000000000808), CONST64(0x0000000800000808), + CONST64(0x0000080000000800), CONST64(0x0000080800000800), CONST64(0x0000080000000808), CONST64(0x0000080800000808), + CONST64(0x0008000000000000), CONST64(0x0008000800000000), CONST64(0x0008000000000008), CONST64(0x0008000800000008), + CONST64(0x0008080000000000), CONST64(0x0008080800000000), CONST64(0x0008080000000008), CONST64(0x0008080800000008), + CONST64(0x0008000000000800), CONST64(0x0008000800000800), CONST64(0x0008000000000808), CONST64(0x0008000800000808), + CONST64(0x0008080000000800), CONST64(0x0008080800000800), CONST64(0x0008080000000808), CONST64(0x0008080800000808), + CONST64(0x0000000000080000), CONST64(0x0000000800080000), CONST64(0x0000000000080008), CONST64(0x0000000800080008), + CONST64(0x0000080000080000), CONST64(0x0000080800080000), CONST64(0x0000080000080008), CONST64(0x0000080800080008), + CONST64(0x0000000000080800), CONST64(0x0000000800080800), CONST64(0x0000000000080808), CONST64(0x0000000800080808), + CONST64(0x0000080000080800), CONST64(0x0000080800080800), CONST64(0x0000080000080808), CONST64(0x0000080800080808), + CONST64(0x0008000000080000), CONST64(0x0008000800080000), CONST64(0x0008000000080008), CONST64(0x0008000800080008), + CONST64(0x0008080000080000), CONST64(0x0008080800080000), CONST64(0x0008080000080008), CONST64(0x0008080800080008), + CONST64(0x0008000000080800), CONST64(0x0008000800080800), CONST64(0x0008000000080808), CONST64(0x0008000800080808), + CONST64(0x0008080000080800), CONST64(0x0008080800080800), CONST64(0x0008080000080808), CONST64(0x0008080800080808), + CONST64(0x0800000000000000), CONST64(0x0800000800000000), CONST64(0x0800000000000008), CONST64(0x0800000800000008), + CONST64(0x0800080000000000), CONST64(0x0800080800000000), CONST64(0x0800080000000008), CONST64(0x0800080800000008), + CONST64(0x0800000000000800), CONST64(0x0800000800000800), CONST64(0x0800000000000808), CONST64(0x0800000800000808), + CONST64(0x0800080000000800), CONST64(0x0800080800000800), CONST64(0x0800080000000808), CONST64(0x0800080800000808), + CONST64(0x0808000000000000), CONST64(0x0808000800000000), CONST64(0x0808000000000008), CONST64(0x0808000800000008), + CONST64(0x0808080000000000), CONST64(0x0808080800000000), CONST64(0x0808080000000008), CONST64(0x0808080800000008), + CONST64(0x0808000000000800), CONST64(0x0808000800000800), CONST64(0x0808000000000808), CONST64(0x0808000800000808), + CONST64(0x0808080000000800), CONST64(0x0808080800000800), CONST64(0x0808080000000808), CONST64(0x0808080800000808), + CONST64(0x0800000000080000), CONST64(0x0800000800080000), CONST64(0x0800000000080008), CONST64(0x0800000800080008), + CONST64(0x0800080000080000), CONST64(0x0800080800080000), CONST64(0x0800080000080008), CONST64(0x0800080800080008), + CONST64(0x0800000000080800), CONST64(0x0800000800080800), CONST64(0x0800000000080808), CONST64(0x0800000800080808), + CONST64(0x0800080000080800), CONST64(0x0800080800080800), CONST64(0x0800080000080808), CONST64(0x0800080800080808), + CONST64(0x0808000000080000), CONST64(0x0808000800080000), CONST64(0x0808000000080008), CONST64(0x0808000800080008), + CONST64(0x0808080000080000), CONST64(0x0808080800080000), CONST64(0x0808080000080008), CONST64(0x0808080800080008), + CONST64(0x0808000000080800), CONST64(0x0808000800080800), CONST64(0x0808000000080808), CONST64(0x0808000800080808), + CONST64(0x0808080000080800), CONST64(0x0808080800080800), CONST64(0x0808080000080808), CONST64(0x0808080800080808), + CONST64(0x0000000008000000), CONST64(0x0000000808000000), CONST64(0x0000000008000008), CONST64(0x0000000808000008), + CONST64(0x0000080008000000), CONST64(0x0000080808000000), CONST64(0x0000080008000008), CONST64(0x0000080808000008), + CONST64(0x0000000008000800), CONST64(0x0000000808000800), CONST64(0x0000000008000808), CONST64(0x0000000808000808), + CONST64(0x0000080008000800), CONST64(0x0000080808000800), CONST64(0x0000080008000808), CONST64(0x0000080808000808), + CONST64(0x0008000008000000), CONST64(0x0008000808000000), CONST64(0x0008000008000008), CONST64(0x0008000808000008), + CONST64(0x0008080008000000), CONST64(0x0008080808000000), CONST64(0x0008080008000008), CONST64(0x0008080808000008), + CONST64(0x0008000008000800), CONST64(0x0008000808000800), CONST64(0x0008000008000808), CONST64(0x0008000808000808), + CONST64(0x0008080008000800), CONST64(0x0008080808000800), CONST64(0x0008080008000808), CONST64(0x0008080808000808), + CONST64(0x0000000008080000), CONST64(0x0000000808080000), CONST64(0x0000000008080008), CONST64(0x0000000808080008), + CONST64(0x0000080008080000), CONST64(0x0000080808080000), CONST64(0x0000080008080008), CONST64(0x0000080808080008), + CONST64(0x0000000008080800), CONST64(0x0000000808080800), CONST64(0x0000000008080808), CONST64(0x0000000808080808), + CONST64(0x0000080008080800), CONST64(0x0000080808080800), CONST64(0x0000080008080808), CONST64(0x0000080808080808), + CONST64(0x0008000008080000), CONST64(0x0008000808080000), CONST64(0x0008000008080008), CONST64(0x0008000808080008), + CONST64(0x0008080008080000), CONST64(0x0008080808080000), CONST64(0x0008080008080008), CONST64(0x0008080808080008), + CONST64(0x0008000008080800), CONST64(0x0008000808080800), CONST64(0x0008000008080808), CONST64(0x0008000808080808), + CONST64(0x0008080008080800), CONST64(0x0008080808080800), CONST64(0x0008080008080808), CONST64(0x0008080808080808), + CONST64(0x0800000008000000), CONST64(0x0800000808000000), CONST64(0x0800000008000008), CONST64(0x0800000808000008), + CONST64(0x0800080008000000), CONST64(0x0800080808000000), CONST64(0x0800080008000008), CONST64(0x0800080808000008), + CONST64(0x0800000008000800), CONST64(0x0800000808000800), CONST64(0x0800000008000808), CONST64(0x0800000808000808), + CONST64(0x0800080008000800), CONST64(0x0800080808000800), CONST64(0x0800080008000808), CONST64(0x0800080808000808), + CONST64(0x0808000008000000), CONST64(0x0808000808000000), CONST64(0x0808000008000008), CONST64(0x0808000808000008), + CONST64(0x0808080008000000), CONST64(0x0808080808000000), CONST64(0x0808080008000008), CONST64(0x0808080808000008), + CONST64(0x0808000008000800), CONST64(0x0808000808000800), CONST64(0x0808000008000808), CONST64(0x0808000808000808), + CONST64(0x0808080008000800), CONST64(0x0808080808000800), CONST64(0x0808080008000808), CONST64(0x0808080808000808), + CONST64(0x0800000008080000), CONST64(0x0800000808080000), CONST64(0x0800000008080008), CONST64(0x0800000808080008), + CONST64(0x0800080008080000), CONST64(0x0800080808080000), CONST64(0x0800080008080008), CONST64(0x0800080808080008), + CONST64(0x0800000008080800), CONST64(0x0800000808080800), CONST64(0x0800000008080808), CONST64(0x0800000808080808), + CONST64(0x0800080008080800), CONST64(0x0800080808080800), CONST64(0x0800080008080808), CONST64(0x0800080808080808), + CONST64(0x0808000008080000), CONST64(0x0808000808080000), CONST64(0x0808000008080008), CONST64(0x0808000808080008), + CONST64(0x0808080008080000), CONST64(0x0808080808080000), CONST64(0x0808080008080008), CONST64(0x0808080808080008), + CONST64(0x0808000008080800), CONST64(0x0808000808080800), CONST64(0x0808000008080808), CONST64(0x0808000808080808), CONST64(0x0808080008080800), CONST64(0x0808080808080800), CONST64(0x0808080008080808), CONST64(0x0808080808080808) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000400000000), CONST64(0x0000000000000004), CONST64(0x0000000400000004), - CONST64(0x0000040000000000), CONST64(0x0000040400000000), CONST64(0x0000040000000004), CONST64(0x0000040400000004), - CONST64(0x0000000000000400), CONST64(0x0000000400000400), CONST64(0x0000000000000404), CONST64(0x0000000400000404), - CONST64(0x0000040000000400), CONST64(0x0000040400000400), CONST64(0x0000040000000404), CONST64(0x0000040400000404), - CONST64(0x0004000000000000), CONST64(0x0004000400000000), CONST64(0x0004000000000004), CONST64(0x0004000400000004), - CONST64(0x0004040000000000), CONST64(0x0004040400000000), CONST64(0x0004040000000004), CONST64(0x0004040400000004), - CONST64(0x0004000000000400), CONST64(0x0004000400000400), CONST64(0x0004000000000404), CONST64(0x0004000400000404), - CONST64(0x0004040000000400), CONST64(0x0004040400000400), CONST64(0x0004040000000404), CONST64(0x0004040400000404), - CONST64(0x0000000000040000), CONST64(0x0000000400040000), CONST64(0x0000000000040004), CONST64(0x0000000400040004), - CONST64(0x0000040000040000), CONST64(0x0000040400040000), CONST64(0x0000040000040004), CONST64(0x0000040400040004), - CONST64(0x0000000000040400), CONST64(0x0000000400040400), CONST64(0x0000000000040404), CONST64(0x0000000400040404), - CONST64(0x0000040000040400), CONST64(0x0000040400040400), CONST64(0x0000040000040404), CONST64(0x0000040400040404), - CONST64(0x0004000000040000), CONST64(0x0004000400040000), CONST64(0x0004000000040004), CONST64(0x0004000400040004), - CONST64(0x0004040000040000), CONST64(0x0004040400040000), CONST64(0x0004040000040004), CONST64(0x0004040400040004), - CONST64(0x0004000000040400), CONST64(0x0004000400040400), CONST64(0x0004000000040404), CONST64(0x0004000400040404), - CONST64(0x0004040000040400), CONST64(0x0004040400040400), CONST64(0x0004040000040404), CONST64(0x0004040400040404), - CONST64(0x0400000000000000), CONST64(0x0400000400000000), CONST64(0x0400000000000004), CONST64(0x0400000400000004), - CONST64(0x0400040000000000), CONST64(0x0400040400000000), CONST64(0x0400040000000004), CONST64(0x0400040400000004), - CONST64(0x0400000000000400), CONST64(0x0400000400000400), CONST64(0x0400000000000404), CONST64(0x0400000400000404), - CONST64(0x0400040000000400), CONST64(0x0400040400000400), CONST64(0x0400040000000404), CONST64(0x0400040400000404), - CONST64(0x0404000000000000), CONST64(0x0404000400000000), CONST64(0x0404000000000004), CONST64(0x0404000400000004), - CONST64(0x0404040000000000), CONST64(0x0404040400000000), CONST64(0x0404040000000004), CONST64(0x0404040400000004), - CONST64(0x0404000000000400), CONST64(0x0404000400000400), CONST64(0x0404000000000404), CONST64(0x0404000400000404), - CONST64(0x0404040000000400), CONST64(0x0404040400000400), CONST64(0x0404040000000404), CONST64(0x0404040400000404), - CONST64(0x0400000000040000), CONST64(0x0400000400040000), CONST64(0x0400000000040004), CONST64(0x0400000400040004), - CONST64(0x0400040000040000), CONST64(0x0400040400040000), CONST64(0x0400040000040004), CONST64(0x0400040400040004), - CONST64(0x0400000000040400), CONST64(0x0400000400040400), CONST64(0x0400000000040404), CONST64(0x0400000400040404), - CONST64(0x0400040000040400), CONST64(0x0400040400040400), CONST64(0x0400040000040404), CONST64(0x0400040400040404), - CONST64(0x0404000000040000), CONST64(0x0404000400040000), CONST64(0x0404000000040004), CONST64(0x0404000400040004), - CONST64(0x0404040000040000), CONST64(0x0404040400040000), CONST64(0x0404040000040004), CONST64(0x0404040400040004), - CONST64(0x0404000000040400), CONST64(0x0404000400040400), CONST64(0x0404000000040404), CONST64(0x0404000400040404), - CONST64(0x0404040000040400), CONST64(0x0404040400040400), CONST64(0x0404040000040404), CONST64(0x0404040400040404), - CONST64(0x0000000004000000), CONST64(0x0000000404000000), CONST64(0x0000000004000004), CONST64(0x0000000404000004), - CONST64(0x0000040004000000), CONST64(0x0000040404000000), CONST64(0x0000040004000004), CONST64(0x0000040404000004), - CONST64(0x0000000004000400), CONST64(0x0000000404000400), CONST64(0x0000000004000404), CONST64(0x0000000404000404), - CONST64(0x0000040004000400), CONST64(0x0000040404000400), CONST64(0x0000040004000404), CONST64(0x0000040404000404), - CONST64(0x0004000004000000), CONST64(0x0004000404000000), CONST64(0x0004000004000004), CONST64(0x0004000404000004), - CONST64(0x0004040004000000), CONST64(0x0004040404000000), CONST64(0x0004040004000004), CONST64(0x0004040404000004), - CONST64(0x0004000004000400), CONST64(0x0004000404000400), CONST64(0x0004000004000404), CONST64(0x0004000404000404), - CONST64(0x0004040004000400), CONST64(0x0004040404000400), CONST64(0x0004040004000404), CONST64(0x0004040404000404), - CONST64(0x0000000004040000), CONST64(0x0000000404040000), CONST64(0x0000000004040004), CONST64(0x0000000404040004), - CONST64(0x0000040004040000), CONST64(0x0000040404040000), CONST64(0x0000040004040004), CONST64(0x0000040404040004), - CONST64(0x0000000004040400), CONST64(0x0000000404040400), CONST64(0x0000000004040404), CONST64(0x0000000404040404), - CONST64(0x0000040004040400), CONST64(0x0000040404040400), CONST64(0x0000040004040404), CONST64(0x0000040404040404), - CONST64(0x0004000004040000), CONST64(0x0004000404040000), CONST64(0x0004000004040004), CONST64(0x0004000404040004), - CONST64(0x0004040004040000), CONST64(0x0004040404040000), CONST64(0x0004040004040004), CONST64(0x0004040404040004), - CONST64(0x0004000004040400), CONST64(0x0004000404040400), CONST64(0x0004000004040404), CONST64(0x0004000404040404), - CONST64(0x0004040004040400), CONST64(0x0004040404040400), CONST64(0x0004040004040404), CONST64(0x0004040404040404), - CONST64(0x0400000004000000), CONST64(0x0400000404000000), CONST64(0x0400000004000004), CONST64(0x0400000404000004), - CONST64(0x0400040004000000), CONST64(0x0400040404000000), CONST64(0x0400040004000004), CONST64(0x0400040404000004), - CONST64(0x0400000004000400), CONST64(0x0400000404000400), CONST64(0x0400000004000404), CONST64(0x0400000404000404), - CONST64(0x0400040004000400), CONST64(0x0400040404000400), CONST64(0x0400040004000404), CONST64(0x0400040404000404), - CONST64(0x0404000004000000), CONST64(0x0404000404000000), CONST64(0x0404000004000004), CONST64(0x0404000404000004), - CONST64(0x0404040004000000), CONST64(0x0404040404000000), CONST64(0x0404040004000004), CONST64(0x0404040404000004), - CONST64(0x0404000004000400), CONST64(0x0404000404000400), CONST64(0x0404000004000404), CONST64(0x0404000404000404), - CONST64(0x0404040004000400), CONST64(0x0404040404000400), CONST64(0x0404040004000404), CONST64(0x0404040404000404), - CONST64(0x0400000004040000), CONST64(0x0400000404040000), CONST64(0x0400000004040004), CONST64(0x0400000404040004), - CONST64(0x0400040004040000), CONST64(0x0400040404040000), CONST64(0x0400040004040004), CONST64(0x0400040404040004), - CONST64(0x0400000004040400), CONST64(0x0400000404040400), CONST64(0x0400000004040404), CONST64(0x0400000404040404), - CONST64(0x0400040004040400), CONST64(0x0400040404040400), CONST64(0x0400040004040404), CONST64(0x0400040404040404), - CONST64(0x0404000004040000), CONST64(0x0404000404040000), CONST64(0x0404000004040004), CONST64(0x0404000404040004), - CONST64(0x0404040004040000), CONST64(0x0404040404040000), CONST64(0x0404040004040004), CONST64(0x0404040404040004), - CONST64(0x0404000004040400), CONST64(0x0404000404040400), CONST64(0x0404000004040404), CONST64(0x0404000404040404), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000400000000), CONST64(0x0000000000000004), CONST64(0x0000000400000004), + CONST64(0x0000040000000000), CONST64(0x0000040400000000), CONST64(0x0000040000000004), CONST64(0x0000040400000004), + CONST64(0x0000000000000400), CONST64(0x0000000400000400), CONST64(0x0000000000000404), CONST64(0x0000000400000404), + CONST64(0x0000040000000400), CONST64(0x0000040400000400), CONST64(0x0000040000000404), CONST64(0x0000040400000404), + CONST64(0x0004000000000000), CONST64(0x0004000400000000), CONST64(0x0004000000000004), CONST64(0x0004000400000004), + CONST64(0x0004040000000000), CONST64(0x0004040400000000), CONST64(0x0004040000000004), CONST64(0x0004040400000004), + CONST64(0x0004000000000400), CONST64(0x0004000400000400), CONST64(0x0004000000000404), CONST64(0x0004000400000404), + CONST64(0x0004040000000400), CONST64(0x0004040400000400), CONST64(0x0004040000000404), CONST64(0x0004040400000404), + CONST64(0x0000000000040000), CONST64(0x0000000400040000), CONST64(0x0000000000040004), CONST64(0x0000000400040004), + CONST64(0x0000040000040000), CONST64(0x0000040400040000), CONST64(0x0000040000040004), CONST64(0x0000040400040004), + CONST64(0x0000000000040400), CONST64(0x0000000400040400), CONST64(0x0000000000040404), CONST64(0x0000000400040404), + CONST64(0x0000040000040400), CONST64(0x0000040400040400), CONST64(0x0000040000040404), CONST64(0x0000040400040404), + CONST64(0x0004000000040000), CONST64(0x0004000400040000), CONST64(0x0004000000040004), CONST64(0x0004000400040004), + CONST64(0x0004040000040000), CONST64(0x0004040400040000), CONST64(0x0004040000040004), CONST64(0x0004040400040004), + CONST64(0x0004000000040400), CONST64(0x0004000400040400), CONST64(0x0004000000040404), CONST64(0x0004000400040404), + CONST64(0x0004040000040400), CONST64(0x0004040400040400), CONST64(0x0004040000040404), CONST64(0x0004040400040404), + CONST64(0x0400000000000000), CONST64(0x0400000400000000), CONST64(0x0400000000000004), CONST64(0x0400000400000004), + CONST64(0x0400040000000000), CONST64(0x0400040400000000), CONST64(0x0400040000000004), CONST64(0x0400040400000004), + CONST64(0x0400000000000400), CONST64(0x0400000400000400), CONST64(0x0400000000000404), CONST64(0x0400000400000404), + CONST64(0x0400040000000400), CONST64(0x0400040400000400), CONST64(0x0400040000000404), CONST64(0x0400040400000404), + CONST64(0x0404000000000000), CONST64(0x0404000400000000), CONST64(0x0404000000000004), CONST64(0x0404000400000004), + CONST64(0x0404040000000000), CONST64(0x0404040400000000), CONST64(0x0404040000000004), CONST64(0x0404040400000004), + CONST64(0x0404000000000400), CONST64(0x0404000400000400), CONST64(0x0404000000000404), CONST64(0x0404000400000404), + CONST64(0x0404040000000400), CONST64(0x0404040400000400), CONST64(0x0404040000000404), CONST64(0x0404040400000404), + CONST64(0x0400000000040000), CONST64(0x0400000400040000), CONST64(0x0400000000040004), CONST64(0x0400000400040004), + CONST64(0x0400040000040000), CONST64(0x0400040400040000), CONST64(0x0400040000040004), CONST64(0x0400040400040004), + CONST64(0x0400000000040400), CONST64(0x0400000400040400), CONST64(0x0400000000040404), CONST64(0x0400000400040404), + CONST64(0x0400040000040400), CONST64(0x0400040400040400), CONST64(0x0400040000040404), CONST64(0x0400040400040404), + CONST64(0x0404000000040000), CONST64(0x0404000400040000), CONST64(0x0404000000040004), CONST64(0x0404000400040004), + CONST64(0x0404040000040000), CONST64(0x0404040400040000), CONST64(0x0404040000040004), CONST64(0x0404040400040004), + CONST64(0x0404000000040400), CONST64(0x0404000400040400), CONST64(0x0404000000040404), CONST64(0x0404000400040404), + CONST64(0x0404040000040400), CONST64(0x0404040400040400), CONST64(0x0404040000040404), CONST64(0x0404040400040404), + CONST64(0x0000000004000000), CONST64(0x0000000404000000), CONST64(0x0000000004000004), CONST64(0x0000000404000004), + CONST64(0x0000040004000000), CONST64(0x0000040404000000), CONST64(0x0000040004000004), CONST64(0x0000040404000004), + CONST64(0x0000000004000400), CONST64(0x0000000404000400), CONST64(0x0000000004000404), CONST64(0x0000000404000404), + CONST64(0x0000040004000400), CONST64(0x0000040404000400), CONST64(0x0000040004000404), CONST64(0x0000040404000404), + CONST64(0x0004000004000000), CONST64(0x0004000404000000), CONST64(0x0004000004000004), CONST64(0x0004000404000004), + CONST64(0x0004040004000000), CONST64(0x0004040404000000), CONST64(0x0004040004000004), CONST64(0x0004040404000004), + CONST64(0x0004000004000400), CONST64(0x0004000404000400), CONST64(0x0004000004000404), CONST64(0x0004000404000404), + CONST64(0x0004040004000400), CONST64(0x0004040404000400), CONST64(0x0004040004000404), CONST64(0x0004040404000404), + CONST64(0x0000000004040000), CONST64(0x0000000404040000), CONST64(0x0000000004040004), CONST64(0x0000000404040004), + CONST64(0x0000040004040000), CONST64(0x0000040404040000), CONST64(0x0000040004040004), CONST64(0x0000040404040004), + CONST64(0x0000000004040400), CONST64(0x0000000404040400), CONST64(0x0000000004040404), CONST64(0x0000000404040404), + CONST64(0x0000040004040400), CONST64(0x0000040404040400), CONST64(0x0000040004040404), CONST64(0x0000040404040404), + CONST64(0x0004000004040000), CONST64(0x0004000404040000), CONST64(0x0004000004040004), CONST64(0x0004000404040004), + CONST64(0x0004040004040000), CONST64(0x0004040404040000), CONST64(0x0004040004040004), CONST64(0x0004040404040004), + CONST64(0x0004000004040400), CONST64(0x0004000404040400), CONST64(0x0004000004040404), CONST64(0x0004000404040404), + CONST64(0x0004040004040400), CONST64(0x0004040404040400), CONST64(0x0004040004040404), CONST64(0x0004040404040404), + CONST64(0x0400000004000000), CONST64(0x0400000404000000), CONST64(0x0400000004000004), CONST64(0x0400000404000004), + CONST64(0x0400040004000000), CONST64(0x0400040404000000), CONST64(0x0400040004000004), CONST64(0x0400040404000004), + CONST64(0x0400000004000400), CONST64(0x0400000404000400), CONST64(0x0400000004000404), CONST64(0x0400000404000404), + CONST64(0x0400040004000400), CONST64(0x0400040404000400), CONST64(0x0400040004000404), CONST64(0x0400040404000404), + CONST64(0x0404000004000000), CONST64(0x0404000404000000), CONST64(0x0404000004000004), CONST64(0x0404000404000004), + CONST64(0x0404040004000000), CONST64(0x0404040404000000), CONST64(0x0404040004000004), CONST64(0x0404040404000004), + CONST64(0x0404000004000400), CONST64(0x0404000404000400), CONST64(0x0404000004000404), CONST64(0x0404000404000404), + CONST64(0x0404040004000400), CONST64(0x0404040404000400), CONST64(0x0404040004000404), CONST64(0x0404040404000404), + CONST64(0x0400000004040000), CONST64(0x0400000404040000), CONST64(0x0400000004040004), CONST64(0x0400000404040004), + CONST64(0x0400040004040000), CONST64(0x0400040404040000), CONST64(0x0400040004040004), CONST64(0x0400040404040004), + CONST64(0x0400000004040400), CONST64(0x0400000404040400), CONST64(0x0400000004040404), CONST64(0x0400000404040404), + CONST64(0x0400040004040400), CONST64(0x0400040404040400), CONST64(0x0400040004040404), CONST64(0x0400040404040404), + CONST64(0x0404000004040000), CONST64(0x0404000404040000), CONST64(0x0404000004040004), CONST64(0x0404000404040004), + CONST64(0x0404040004040000), CONST64(0x0404040404040000), CONST64(0x0404040004040004), CONST64(0x0404040404040004), + CONST64(0x0404000004040400), CONST64(0x0404000404040400), CONST64(0x0404000004040404), CONST64(0x0404000404040404), CONST64(0x0404040004040400), CONST64(0x0404040404040400), CONST64(0x0404040004040404), CONST64(0x0404040404040404) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000200000000), CONST64(0x0000000000000002), CONST64(0x0000000200000002), - CONST64(0x0000020000000000), CONST64(0x0000020200000000), CONST64(0x0000020000000002), CONST64(0x0000020200000002), - CONST64(0x0000000000000200), CONST64(0x0000000200000200), CONST64(0x0000000000000202), CONST64(0x0000000200000202), - CONST64(0x0000020000000200), CONST64(0x0000020200000200), CONST64(0x0000020000000202), CONST64(0x0000020200000202), - CONST64(0x0002000000000000), CONST64(0x0002000200000000), CONST64(0x0002000000000002), CONST64(0x0002000200000002), - CONST64(0x0002020000000000), CONST64(0x0002020200000000), CONST64(0x0002020000000002), CONST64(0x0002020200000002), - CONST64(0x0002000000000200), CONST64(0x0002000200000200), CONST64(0x0002000000000202), CONST64(0x0002000200000202), - CONST64(0x0002020000000200), CONST64(0x0002020200000200), CONST64(0x0002020000000202), CONST64(0x0002020200000202), - CONST64(0x0000000000020000), CONST64(0x0000000200020000), CONST64(0x0000000000020002), CONST64(0x0000000200020002), - CONST64(0x0000020000020000), CONST64(0x0000020200020000), CONST64(0x0000020000020002), CONST64(0x0000020200020002), - CONST64(0x0000000000020200), CONST64(0x0000000200020200), CONST64(0x0000000000020202), CONST64(0x0000000200020202), - CONST64(0x0000020000020200), CONST64(0x0000020200020200), CONST64(0x0000020000020202), CONST64(0x0000020200020202), - CONST64(0x0002000000020000), CONST64(0x0002000200020000), CONST64(0x0002000000020002), CONST64(0x0002000200020002), - CONST64(0x0002020000020000), CONST64(0x0002020200020000), CONST64(0x0002020000020002), CONST64(0x0002020200020002), - CONST64(0x0002000000020200), CONST64(0x0002000200020200), CONST64(0x0002000000020202), CONST64(0x0002000200020202), - CONST64(0x0002020000020200), CONST64(0x0002020200020200), CONST64(0x0002020000020202), CONST64(0x0002020200020202), - CONST64(0x0200000000000000), CONST64(0x0200000200000000), CONST64(0x0200000000000002), CONST64(0x0200000200000002), - CONST64(0x0200020000000000), CONST64(0x0200020200000000), CONST64(0x0200020000000002), CONST64(0x0200020200000002), - CONST64(0x0200000000000200), CONST64(0x0200000200000200), CONST64(0x0200000000000202), CONST64(0x0200000200000202), - CONST64(0x0200020000000200), CONST64(0x0200020200000200), CONST64(0x0200020000000202), CONST64(0x0200020200000202), - CONST64(0x0202000000000000), CONST64(0x0202000200000000), CONST64(0x0202000000000002), CONST64(0x0202000200000002), - CONST64(0x0202020000000000), CONST64(0x0202020200000000), CONST64(0x0202020000000002), CONST64(0x0202020200000002), - CONST64(0x0202000000000200), CONST64(0x0202000200000200), CONST64(0x0202000000000202), CONST64(0x0202000200000202), - CONST64(0x0202020000000200), CONST64(0x0202020200000200), CONST64(0x0202020000000202), CONST64(0x0202020200000202), - CONST64(0x0200000000020000), CONST64(0x0200000200020000), CONST64(0x0200000000020002), CONST64(0x0200000200020002), - CONST64(0x0200020000020000), CONST64(0x0200020200020000), CONST64(0x0200020000020002), CONST64(0x0200020200020002), - CONST64(0x0200000000020200), CONST64(0x0200000200020200), CONST64(0x0200000000020202), CONST64(0x0200000200020202), - CONST64(0x0200020000020200), CONST64(0x0200020200020200), CONST64(0x0200020000020202), CONST64(0x0200020200020202), - CONST64(0x0202000000020000), CONST64(0x0202000200020000), CONST64(0x0202000000020002), CONST64(0x0202000200020002), - CONST64(0x0202020000020000), CONST64(0x0202020200020000), CONST64(0x0202020000020002), CONST64(0x0202020200020002), - CONST64(0x0202000000020200), CONST64(0x0202000200020200), CONST64(0x0202000000020202), CONST64(0x0202000200020202), - CONST64(0x0202020000020200), CONST64(0x0202020200020200), CONST64(0x0202020000020202), CONST64(0x0202020200020202), - CONST64(0x0000000002000000), CONST64(0x0000000202000000), CONST64(0x0000000002000002), CONST64(0x0000000202000002), - CONST64(0x0000020002000000), CONST64(0x0000020202000000), CONST64(0x0000020002000002), CONST64(0x0000020202000002), - CONST64(0x0000000002000200), CONST64(0x0000000202000200), CONST64(0x0000000002000202), CONST64(0x0000000202000202), - CONST64(0x0000020002000200), CONST64(0x0000020202000200), CONST64(0x0000020002000202), CONST64(0x0000020202000202), - CONST64(0x0002000002000000), CONST64(0x0002000202000000), CONST64(0x0002000002000002), CONST64(0x0002000202000002), - CONST64(0x0002020002000000), CONST64(0x0002020202000000), CONST64(0x0002020002000002), CONST64(0x0002020202000002), - CONST64(0x0002000002000200), CONST64(0x0002000202000200), CONST64(0x0002000002000202), CONST64(0x0002000202000202), - CONST64(0x0002020002000200), CONST64(0x0002020202000200), CONST64(0x0002020002000202), CONST64(0x0002020202000202), - CONST64(0x0000000002020000), CONST64(0x0000000202020000), CONST64(0x0000000002020002), CONST64(0x0000000202020002), - CONST64(0x0000020002020000), CONST64(0x0000020202020000), CONST64(0x0000020002020002), CONST64(0x0000020202020002), - CONST64(0x0000000002020200), CONST64(0x0000000202020200), CONST64(0x0000000002020202), CONST64(0x0000000202020202), - CONST64(0x0000020002020200), CONST64(0x0000020202020200), CONST64(0x0000020002020202), CONST64(0x0000020202020202), - CONST64(0x0002000002020000), CONST64(0x0002000202020000), CONST64(0x0002000002020002), CONST64(0x0002000202020002), - CONST64(0x0002020002020000), CONST64(0x0002020202020000), CONST64(0x0002020002020002), CONST64(0x0002020202020002), - CONST64(0x0002000002020200), CONST64(0x0002000202020200), CONST64(0x0002000002020202), CONST64(0x0002000202020202), - CONST64(0x0002020002020200), CONST64(0x0002020202020200), CONST64(0x0002020002020202), CONST64(0x0002020202020202), - CONST64(0x0200000002000000), CONST64(0x0200000202000000), CONST64(0x0200000002000002), CONST64(0x0200000202000002), - CONST64(0x0200020002000000), CONST64(0x0200020202000000), CONST64(0x0200020002000002), CONST64(0x0200020202000002), - CONST64(0x0200000002000200), CONST64(0x0200000202000200), CONST64(0x0200000002000202), CONST64(0x0200000202000202), - CONST64(0x0200020002000200), CONST64(0x0200020202000200), CONST64(0x0200020002000202), CONST64(0x0200020202000202), - CONST64(0x0202000002000000), CONST64(0x0202000202000000), CONST64(0x0202000002000002), CONST64(0x0202000202000002), - CONST64(0x0202020002000000), CONST64(0x0202020202000000), CONST64(0x0202020002000002), CONST64(0x0202020202000002), - CONST64(0x0202000002000200), CONST64(0x0202000202000200), CONST64(0x0202000002000202), CONST64(0x0202000202000202), - CONST64(0x0202020002000200), CONST64(0x0202020202000200), CONST64(0x0202020002000202), CONST64(0x0202020202000202), - CONST64(0x0200000002020000), CONST64(0x0200000202020000), CONST64(0x0200000002020002), CONST64(0x0200000202020002), - CONST64(0x0200020002020000), CONST64(0x0200020202020000), CONST64(0x0200020002020002), CONST64(0x0200020202020002), - CONST64(0x0200000002020200), CONST64(0x0200000202020200), CONST64(0x0200000002020202), CONST64(0x0200000202020202), - CONST64(0x0200020002020200), CONST64(0x0200020202020200), CONST64(0x0200020002020202), CONST64(0x0200020202020202), - CONST64(0x0202000002020000), CONST64(0x0202000202020000), CONST64(0x0202000002020002), CONST64(0x0202000202020002), - CONST64(0x0202020002020000), CONST64(0x0202020202020000), CONST64(0x0202020002020002), CONST64(0x0202020202020002), - CONST64(0x0202000002020200), CONST64(0x0202000202020200), CONST64(0x0202000002020202), CONST64(0x0202000202020202), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000200000000), CONST64(0x0000000000000002), CONST64(0x0000000200000002), + CONST64(0x0000020000000000), CONST64(0x0000020200000000), CONST64(0x0000020000000002), CONST64(0x0000020200000002), + CONST64(0x0000000000000200), CONST64(0x0000000200000200), CONST64(0x0000000000000202), CONST64(0x0000000200000202), + CONST64(0x0000020000000200), CONST64(0x0000020200000200), CONST64(0x0000020000000202), CONST64(0x0000020200000202), + CONST64(0x0002000000000000), CONST64(0x0002000200000000), CONST64(0x0002000000000002), CONST64(0x0002000200000002), + CONST64(0x0002020000000000), CONST64(0x0002020200000000), CONST64(0x0002020000000002), CONST64(0x0002020200000002), + CONST64(0x0002000000000200), CONST64(0x0002000200000200), CONST64(0x0002000000000202), CONST64(0x0002000200000202), + CONST64(0x0002020000000200), CONST64(0x0002020200000200), CONST64(0x0002020000000202), CONST64(0x0002020200000202), + CONST64(0x0000000000020000), CONST64(0x0000000200020000), CONST64(0x0000000000020002), CONST64(0x0000000200020002), + CONST64(0x0000020000020000), CONST64(0x0000020200020000), CONST64(0x0000020000020002), CONST64(0x0000020200020002), + CONST64(0x0000000000020200), CONST64(0x0000000200020200), CONST64(0x0000000000020202), CONST64(0x0000000200020202), + CONST64(0x0000020000020200), CONST64(0x0000020200020200), CONST64(0x0000020000020202), CONST64(0x0000020200020202), + CONST64(0x0002000000020000), CONST64(0x0002000200020000), CONST64(0x0002000000020002), CONST64(0x0002000200020002), + CONST64(0x0002020000020000), CONST64(0x0002020200020000), CONST64(0x0002020000020002), CONST64(0x0002020200020002), + CONST64(0x0002000000020200), CONST64(0x0002000200020200), CONST64(0x0002000000020202), CONST64(0x0002000200020202), + CONST64(0x0002020000020200), CONST64(0x0002020200020200), CONST64(0x0002020000020202), CONST64(0x0002020200020202), + CONST64(0x0200000000000000), CONST64(0x0200000200000000), CONST64(0x0200000000000002), CONST64(0x0200000200000002), + CONST64(0x0200020000000000), CONST64(0x0200020200000000), CONST64(0x0200020000000002), CONST64(0x0200020200000002), + CONST64(0x0200000000000200), CONST64(0x0200000200000200), CONST64(0x0200000000000202), CONST64(0x0200000200000202), + CONST64(0x0200020000000200), CONST64(0x0200020200000200), CONST64(0x0200020000000202), CONST64(0x0200020200000202), + CONST64(0x0202000000000000), CONST64(0x0202000200000000), CONST64(0x0202000000000002), CONST64(0x0202000200000002), + CONST64(0x0202020000000000), CONST64(0x0202020200000000), CONST64(0x0202020000000002), CONST64(0x0202020200000002), + CONST64(0x0202000000000200), CONST64(0x0202000200000200), CONST64(0x0202000000000202), CONST64(0x0202000200000202), + CONST64(0x0202020000000200), CONST64(0x0202020200000200), CONST64(0x0202020000000202), CONST64(0x0202020200000202), + CONST64(0x0200000000020000), CONST64(0x0200000200020000), CONST64(0x0200000000020002), CONST64(0x0200000200020002), + CONST64(0x0200020000020000), CONST64(0x0200020200020000), CONST64(0x0200020000020002), CONST64(0x0200020200020002), + CONST64(0x0200000000020200), CONST64(0x0200000200020200), CONST64(0x0200000000020202), CONST64(0x0200000200020202), + CONST64(0x0200020000020200), CONST64(0x0200020200020200), CONST64(0x0200020000020202), CONST64(0x0200020200020202), + CONST64(0x0202000000020000), CONST64(0x0202000200020000), CONST64(0x0202000000020002), CONST64(0x0202000200020002), + CONST64(0x0202020000020000), CONST64(0x0202020200020000), CONST64(0x0202020000020002), CONST64(0x0202020200020002), + CONST64(0x0202000000020200), CONST64(0x0202000200020200), CONST64(0x0202000000020202), CONST64(0x0202000200020202), + CONST64(0x0202020000020200), CONST64(0x0202020200020200), CONST64(0x0202020000020202), CONST64(0x0202020200020202), + CONST64(0x0000000002000000), CONST64(0x0000000202000000), CONST64(0x0000000002000002), CONST64(0x0000000202000002), + CONST64(0x0000020002000000), CONST64(0x0000020202000000), CONST64(0x0000020002000002), CONST64(0x0000020202000002), + CONST64(0x0000000002000200), CONST64(0x0000000202000200), CONST64(0x0000000002000202), CONST64(0x0000000202000202), + CONST64(0x0000020002000200), CONST64(0x0000020202000200), CONST64(0x0000020002000202), CONST64(0x0000020202000202), + CONST64(0x0002000002000000), CONST64(0x0002000202000000), CONST64(0x0002000002000002), CONST64(0x0002000202000002), + CONST64(0x0002020002000000), CONST64(0x0002020202000000), CONST64(0x0002020002000002), CONST64(0x0002020202000002), + CONST64(0x0002000002000200), CONST64(0x0002000202000200), CONST64(0x0002000002000202), CONST64(0x0002000202000202), + CONST64(0x0002020002000200), CONST64(0x0002020202000200), CONST64(0x0002020002000202), CONST64(0x0002020202000202), + CONST64(0x0000000002020000), CONST64(0x0000000202020000), CONST64(0x0000000002020002), CONST64(0x0000000202020002), + CONST64(0x0000020002020000), CONST64(0x0000020202020000), CONST64(0x0000020002020002), CONST64(0x0000020202020002), + CONST64(0x0000000002020200), CONST64(0x0000000202020200), CONST64(0x0000000002020202), CONST64(0x0000000202020202), + CONST64(0x0000020002020200), CONST64(0x0000020202020200), CONST64(0x0000020002020202), CONST64(0x0000020202020202), + CONST64(0x0002000002020000), CONST64(0x0002000202020000), CONST64(0x0002000002020002), CONST64(0x0002000202020002), + CONST64(0x0002020002020000), CONST64(0x0002020202020000), CONST64(0x0002020002020002), CONST64(0x0002020202020002), + CONST64(0x0002000002020200), CONST64(0x0002000202020200), CONST64(0x0002000002020202), CONST64(0x0002000202020202), + CONST64(0x0002020002020200), CONST64(0x0002020202020200), CONST64(0x0002020002020202), CONST64(0x0002020202020202), + CONST64(0x0200000002000000), CONST64(0x0200000202000000), CONST64(0x0200000002000002), CONST64(0x0200000202000002), + CONST64(0x0200020002000000), CONST64(0x0200020202000000), CONST64(0x0200020002000002), CONST64(0x0200020202000002), + CONST64(0x0200000002000200), CONST64(0x0200000202000200), CONST64(0x0200000002000202), CONST64(0x0200000202000202), + CONST64(0x0200020002000200), CONST64(0x0200020202000200), CONST64(0x0200020002000202), CONST64(0x0200020202000202), + CONST64(0x0202000002000000), CONST64(0x0202000202000000), CONST64(0x0202000002000002), CONST64(0x0202000202000002), + CONST64(0x0202020002000000), CONST64(0x0202020202000000), CONST64(0x0202020002000002), CONST64(0x0202020202000002), + CONST64(0x0202000002000200), CONST64(0x0202000202000200), CONST64(0x0202000002000202), CONST64(0x0202000202000202), + CONST64(0x0202020002000200), CONST64(0x0202020202000200), CONST64(0x0202020002000202), CONST64(0x0202020202000202), + CONST64(0x0200000002020000), CONST64(0x0200000202020000), CONST64(0x0200000002020002), CONST64(0x0200000202020002), + CONST64(0x0200020002020000), CONST64(0x0200020202020000), CONST64(0x0200020002020002), CONST64(0x0200020202020002), + CONST64(0x0200000002020200), CONST64(0x0200000202020200), CONST64(0x0200000002020202), CONST64(0x0200000202020202), + CONST64(0x0200020002020200), CONST64(0x0200020202020200), CONST64(0x0200020002020202), CONST64(0x0200020202020202), + CONST64(0x0202000002020000), CONST64(0x0202000202020000), CONST64(0x0202000002020002), CONST64(0x0202000202020002), + CONST64(0x0202020002020000), CONST64(0x0202020202020000), CONST64(0x0202020002020002), CONST64(0x0202020202020002), + CONST64(0x0202000002020200), CONST64(0x0202000202020200), CONST64(0x0202000002020202), CONST64(0x0202000202020202), CONST64(0x0202020002020200), CONST64(0x0202020202020200), CONST64(0x0202020002020202), CONST64(0x0202020202020202) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000010000000000), CONST64(0x0000000000000100), CONST64(0x0000010000000100), - CONST64(0x0001000000000000), CONST64(0x0001010000000000), CONST64(0x0001000000000100), CONST64(0x0001010000000100), - CONST64(0x0000000000010000), CONST64(0x0000010000010000), CONST64(0x0000000000010100), CONST64(0x0000010000010100), - CONST64(0x0001000000010000), CONST64(0x0001010000010000), CONST64(0x0001000000010100), CONST64(0x0001010000010100), - CONST64(0x0100000000000000), CONST64(0x0100010000000000), CONST64(0x0100000000000100), CONST64(0x0100010000000100), - CONST64(0x0101000000000000), CONST64(0x0101010000000000), CONST64(0x0101000000000100), CONST64(0x0101010000000100), - CONST64(0x0100000000010000), CONST64(0x0100010000010000), CONST64(0x0100000000010100), CONST64(0x0100010000010100), - CONST64(0x0101000000010000), CONST64(0x0101010000010000), CONST64(0x0101000000010100), CONST64(0x0101010000010100), - CONST64(0x0000000001000000), CONST64(0x0000010001000000), CONST64(0x0000000001000100), CONST64(0x0000010001000100), - CONST64(0x0001000001000000), CONST64(0x0001010001000000), CONST64(0x0001000001000100), CONST64(0x0001010001000100), - CONST64(0x0000000001010000), CONST64(0x0000010001010000), CONST64(0x0000000001010100), CONST64(0x0000010001010100), - CONST64(0x0001000001010000), CONST64(0x0001010001010000), CONST64(0x0001000001010100), CONST64(0x0001010001010100), - CONST64(0x0100000001000000), CONST64(0x0100010001000000), CONST64(0x0100000001000100), CONST64(0x0100010001000100), - CONST64(0x0101000001000000), CONST64(0x0101010001000000), CONST64(0x0101000001000100), CONST64(0x0101010001000100), - CONST64(0x0100000001010000), CONST64(0x0100010001010000), CONST64(0x0100000001010100), CONST64(0x0100010001010100), - CONST64(0x0101000001010000), CONST64(0x0101010001010000), CONST64(0x0101000001010100), CONST64(0x0101010001010100), - CONST64(0x0000000100000000), CONST64(0x0000010100000000), CONST64(0x0000000100000100), CONST64(0x0000010100000100), - CONST64(0x0001000100000000), CONST64(0x0001010100000000), CONST64(0x0001000100000100), CONST64(0x0001010100000100), - CONST64(0x0000000100010000), CONST64(0x0000010100010000), CONST64(0x0000000100010100), CONST64(0x0000010100010100), - CONST64(0x0001000100010000), CONST64(0x0001010100010000), CONST64(0x0001000100010100), CONST64(0x0001010100010100), - CONST64(0x0100000100000000), CONST64(0x0100010100000000), CONST64(0x0100000100000100), CONST64(0x0100010100000100), - CONST64(0x0101000100000000), CONST64(0x0101010100000000), CONST64(0x0101000100000100), CONST64(0x0101010100000100), - CONST64(0x0100000100010000), CONST64(0x0100010100010000), CONST64(0x0100000100010100), CONST64(0x0100010100010100), - CONST64(0x0101000100010000), CONST64(0x0101010100010000), CONST64(0x0101000100010100), CONST64(0x0101010100010100), - CONST64(0x0000000101000000), CONST64(0x0000010101000000), CONST64(0x0000000101000100), CONST64(0x0000010101000100), - CONST64(0x0001000101000000), CONST64(0x0001010101000000), CONST64(0x0001000101000100), CONST64(0x0001010101000100), - CONST64(0x0000000101010000), CONST64(0x0000010101010000), CONST64(0x0000000101010100), CONST64(0x0000010101010100), - CONST64(0x0001000101010000), CONST64(0x0001010101010000), CONST64(0x0001000101010100), CONST64(0x0001010101010100), - CONST64(0x0100000101000000), CONST64(0x0100010101000000), CONST64(0x0100000101000100), CONST64(0x0100010101000100), - CONST64(0x0101000101000000), CONST64(0x0101010101000000), CONST64(0x0101000101000100), CONST64(0x0101010101000100), - CONST64(0x0100000101010000), CONST64(0x0100010101010000), CONST64(0x0100000101010100), CONST64(0x0100010101010100), - CONST64(0x0101000101010000), CONST64(0x0101010101010000), CONST64(0x0101000101010100), CONST64(0x0101010101010100), - CONST64(0x0000000000000001), CONST64(0x0000010000000001), CONST64(0x0000000000000101), CONST64(0x0000010000000101), - CONST64(0x0001000000000001), CONST64(0x0001010000000001), CONST64(0x0001000000000101), CONST64(0x0001010000000101), - CONST64(0x0000000000010001), CONST64(0x0000010000010001), CONST64(0x0000000000010101), CONST64(0x0000010000010101), - CONST64(0x0001000000010001), CONST64(0x0001010000010001), CONST64(0x0001000000010101), CONST64(0x0001010000010101), - CONST64(0x0100000000000001), CONST64(0x0100010000000001), CONST64(0x0100000000000101), CONST64(0x0100010000000101), - CONST64(0x0101000000000001), CONST64(0x0101010000000001), CONST64(0x0101000000000101), CONST64(0x0101010000000101), - CONST64(0x0100000000010001), CONST64(0x0100010000010001), CONST64(0x0100000000010101), CONST64(0x0100010000010101), - CONST64(0x0101000000010001), CONST64(0x0101010000010001), CONST64(0x0101000000010101), CONST64(0x0101010000010101), - CONST64(0x0000000001000001), CONST64(0x0000010001000001), CONST64(0x0000000001000101), CONST64(0x0000010001000101), - CONST64(0x0001000001000001), CONST64(0x0001010001000001), CONST64(0x0001000001000101), CONST64(0x0001010001000101), - CONST64(0x0000000001010001), CONST64(0x0000010001010001), CONST64(0x0000000001010101), CONST64(0x0000010001010101), - CONST64(0x0001000001010001), CONST64(0x0001010001010001), CONST64(0x0001000001010101), CONST64(0x0001010001010101), - CONST64(0x0100000001000001), CONST64(0x0100010001000001), CONST64(0x0100000001000101), CONST64(0x0100010001000101), - CONST64(0x0101000001000001), CONST64(0x0101010001000001), CONST64(0x0101000001000101), CONST64(0x0101010001000101), - CONST64(0x0100000001010001), CONST64(0x0100010001010001), CONST64(0x0100000001010101), CONST64(0x0100010001010101), - CONST64(0x0101000001010001), CONST64(0x0101010001010001), CONST64(0x0101000001010101), CONST64(0x0101010001010101), - CONST64(0x0000000100000001), CONST64(0x0000010100000001), CONST64(0x0000000100000101), CONST64(0x0000010100000101), - CONST64(0x0001000100000001), CONST64(0x0001010100000001), CONST64(0x0001000100000101), CONST64(0x0001010100000101), - CONST64(0x0000000100010001), CONST64(0x0000010100010001), CONST64(0x0000000100010101), CONST64(0x0000010100010101), - CONST64(0x0001000100010001), CONST64(0x0001010100010001), CONST64(0x0001000100010101), CONST64(0x0001010100010101), - CONST64(0x0100000100000001), CONST64(0x0100010100000001), CONST64(0x0100000100000101), CONST64(0x0100010100000101), - CONST64(0x0101000100000001), CONST64(0x0101010100000001), CONST64(0x0101000100000101), CONST64(0x0101010100000101), - CONST64(0x0100000100010001), CONST64(0x0100010100010001), CONST64(0x0100000100010101), CONST64(0x0100010100010101), - CONST64(0x0101000100010001), CONST64(0x0101010100010001), CONST64(0x0101000100010101), CONST64(0x0101010100010101), - CONST64(0x0000000101000001), CONST64(0x0000010101000001), CONST64(0x0000000101000101), CONST64(0x0000010101000101), - CONST64(0x0001000101000001), CONST64(0x0001010101000001), CONST64(0x0001000101000101), CONST64(0x0001010101000101), - CONST64(0x0000000101010001), CONST64(0x0000010101010001), CONST64(0x0000000101010101), CONST64(0x0000010101010101), - CONST64(0x0001000101010001), CONST64(0x0001010101010001), CONST64(0x0001000101010101), CONST64(0x0001010101010101), - CONST64(0x0100000101000001), CONST64(0x0100010101000001), CONST64(0x0100000101000101), CONST64(0x0100010101000101), - CONST64(0x0101000101000001), CONST64(0x0101010101000001), CONST64(0x0101000101000101), CONST64(0x0101010101000101), - CONST64(0x0100000101010001), CONST64(0x0100010101010001), CONST64(0x0100000101010101), CONST64(0x0100010101010101), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000010000000000), CONST64(0x0000000000000100), CONST64(0x0000010000000100), + CONST64(0x0001000000000000), CONST64(0x0001010000000000), CONST64(0x0001000000000100), CONST64(0x0001010000000100), + CONST64(0x0000000000010000), CONST64(0x0000010000010000), CONST64(0x0000000000010100), CONST64(0x0000010000010100), + CONST64(0x0001000000010000), CONST64(0x0001010000010000), CONST64(0x0001000000010100), CONST64(0x0001010000010100), + CONST64(0x0100000000000000), CONST64(0x0100010000000000), CONST64(0x0100000000000100), CONST64(0x0100010000000100), + CONST64(0x0101000000000000), CONST64(0x0101010000000000), CONST64(0x0101000000000100), CONST64(0x0101010000000100), + CONST64(0x0100000000010000), CONST64(0x0100010000010000), CONST64(0x0100000000010100), CONST64(0x0100010000010100), + CONST64(0x0101000000010000), CONST64(0x0101010000010000), CONST64(0x0101000000010100), CONST64(0x0101010000010100), + CONST64(0x0000000001000000), CONST64(0x0000010001000000), CONST64(0x0000000001000100), CONST64(0x0000010001000100), + CONST64(0x0001000001000000), CONST64(0x0001010001000000), CONST64(0x0001000001000100), CONST64(0x0001010001000100), + CONST64(0x0000000001010000), CONST64(0x0000010001010000), CONST64(0x0000000001010100), CONST64(0x0000010001010100), + CONST64(0x0001000001010000), CONST64(0x0001010001010000), CONST64(0x0001000001010100), CONST64(0x0001010001010100), + CONST64(0x0100000001000000), CONST64(0x0100010001000000), CONST64(0x0100000001000100), CONST64(0x0100010001000100), + CONST64(0x0101000001000000), CONST64(0x0101010001000000), CONST64(0x0101000001000100), CONST64(0x0101010001000100), + CONST64(0x0100000001010000), CONST64(0x0100010001010000), CONST64(0x0100000001010100), CONST64(0x0100010001010100), + CONST64(0x0101000001010000), CONST64(0x0101010001010000), CONST64(0x0101000001010100), CONST64(0x0101010001010100), + CONST64(0x0000000100000000), CONST64(0x0000010100000000), CONST64(0x0000000100000100), CONST64(0x0000010100000100), + CONST64(0x0001000100000000), CONST64(0x0001010100000000), CONST64(0x0001000100000100), CONST64(0x0001010100000100), + CONST64(0x0000000100010000), CONST64(0x0000010100010000), CONST64(0x0000000100010100), CONST64(0x0000010100010100), + CONST64(0x0001000100010000), CONST64(0x0001010100010000), CONST64(0x0001000100010100), CONST64(0x0001010100010100), + CONST64(0x0100000100000000), CONST64(0x0100010100000000), CONST64(0x0100000100000100), CONST64(0x0100010100000100), + CONST64(0x0101000100000000), CONST64(0x0101010100000000), CONST64(0x0101000100000100), CONST64(0x0101010100000100), + CONST64(0x0100000100010000), CONST64(0x0100010100010000), CONST64(0x0100000100010100), CONST64(0x0100010100010100), + CONST64(0x0101000100010000), CONST64(0x0101010100010000), CONST64(0x0101000100010100), CONST64(0x0101010100010100), + CONST64(0x0000000101000000), CONST64(0x0000010101000000), CONST64(0x0000000101000100), CONST64(0x0000010101000100), + CONST64(0x0001000101000000), CONST64(0x0001010101000000), CONST64(0x0001000101000100), CONST64(0x0001010101000100), + CONST64(0x0000000101010000), CONST64(0x0000010101010000), CONST64(0x0000000101010100), CONST64(0x0000010101010100), + CONST64(0x0001000101010000), CONST64(0x0001010101010000), CONST64(0x0001000101010100), CONST64(0x0001010101010100), + CONST64(0x0100000101000000), CONST64(0x0100010101000000), CONST64(0x0100000101000100), CONST64(0x0100010101000100), + CONST64(0x0101000101000000), CONST64(0x0101010101000000), CONST64(0x0101000101000100), CONST64(0x0101010101000100), + CONST64(0x0100000101010000), CONST64(0x0100010101010000), CONST64(0x0100000101010100), CONST64(0x0100010101010100), + CONST64(0x0101000101010000), CONST64(0x0101010101010000), CONST64(0x0101000101010100), CONST64(0x0101010101010100), + CONST64(0x0000000000000001), CONST64(0x0000010000000001), CONST64(0x0000000000000101), CONST64(0x0000010000000101), + CONST64(0x0001000000000001), CONST64(0x0001010000000001), CONST64(0x0001000000000101), CONST64(0x0001010000000101), + CONST64(0x0000000000010001), CONST64(0x0000010000010001), CONST64(0x0000000000010101), CONST64(0x0000010000010101), + CONST64(0x0001000000010001), CONST64(0x0001010000010001), CONST64(0x0001000000010101), CONST64(0x0001010000010101), + CONST64(0x0100000000000001), CONST64(0x0100010000000001), CONST64(0x0100000000000101), CONST64(0x0100010000000101), + CONST64(0x0101000000000001), CONST64(0x0101010000000001), CONST64(0x0101000000000101), CONST64(0x0101010000000101), + CONST64(0x0100000000010001), CONST64(0x0100010000010001), CONST64(0x0100000000010101), CONST64(0x0100010000010101), + CONST64(0x0101000000010001), CONST64(0x0101010000010001), CONST64(0x0101000000010101), CONST64(0x0101010000010101), + CONST64(0x0000000001000001), CONST64(0x0000010001000001), CONST64(0x0000000001000101), CONST64(0x0000010001000101), + CONST64(0x0001000001000001), CONST64(0x0001010001000001), CONST64(0x0001000001000101), CONST64(0x0001010001000101), + CONST64(0x0000000001010001), CONST64(0x0000010001010001), CONST64(0x0000000001010101), CONST64(0x0000010001010101), + CONST64(0x0001000001010001), CONST64(0x0001010001010001), CONST64(0x0001000001010101), CONST64(0x0001010001010101), + CONST64(0x0100000001000001), CONST64(0x0100010001000001), CONST64(0x0100000001000101), CONST64(0x0100010001000101), + CONST64(0x0101000001000001), CONST64(0x0101010001000001), CONST64(0x0101000001000101), CONST64(0x0101010001000101), + CONST64(0x0100000001010001), CONST64(0x0100010001010001), CONST64(0x0100000001010101), CONST64(0x0100010001010101), + CONST64(0x0101000001010001), CONST64(0x0101010001010001), CONST64(0x0101000001010101), CONST64(0x0101010001010101), + CONST64(0x0000000100000001), CONST64(0x0000010100000001), CONST64(0x0000000100000101), CONST64(0x0000010100000101), + CONST64(0x0001000100000001), CONST64(0x0001010100000001), CONST64(0x0001000100000101), CONST64(0x0001010100000101), + CONST64(0x0000000100010001), CONST64(0x0000010100010001), CONST64(0x0000000100010101), CONST64(0x0000010100010101), + CONST64(0x0001000100010001), CONST64(0x0001010100010001), CONST64(0x0001000100010101), CONST64(0x0001010100010101), + CONST64(0x0100000100000001), CONST64(0x0100010100000001), CONST64(0x0100000100000101), CONST64(0x0100010100000101), + CONST64(0x0101000100000001), CONST64(0x0101010100000001), CONST64(0x0101000100000101), CONST64(0x0101010100000101), + CONST64(0x0100000100010001), CONST64(0x0100010100010001), CONST64(0x0100000100010101), CONST64(0x0100010100010101), + CONST64(0x0101000100010001), CONST64(0x0101010100010001), CONST64(0x0101000100010101), CONST64(0x0101010100010101), + CONST64(0x0000000101000001), CONST64(0x0000010101000001), CONST64(0x0000000101000101), CONST64(0x0000010101000101), + CONST64(0x0001000101000001), CONST64(0x0001010101000001), CONST64(0x0001000101000101), CONST64(0x0001010101000101), + CONST64(0x0000000101010001), CONST64(0x0000010101010001), CONST64(0x0000000101010101), CONST64(0x0000010101010101), + CONST64(0x0001000101010001), CONST64(0x0001010101010001), CONST64(0x0001000101010101), CONST64(0x0001010101010101), + CONST64(0x0100000101000001), CONST64(0x0100010101000001), CONST64(0x0100000101000101), CONST64(0x0100010101000101), + CONST64(0x0101000101000001), CONST64(0x0101010101000001), CONST64(0x0101000101000101), CONST64(0x0101010101000101), + CONST64(0x0100000101010001), CONST64(0x0100010101010001), CONST64(0x0100000101010101), CONST64(0x0100010101010101), CONST64(0x0101000101010001), CONST64(0x0101010101010001), CONST64(0x0101000101010101), CONST64(0x0101010101010101) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000008000000000), CONST64(0x0000000000000080), CONST64(0x0000008000000080), - CONST64(0x0000800000000000), CONST64(0x0000808000000000), CONST64(0x0000800000000080), CONST64(0x0000808000000080), - CONST64(0x0000000000008000), CONST64(0x0000008000008000), CONST64(0x0000000000008080), CONST64(0x0000008000008080), - CONST64(0x0000800000008000), CONST64(0x0000808000008000), CONST64(0x0000800000008080), CONST64(0x0000808000008080), - CONST64(0x0080000000000000), CONST64(0x0080008000000000), CONST64(0x0080000000000080), CONST64(0x0080008000000080), - CONST64(0x0080800000000000), CONST64(0x0080808000000000), CONST64(0x0080800000000080), CONST64(0x0080808000000080), - CONST64(0x0080000000008000), CONST64(0x0080008000008000), CONST64(0x0080000000008080), CONST64(0x0080008000008080), - CONST64(0x0080800000008000), CONST64(0x0080808000008000), CONST64(0x0080800000008080), CONST64(0x0080808000008080), - CONST64(0x0000000000800000), CONST64(0x0000008000800000), CONST64(0x0000000000800080), CONST64(0x0000008000800080), - CONST64(0x0000800000800000), CONST64(0x0000808000800000), CONST64(0x0000800000800080), CONST64(0x0000808000800080), - CONST64(0x0000000000808000), CONST64(0x0000008000808000), CONST64(0x0000000000808080), CONST64(0x0000008000808080), - CONST64(0x0000800000808000), CONST64(0x0000808000808000), CONST64(0x0000800000808080), CONST64(0x0000808000808080), - CONST64(0x0080000000800000), CONST64(0x0080008000800000), CONST64(0x0080000000800080), CONST64(0x0080008000800080), - CONST64(0x0080800000800000), CONST64(0x0080808000800000), CONST64(0x0080800000800080), CONST64(0x0080808000800080), - CONST64(0x0080000000808000), CONST64(0x0080008000808000), CONST64(0x0080000000808080), CONST64(0x0080008000808080), - CONST64(0x0080800000808000), CONST64(0x0080808000808000), CONST64(0x0080800000808080), CONST64(0x0080808000808080), - CONST64(0x8000000000000000), CONST64(0x8000008000000000), CONST64(0x8000000000000080), CONST64(0x8000008000000080), - CONST64(0x8000800000000000), CONST64(0x8000808000000000), CONST64(0x8000800000000080), CONST64(0x8000808000000080), - CONST64(0x8000000000008000), CONST64(0x8000008000008000), CONST64(0x8000000000008080), CONST64(0x8000008000008080), - CONST64(0x8000800000008000), CONST64(0x8000808000008000), CONST64(0x8000800000008080), CONST64(0x8000808000008080), - CONST64(0x8080000000000000), CONST64(0x8080008000000000), CONST64(0x8080000000000080), CONST64(0x8080008000000080), - CONST64(0x8080800000000000), CONST64(0x8080808000000000), CONST64(0x8080800000000080), CONST64(0x8080808000000080), - CONST64(0x8080000000008000), CONST64(0x8080008000008000), CONST64(0x8080000000008080), CONST64(0x8080008000008080), - CONST64(0x8080800000008000), CONST64(0x8080808000008000), CONST64(0x8080800000008080), CONST64(0x8080808000008080), - CONST64(0x8000000000800000), CONST64(0x8000008000800000), CONST64(0x8000000000800080), CONST64(0x8000008000800080), - CONST64(0x8000800000800000), CONST64(0x8000808000800000), CONST64(0x8000800000800080), CONST64(0x8000808000800080), - CONST64(0x8000000000808000), CONST64(0x8000008000808000), CONST64(0x8000000000808080), CONST64(0x8000008000808080), - CONST64(0x8000800000808000), CONST64(0x8000808000808000), CONST64(0x8000800000808080), CONST64(0x8000808000808080), - CONST64(0x8080000000800000), CONST64(0x8080008000800000), CONST64(0x8080000000800080), CONST64(0x8080008000800080), - CONST64(0x8080800000800000), CONST64(0x8080808000800000), CONST64(0x8080800000800080), CONST64(0x8080808000800080), - CONST64(0x8080000000808000), CONST64(0x8080008000808000), CONST64(0x8080000000808080), CONST64(0x8080008000808080), - CONST64(0x8080800000808000), CONST64(0x8080808000808000), CONST64(0x8080800000808080), CONST64(0x8080808000808080), - CONST64(0x0000000080000000), CONST64(0x0000008080000000), CONST64(0x0000000080000080), CONST64(0x0000008080000080), - CONST64(0x0000800080000000), CONST64(0x0000808080000000), CONST64(0x0000800080000080), CONST64(0x0000808080000080), - CONST64(0x0000000080008000), CONST64(0x0000008080008000), CONST64(0x0000000080008080), CONST64(0x0000008080008080), - CONST64(0x0000800080008000), CONST64(0x0000808080008000), CONST64(0x0000800080008080), CONST64(0x0000808080008080), - CONST64(0x0080000080000000), CONST64(0x0080008080000000), CONST64(0x0080000080000080), CONST64(0x0080008080000080), - CONST64(0x0080800080000000), CONST64(0x0080808080000000), CONST64(0x0080800080000080), CONST64(0x0080808080000080), - CONST64(0x0080000080008000), CONST64(0x0080008080008000), CONST64(0x0080000080008080), CONST64(0x0080008080008080), - CONST64(0x0080800080008000), CONST64(0x0080808080008000), CONST64(0x0080800080008080), CONST64(0x0080808080008080), - CONST64(0x0000000080800000), CONST64(0x0000008080800000), CONST64(0x0000000080800080), CONST64(0x0000008080800080), - CONST64(0x0000800080800000), CONST64(0x0000808080800000), CONST64(0x0000800080800080), CONST64(0x0000808080800080), - CONST64(0x0000000080808000), CONST64(0x0000008080808000), CONST64(0x0000000080808080), CONST64(0x0000008080808080), - CONST64(0x0000800080808000), CONST64(0x0000808080808000), CONST64(0x0000800080808080), CONST64(0x0000808080808080), - CONST64(0x0080000080800000), CONST64(0x0080008080800000), CONST64(0x0080000080800080), CONST64(0x0080008080800080), - CONST64(0x0080800080800000), CONST64(0x0080808080800000), CONST64(0x0080800080800080), CONST64(0x0080808080800080), - CONST64(0x0080000080808000), CONST64(0x0080008080808000), CONST64(0x0080000080808080), CONST64(0x0080008080808080), - CONST64(0x0080800080808000), CONST64(0x0080808080808000), CONST64(0x0080800080808080), CONST64(0x0080808080808080), - CONST64(0x8000000080000000), CONST64(0x8000008080000000), CONST64(0x8000000080000080), CONST64(0x8000008080000080), - CONST64(0x8000800080000000), CONST64(0x8000808080000000), CONST64(0x8000800080000080), CONST64(0x8000808080000080), - CONST64(0x8000000080008000), CONST64(0x8000008080008000), CONST64(0x8000000080008080), CONST64(0x8000008080008080), - CONST64(0x8000800080008000), CONST64(0x8000808080008000), CONST64(0x8000800080008080), CONST64(0x8000808080008080), - CONST64(0x8080000080000000), CONST64(0x8080008080000000), CONST64(0x8080000080000080), CONST64(0x8080008080000080), - CONST64(0x8080800080000000), CONST64(0x8080808080000000), CONST64(0x8080800080000080), CONST64(0x8080808080000080), - CONST64(0x8080000080008000), CONST64(0x8080008080008000), CONST64(0x8080000080008080), CONST64(0x8080008080008080), - CONST64(0x8080800080008000), CONST64(0x8080808080008000), CONST64(0x8080800080008080), CONST64(0x8080808080008080), - CONST64(0x8000000080800000), CONST64(0x8000008080800000), CONST64(0x8000000080800080), CONST64(0x8000008080800080), - CONST64(0x8000800080800000), CONST64(0x8000808080800000), CONST64(0x8000800080800080), CONST64(0x8000808080800080), - CONST64(0x8000000080808000), CONST64(0x8000008080808000), CONST64(0x8000000080808080), CONST64(0x8000008080808080), - CONST64(0x8000800080808000), CONST64(0x8000808080808000), CONST64(0x8000800080808080), CONST64(0x8000808080808080), - CONST64(0x8080000080800000), CONST64(0x8080008080800000), CONST64(0x8080000080800080), CONST64(0x8080008080800080), - CONST64(0x8080800080800000), CONST64(0x8080808080800000), CONST64(0x8080800080800080), CONST64(0x8080808080800080), - CONST64(0x8080000080808000), CONST64(0x8080008080808000), CONST64(0x8080000080808080), CONST64(0x8080008080808080), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000008000000000), CONST64(0x0000000000000080), CONST64(0x0000008000000080), + CONST64(0x0000800000000000), CONST64(0x0000808000000000), CONST64(0x0000800000000080), CONST64(0x0000808000000080), + CONST64(0x0000000000008000), CONST64(0x0000008000008000), CONST64(0x0000000000008080), CONST64(0x0000008000008080), + CONST64(0x0000800000008000), CONST64(0x0000808000008000), CONST64(0x0000800000008080), CONST64(0x0000808000008080), + CONST64(0x0080000000000000), CONST64(0x0080008000000000), CONST64(0x0080000000000080), CONST64(0x0080008000000080), + CONST64(0x0080800000000000), CONST64(0x0080808000000000), CONST64(0x0080800000000080), CONST64(0x0080808000000080), + CONST64(0x0080000000008000), CONST64(0x0080008000008000), CONST64(0x0080000000008080), CONST64(0x0080008000008080), + CONST64(0x0080800000008000), CONST64(0x0080808000008000), CONST64(0x0080800000008080), CONST64(0x0080808000008080), + CONST64(0x0000000000800000), CONST64(0x0000008000800000), CONST64(0x0000000000800080), CONST64(0x0000008000800080), + CONST64(0x0000800000800000), CONST64(0x0000808000800000), CONST64(0x0000800000800080), CONST64(0x0000808000800080), + CONST64(0x0000000000808000), CONST64(0x0000008000808000), CONST64(0x0000000000808080), CONST64(0x0000008000808080), + CONST64(0x0000800000808000), CONST64(0x0000808000808000), CONST64(0x0000800000808080), CONST64(0x0000808000808080), + CONST64(0x0080000000800000), CONST64(0x0080008000800000), CONST64(0x0080000000800080), CONST64(0x0080008000800080), + CONST64(0x0080800000800000), CONST64(0x0080808000800000), CONST64(0x0080800000800080), CONST64(0x0080808000800080), + CONST64(0x0080000000808000), CONST64(0x0080008000808000), CONST64(0x0080000000808080), CONST64(0x0080008000808080), + CONST64(0x0080800000808000), CONST64(0x0080808000808000), CONST64(0x0080800000808080), CONST64(0x0080808000808080), + CONST64(0x8000000000000000), CONST64(0x8000008000000000), CONST64(0x8000000000000080), CONST64(0x8000008000000080), + CONST64(0x8000800000000000), CONST64(0x8000808000000000), CONST64(0x8000800000000080), CONST64(0x8000808000000080), + CONST64(0x8000000000008000), CONST64(0x8000008000008000), CONST64(0x8000000000008080), CONST64(0x8000008000008080), + CONST64(0x8000800000008000), CONST64(0x8000808000008000), CONST64(0x8000800000008080), CONST64(0x8000808000008080), + CONST64(0x8080000000000000), CONST64(0x8080008000000000), CONST64(0x8080000000000080), CONST64(0x8080008000000080), + CONST64(0x8080800000000000), CONST64(0x8080808000000000), CONST64(0x8080800000000080), CONST64(0x8080808000000080), + CONST64(0x8080000000008000), CONST64(0x8080008000008000), CONST64(0x8080000000008080), CONST64(0x8080008000008080), + CONST64(0x8080800000008000), CONST64(0x8080808000008000), CONST64(0x8080800000008080), CONST64(0x8080808000008080), + CONST64(0x8000000000800000), CONST64(0x8000008000800000), CONST64(0x8000000000800080), CONST64(0x8000008000800080), + CONST64(0x8000800000800000), CONST64(0x8000808000800000), CONST64(0x8000800000800080), CONST64(0x8000808000800080), + CONST64(0x8000000000808000), CONST64(0x8000008000808000), CONST64(0x8000000000808080), CONST64(0x8000008000808080), + CONST64(0x8000800000808000), CONST64(0x8000808000808000), CONST64(0x8000800000808080), CONST64(0x8000808000808080), + CONST64(0x8080000000800000), CONST64(0x8080008000800000), CONST64(0x8080000000800080), CONST64(0x8080008000800080), + CONST64(0x8080800000800000), CONST64(0x8080808000800000), CONST64(0x8080800000800080), CONST64(0x8080808000800080), + CONST64(0x8080000000808000), CONST64(0x8080008000808000), CONST64(0x8080000000808080), CONST64(0x8080008000808080), + CONST64(0x8080800000808000), CONST64(0x8080808000808000), CONST64(0x8080800000808080), CONST64(0x8080808000808080), + CONST64(0x0000000080000000), CONST64(0x0000008080000000), CONST64(0x0000000080000080), CONST64(0x0000008080000080), + CONST64(0x0000800080000000), CONST64(0x0000808080000000), CONST64(0x0000800080000080), CONST64(0x0000808080000080), + CONST64(0x0000000080008000), CONST64(0x0000008080008000), CONST64(0x0000000080008080), CONST64(0x0000008080008080), + CONST64(0x0000800080008000), CONST64(0x0000808080008000), CONST64(0x0000800080008080), CONST64(0x0000808080008080), + CONST64(0x0080000080000000), CONST64(0x0080008080000000), CONST64(0x0080000080000080), CONST64(0x0080008080000080), + CONST64(0x0080800080000000), CONST64(0x0080808080000000), CONST64(0x0080800080000080), CONST64(0x0080808080000080), + CONST64(0x0080000080008000), CONST64(0x0080008080008000), CONST64(0x0080000080008080), CONST64(0x0080008080008080), + CONST64(0x0080800080008000), CONST64(0x0080808080008000), CONST64(0x0080800080008080), CONST64(0x0080808080008080), + CONST64(0x0000000080800000), CONST64(0x0000008080800000), CONST64(0x0000000080800080), CONST64(0x0000008080800080), + CONST64(0x0000800080800000), CONST64(0x0000808080800000), CONST64(0x0000800080800080), CONST64(0x0000808080800080), + CONST64(0x0000000080808000), CONST64(0x0000008080808000), CONST64(0x0000000080808080), CONST64(0x0000008080808080), + CONST64(0x0000800080808000), CONST64(0x0000808080808000), CONST64(0x0000800080808080), CONST64(0x0000808080808080), + CONST64(0x0080000080800000), CONST64(0x0080008080800000), CONST64(0x0080000080800080), CONST64(0x0080008080800080), + CONST64(0x0080800080800000), CONST64(0x0080808080800000), CONST64(0x0080800080800080), CONST64(0x0080808080800080), + CONST64(0x0080000080808000), CONST64(0x0080008080808000), CONST64(0x0080000080808080), CONST64(0x0080008080808080), + CONST64(0x0080800080808000), CONST64(0x0080808080808000), CONST64(0x0080800080808080), CONST64(0x0080808080808080), + CONST64(0x8000000080000000), CONST64(0x8000008080000000), CONST64(0x8000000080000080), CONST64(0x8000008080000080), + CONST64(0x8000800080000000), CONST64(0x8000808080000000), CONST64(0x8000800080000080), CONST64(0x8000808080000080), + CONST64(0x8000000080008000), CONST64(0x8000008080008000), CONST64(0x8000000080008080), CONST64(0x8000008080008080), + CONST64(0x8000800080008000), CONST64(0x8000808080008000), CONST64(0x8000800080008080), CONST64(0x8000808080008080), + CONST64(0x8080000080000000), CONST64(0x8080008080000000), CONST64(0x8080000080000080), CONST64(0x8080008080000080), + CONST64(0x8080800080000000), CONST64(0x8080808080000000), CONST64(0x8080800080000080), CONST64(0x8080808080000080), + CONST64(0x8080000080008000), CONST64(0x8080008080008000), CONST64(0x8080000080008080), CONST64(0x8080008080008080), + CONST64(0x8080800080008000), CONST64(0x8080808080008000), CONST64(0x8080800080008080), CONST64(0x8080808080008080), + CONST64(0x8000000080800000), CONST64(0x8000008080800000), CONST64(0x8000000080800080), CONST64(0x8000008080800080), + CONST64(0x8000800080800000), CONST64(0x8000808080800000), CONST64(0x8000800080800080), CONST64(0x8000808080800080), + CONST64(0x8000000080808000), CONST64(0x8000008080808000), CONST64(0x8000000080808080), CONST64(0x8000008080808080), + CONST64(0x8000800080808000), CONST64(0x8000808080808000), CONST64(0x8000800080808080), CONST64(0x8000808080808080), + CONST64(0x8080000080800000), CONST64(0x8080008080800000), CONST64(0x8080000080800080), CONST64(0x8080008080800080), + CONST64(0x8080800080800000), CONST64(0x8080808080800000), CONST64(0x8080800080800080), CONST64(0x8080808080800080), + CONST64(0x8080000080808000), CONST64(0x8080008080808000), CONST64(0x8080000080808080), CONST64(0x8080008080808080), CONST64(0x8080800080808000), CONST64(0x8080808080808000), CONST64(0x8080800080808080), CONST64(0x8080808080808080) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000004000000000), CONST64(0x0000000000000040), CONST64(0x0000004000000040), - CONST64(0x0000400000000000), CONST64(0x0000404000000000), CONST64(0x0000400000000040), CONST64(0x0000404000000040), - CONST64(0x0000000000004000), CONST64(0x0000004000004000), CONST64(0x0000000000004040), CONST64(0x0000004000004040), - CONST64(0x0000400000004000), CONST64(0x0000404000004000), CONST64(0x0000400000004040), CONST64(0x0000404000004040), - CONST64(0x0040000000000000), CONST64(0x0040004000000000), CONST64(0x0040000000000040), CONST64(0x0040004000000040), - CONST64(0x0040400000000000), CONST64(0x0040404000000000), CONST64(0x0040400000000040), CONST64(0x0040404000000040), - CONST64(0x0040000000004000), CONST64(0x0040004000004000), CONST64(0x0040000000004040), CONST64(0x0040004000004040), - CONST64(0x0040400000004000), CONST64(0x0040404000004000), CONST64(0x0040400000004040), CONST64(0x0040404000004040), - CONST64(0x0000000000400000), CONST64(0x0000004000400000), CONST64(0x0000000000400040), CONST64(0x0000004000400040), - CONST64(0x0000400000400000), CONST64(0x0000404000400000), CONST64(0x0000400000400040), CONST64(0x0000404000400040), - CONST64(0x0000000000404000), CONST64(0x0000004000404000), CONST64(0x0000000000404040), CONST64(0x0000004000404040), - CONST64(0x0000400000404000), CONST64(0x0000404000404000), CONST64(0x0000400000404040), CONST64(0x0000404000404040), - CONST64(0x0040000000400000), CONST64(0x0040004000400000), CONST64(0x0040000000400040), CONST64(0x0040004000400040), - CONST64(0x0040400000400000), CONST64(0x0040404000400000), CONST64(0x0040400000400040), CONST64(0x0040404000400040), - CONST64(0x0040000000404000), CONST64(0x0040004000404000), CONST64(0x0040000000404040), CONST64(0x0040004000404040), - CONST64(0x0040400000404000), CONST64(0x0040404000404000), CONST64(0x0040400000404040), CONST64(0x0040404000404040), - CONST64(0x4000000000000000), CONST64(0x4000004000000000), CONST64(0x4000000000000040), CONST64(0x4000004000000040), - CONST64(0x4000400000000000), CONST64(0x4000404000000000), CONST64(0x4000400000000040), CONST64(0x4000404000000040), - CONST64(0x4000000000004000), CONST64(0x4000004000004000), CONST64(0x4000000000004040), CONST64(0x4000004000004040), - CONST64(0x4000400000004000), CONST64(0x4000404000004000), CONST64(0x4000400000004040), CONST64(0x4000404000004040), - CONST64(0x4040000000000000), CONST64(0x4040004000000000), CONST64(0x4040000000000040), CONST64(0x4040004000000040), - CONST64(0x4040400000000000), CONST64(0x4040404000000000), CONST64(0x4040400000000040), CONST64(0x4040404000000040), - CONST64(0x4040000000004000), CONST64(0x4040004000004000), CONST64(0x4040000000004040), CONST64(0x4040004000004040), - CONST64(0x4040400000004000), CONST64(0x4040404000004000), CONST64(0x4040400000004040), CONST64(0x4040404000004040), - CONST64(0x4000000000400000), CONST64(0x4000004000400000), CONST64(0x4000000000400040), CONST64(0x4000004000400040), - CONST64(0x4000400000400000), CONST64(0x4000404000400000), CONST64(0x4000400000400040), CONST64(0x4000404000400040), - CONST64(0x4000000000404000), CONST64(0x4000004000404000), CONST64(0x4000000000404040), CONST64(0x4000004000404040), - CONST64(0x4000400000404000), CONST64(0x4000404000404000), CONST64(0x4000400000404040), CONST64(0x4000404000404040), - CONST64(0x4040000000400000), CONST64(0x4040004000400000), CONST64(0x4040000000400040), CONST64(0x4040004000400040), - CONST64(0x4040400000400000), CONST64(0x4040404000400000), CONST64(0x4040400000400040), CONST64(0x4040404000400040), - CONST64(0x4040000000404000), CONST64(0x4040004000404000), CONST64(0x4040000000404040), CONST64(0x4040004000404040), - CONST64(0x4040400000404000), CONST64(0x4040404000404000), CONST64(0x4040400000404040), CONST64(0x4040404000404040), - CONST64(0x0000000040000000), CONST64(0x0000004040000000), CONST64(0x0000000040000040), CONST64(0x0000004040000040), - CONST64(0x0000400040000000), CONST64(0x0000404040000000), CONST64(0x0000400040000040), CONST64(0x0000404040000040), - CONST64(0x0000000040004000), CONST64(0x0000004040004000), CONST64(0x0000000040004040), CONST64(0x0000004040004040), - CONST64(0x0000400040004000), CONST64(0x0000404040004000), CONST64(0x0000400040004040), CONST64(0x0000404040004040), - CONST64(0x0040000040000000), CONST64(0x0040004040000000), CONST64(0x0040000040000040), CONST64(0x0040004040000040), - CONST64(0x0040400040000000), CONST64(0x0040404040000000), CONST64(0x0040400040000040), CONST64(0x0040404040000040), - CONST64(0x0040000040004000), CONST64(0x0040004040004000), CONST64(0x0040000040004040), CONST64(0x0040004040004040), - CONST64(0x0040400040004000), CONST64(0x0040404040004000), CONST64(0x0040400040004040), CONST64(0x0040404040004040), - CONST64(0x0000000040400000), CONST64(0x0000004040400000), CONST64(0x0000000040400040), CONST64(0x0000004040400040), - CONST64(0x0000400040400000), CONST64(0x0000404040400000), CONST64(0x0000400040400040), CONST64(0x0000404040400040), - CONST64(0x0000000040404000), CONST64(0x0000004040404000), CONST64(0x0000000040404040), CONST64(0x0000004040404040), - CONST64(0x0000400040404000), CONST64(0x0000404040404000), CONST64(0x0000400040404040), CONST64(0x0000404040404040), - CONST64(0x0040000040400000), CONST64(0x0040004040400000), CONST64(0x0040000040400040), CONST64(0x0040004040400040), - CONST64(0x0040400040400000), CONST64(0x0040404040400000), CONST64(0x0040400040400040), CONST64(0x0040404040400040), - CONST64(0x0040000040404000), CONST64(0x0040004040404000), CONST64(0x0040000040404040), CONST64(0x0040004040404040), - CONST64(0x0040400040404000), CONST64(0x0040404040404000), CONST64(0x0040400040404040), CONST64(0x0040404040404040), - CONST64(0x4000000040000000), CONST64(0x4000004040000000), CONST64(0x4000000040000040), CONST64(0x4000004040000040), - CONST64(0x4000400040000000), CONST64(0x4000404040000000), CONST64(0x4000400040000040), CONST64(0x4000404040000040), - CONST64(0x4000000040004000), CONST64(0x4000004040004000), CONST64(0x4000000040004040), CONST64(0x4000004040004040), - CONST64(0x4000400040004000), CONST64(0x4000404040004000), CONST64(0x4000400040004040), CONST64(0x4000404040004040), - CONST64(0x4040000040000000), CONST64(0x4040004040000000), CONST64(0x4040000040000040), CONST64(0x4040004040000040), - CONST64(0x4040400040000000), CONST64(0x4040404040000000), CONST64(0x4040400040000040), CONST64(0x4040404040000040), - CONST64(0x4040000040004000), CONST64(0x4040004040004000), CONST64(0x4040000040004040), CONST64(0x4040004040004040), - CONST64(0x4040400040004000), CONST64(0x4040404040004000), CONST64(0x4040400040004040), CONST64(0x4040404040004040), - CONST64(0x4000000040400000), CONST64(0x4000004040400000), CONST64(0x4000000040400040), CONST64(0x4000004040400040), - CONST64(0x4000400040400000), CONST64(0x4000404040400000), CONST64(0x4000400040400040), CONST64(0x4000404040400040), - CONST64(0x4000000040404000), CONST64(0x4000004040404000), CONST64(0x4000000040404040), CONST64(0x4000004040404040), - CONST64(0x4000400040404000), CONST64(0x4000404040404000), CONST64(0x4000400040404040), CONST64(0x4000404040404040), - CONST64(0x4040000040400000), CONST64(0x4040004040400000), CONST64(0x4040000040400040), CONST64(0x4040004040400040), - CONST64(0x4040400040400000), CONST64(0x4040404040400000), CONST64(0x4040400040400040), CONST64(0x4040404040400040), - CONST64(0x4040000040404000), CONST64(0x4040004040404000), CONST64(0x4040000040404040), CONST64(0x4040004040404040), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000004000000000), CONST64(0x0000000000000040), CONST64(0x0000004000000040), + CONST64(0x0000400000000000), CONST64(0x0000404000000000), CONST64(0x0000400000000040), CONST64(0x0000404000000040), + CONST64(0x0000000000004000), CONST64(0x0000004000004000), CONST64(0x0000000000004040), CONST64(0x0000004000004040), + CONST64(0x0000400000004000), CONST64(0x0000404000004000), CONST64(0x0000400000004040), CONST64(0x0000404000004040), + CONST64(0x0040000000000000), CONST64(0x0040004000000000), CONST64(0x0040000000000040), CONST64(0x0040004000000040), + CONST64(0x0040400000000000), CONST64(0x0040404000000000), CONST64(0x0040400000000040), CONST64(0x0040404000000040), + CONST64(0x0040000000004000), CONST64(0x0040004000004000), CONST64(0x0040000000004040), CONST64(0x0040004000004040), + CONST64(0x0040400000004000), CONST64(0x0040404000004000), CONST64(0x0040400000004040), CONST64(0x0040404000004040), + CONST64(0x0000000000400000), CONST64(0x0000004000400000), CONST64(0x0000000000400040), CONST64(0x0000004000400040), + CONST64(0x0000400000400000), CONST64(0x0000404000400000), CONST64(0x0000400000400040), CONST64(0x0000404000400040), + CONST64(0x0000000000404000), CONST64(0x0000004000404000), CONST64(0x0000000000404040), CONST64(0x0000004000404040), + CONST64(0x0000400000404000), CONST64(0x0000404000404000), CONST64(0x0000400000404040), CONST64(0x0000404000404040), + CONST64(0x0040000000400000), CONST64(0x0040004000400000), CONST64(0x0040000000400040), CONST64(0x0040004000400040), + CONST64(0x0040400000400000), CONST64(0x0040404000400000), CONST64(0x0040400000400040), CONST64(0x0040404000400040), + CONST64(0x0040000000404000), CONST64(0x0040004000404000), CONST64(0x0040000000404040), CONST64(0x0040004000404040), + CONST64(0x0040400000404000), CONST64(0x0040404000404000), CONST64(0x0040400000404040), CONST64(0x0040404000404040), + CONST64(0x4000000000000000), CONST64(0x4000004000000000), CONST64(0x4000000000000040), CONST64(0x4000004000000040), + CONST64(0x4000400000000000), CONST64(0x4000404000000000), CONST64(0x4000400000000040), CONST64(0x4000404000000040), + CONST64(0x4000000000004000), CONST64(0x4000004000004000), CONST64(0x4000000000004040), CONST64(0x4000004000004040), + CONST64(0x4000400000004000), CONST64(0x4000404000004000), CONST64(0x4000400000004040), CONST64(0x4000404000004040), + CONST64(0x4040000000000000), CONST64(0x4040004000000000), CONST64(0x4040000000000040), CONST64(0x4040004000000040), + CONST64(0x4040400000000000), CONST64(0x4040404000000000), CONST64(0x4040400000000040), CONST64(0x4040404000000040), + CONST64(0x4040000000004000), CONST64(0x4040004000004000), CONST64(0x4040000000004040), CONST64(0x4040004000004040), + CONST64(0x4040400000004000), CONST64(0x4040404000004000), CONST64(0x4040400000004040), CONST64(0x4040404000004040), + CONST64(0x4000000000400000), CONST64(0x4000004000400000), CONST64(0x4000000000400040), CONST64(0x4000004000400040), + CONST64(0x4000400000400000), CONST64(0x4000404000400000), CONST64(0x4000400000400040), CONST64(0x4000404000400040), + CONST64(0x4000000000404000), CONST64(0x4000004000404000), CONST64(0x4000000000404040), CONST64(0x4000004000404040), + CONST64(0x4000400000404000), CONST64(0x4000404000404000), CONST64(0x4000400000404040), CONST64(0x4000404000404040), + CONST64(0x4040000000400000), CONST64(0x4040004000400000), CONST64(0x4040000000400040), CONST64(0x4040004000400040), + CONST64(0x4040400000400000), CONST64(0x4040404000400000), CONST64(0x4040400000400040), CONST64(0x4040404000400040), + CONST64(0x4040000000404000), CONST64(0x4040004000404000), CONST64(0x4040000000404040), CONST64(0x4040004000404040), + CONST64(0x4040400000404000), CONST64(0x4040404000404000), CONST64(0x4040400000404040), CONST64(0x4040404000404040), + CONST64(0x0000000040000000), CONST64(0x0000004040000000), CONST64(0x0000000040000040), CONST64(0x0000004040000040), + CONST64(0x0000400040000000), CONST64(0x0000404040000000), CONST64(0x0000400040000040), CONST64(0x0000404040000040), + CONST64(0x0000000040004000), CONST64(0x0000004040004000), CONST64(0x0000000040004040), CONST64(0x0000004040004040), + CONST64(0x0000400040004000), CONST64(0x0000404040004000), CONST64(0x0000400040004040), CONST64(0x0000404040004040), + CONST64(0x0040000040000000), CONST64(0x0040004040000000), CONST64(0x0040000040000040), CONST64(0x0040004040000040), + CONST64(0x0040400040000000), CONST64(0x0040404040000000), CONST64(0x0040400040000040), CONST64(0x0040404040000040), + CONST64(0x0040000040004000), CONST64(0x0040004040004000), CONST64(0x0040000040004040), CONST64(0x0040004040004040), + CONST64(0x0040400040004000), CONST64(0x0040404040004000), CONST64(0x0040400040004040), CONST64(0x0040404040004040), + CONST64(0x0000000040400000), CONST64(0x0000004040400000), CONST64(0x0000000040400040), CONST64(0x0000004040400040), + CONST64(0x0000400040400000), CONST64(0x0000404040400000), CONST64(0x0000400040400040), CONST64(0x0000404040400040), + CONST64(0x0000000040404000), CONST64(0x0000004040404000), CONST64(0x0000000040404040), CONST64(0x0000004040404040), + CONST64(0x0000400040404000), CONST64(0x0000404040404000), CONST64(0x0000400040404040), CONST64(0x0000404040404040), + CONST64(0x0040000040400000), CONST64(0x0040004040400000), CONST64(0x0040000040400040), CONST64(0x0040004040400040), + CONST64(0x0040400040400000), CONST64(0x0040404040400000), CONST64(0x0040400040400040), CONST64(0x0040404040400040), + CONST64(0x0040000040404000), CONST64(0x0040004040404000), CONST64(0x0040000040404040), CONST64(0x0040004040404040), + CONST64(0x0040400040404000), CONST64(0x0040404040404000), CONST64(0x0040400040404040), CONST64(0x0040404040404040), + CONST64(0x4000000040000000), CONST64(0x4000004040000000), CONST64(0x4000000040000040), CONST64(0x4000004040000040), + CONST64(0x4000400040000000), CONST64(0x4000404040000000), CONST64(0x4000400040000040), CONST64(0x4000404040000040), + CONST64(0x4000000040004000), CONST64(0x4000004040004000), CONST64(0x4000000040004040), CONST64(0x4000004040004040), + CONST64(0x4000400040004000), CONST64(0x4000404040004000), CONST64(0x4000400040004040), CONST64(0x4000404040004040), + CONST64(0x4040000040000000), CONST64(0x4040004040000000), CONST64(0x4040000040000040), CONST64(0x4040004040000040), + CONST64(0x4040400040000000), CONST64(0x4040404040000000), CONST64(0x4040400040000040), CONST64(0x4040404040000040), + CONST64(0x4040000040004000), CONST64(0x4040004040004000), CONST64(0x4040000040004040), CONST64(0x4040004040004040), + CONST64(0x4040400040004000), CONST64(0x4040404040004000), CONST64(0x4040400040004040), CONST64(0x4040404040004040), + CONST64(0x4000000040400000), CONST64(0x4000004040400000), CONST64(0x4000000040400040), CONST64(0x4000004040400040), + CONST64(0x4000400040400000), CONST64(0x4000404040400000), CONST64(0x4000400040400040), CONST64(0x4000404040400040), + CONST64(0x4000000040404000), CONST64(0x4000004040404000), CONST64(0x4000000040404040), CONST64(0x4000004040404040), + CONST64(0x4000400040404000), CONST64(0x4000404040404000), CONST64(0x4000400040404040), CONST64(0x4000404040404040), + CONST64(0x4040000040400000), CONST64(0x4040004040400000), CONST64(0x4040000040400040), CONST64(0x4040004040400040), + CONST64(0x4040400040400000), CONST64(0x4040404040400000), CONST64(0x4040400040400040), CONST64(0x4040404040400040), + CONST64(0x4040000040404000), CONST64(0x4040004040404000), CONST64(0x4040000040404040), CONST64(0x4040004040404040), CONST64(0x4040400040404000), CONST64(0x4040404040404000), CONST64(0x4040400040404040), CONST64(0x4040404040404040) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000002000000000), CONST64(0x0000000000000020), CONST64(0x0000002000000020), - CONST64(0x0000200000000000), CONST64(0x0000202000000000), CONST64(0x0000200000000020), CONST64(0x0000202000000020), - CONST64(0x0000000000002000), CONST64(0x0000002000002000), CONST64(0x0000000000002020), CONST64(0x0000002000002020), - CONST64(0x0000200000002000), CONST64(0x0000202000002000), CONST64(0x0000200000002020), CONST64(0x0000202000002020), - CONST64(0x0020000000000000), CONST64(0x0020002000000000), CONST64(0x0020000000000020), CONST64(0x0020002000000020), - CONST64(0x0020200000000000), CONST64(0x0020202000000000), CONST64(0x0020200000000020), CONST64(0x0020202000000020), - CONST64(0x0020000000002000), CONST64(0x0020002000002000), CONST64(0x0020000000002020), CONST64(0x0020002000002020), - CONST64(0x0020200000002000), CONST64(0x0020202000002000), CONST64(0x0020200000002020), CONST64(0x0020202000002020), - CONST64(0x0000000000200000), CONST64(0x0000002000200000), CONST64(0x0000000000200020), CONST64(0x0000002000200020), - CONST64(0x0000200000200000), CONST64(0x0000202000200000), CONST64(0x0000200000200020), CONST64(0x0000202000200020), - CONST64(0x0000000000202000), CONST64(0x0000002000202000), CONST64(0x0000000000202020), CONST64(0x0000002000202020), - CONST64(0x0000200000202000), CONST64(0x0000202000202000), CONST64(0x0000200000202020), CONST64(0x0000202000202020), - CONST64(0x0020000000200000), CONST64(0x0020002000200000), CONST64(0x0020000000200020), CONST64(0x0020002000200020), - CONST64(0x0020200000200000), CONST64(0x0020202000200000), CONST64(0x0020200000200020), CONST64(0x0020202000200020), - CONST64(0x0020000000202000), CONST64(0x0020002000202000), CONST64(0x0020000000202020), CONST64(0x0020002000202020), - CONST64(0x0020200000202000), CONST64(0x0020202000202000), CONST64(0x0020200000202020), CONST64(0x0020202000202020), - CONST64(0x2000000000000000), CONST64(0x2000002000000000), CONST64(0x2000000000000020), CONST64(0x2000002000000020), - CONST64(0x2000200000000000), CONST64(0x2000202000000000), CONST64(0x2000200000000020), CONST64(0x2000202000000020), - CONST64(0x2000000000002000), CONST64(0x2000002000002000), CONST64(0x2000000000002020), CONST64(0x2000002000002020), - CONST64(0x2000200000002000), CONST64(0x2000202000002000), CONST64(0x2000200000002020), CONST64(0x2000202000002020), - CONST64(0x2020000000000000), CONST64(0x2020002000000000), CONST64(0x2020000000000020), CONST64(0x2020002000000020), - CONST64(0x2020200000000000), CONST64(0x2020202000000000), CONST64(0x2020200000000020), CONST64(0x2020202000000020), - CONST64(0x2020000000002000), CONST64(0x2020002000002000), CONST64(0x2020000000002020), CONST64(0x2020002000002020), - CONST64(0x2020200000002000), CONST64(0x2020202000002000), CONST64(0x2020200000002020), CONST64(0x2020202000002020), - CONST64(0x2000000000200000), CONST64(0x2000002000200000), CONST64(0x2000000000200020), CONST64(0x2000002000200020), - CONST64(0x2000200000200000), CONST64(0x2000202000200000), CONST64(0x2000200000200020), CONST64(0x2000202000200020), - CONST64(0x2000000000202000), CONST64(0x2000002000202000), CONST64(0x2000000000202020), CONST64(0x2000002000202020), - CONST64(0x2000200000202000), CONST64(0x2000202000202000), CONST64(0x2000200000202020), CONST64(0x2000202000202020), - CONST64(0x2020000000200000), CONST64(0x2020002000200000), CONST64(0x2020000000200020), CONST64(0x2020002000200020), - CONST64(0x2020200000200000), CONST64(0x2020202000200000), CONST64(0x2020200000200020), CONST64(0x2020202000200020), - CONST64(0x2020000000202000), CONST64(0x2020002000202000), CONST64(0x2020000000202020), CONST64(0x2020002000202020), - CONST64(0x2020200000202000), CONST64(0x2020202000202000), CONST64(0x2020200000202020), CONST64(0x2020202000202020), - CONST64(0x0000000020000000), CONST64(0x0000002020000000), CONST64(0x0000000020000020), CONST64(0x0000002020000020), - CONST64(0x0000200020000000), CONST64(0x0000202020000000), CONST64(0x0000200020000020), CONST64(0x0000202020000020), - CONST64(0x0000000020002000), CONST64(0x0000002020002000), CONST64(0x0000000020002020), CONST64(0x0000002020002020), - CONST64(0x0000200020002000), CONST64(0x0000202020002000), CONST64(0x0000200020002020), CONST64(0x0000202020002020), - CONST64(0x0020000020000000), CONST64(0x0020002020000000), CONST64(0x0020000020000020), CONST64(0x0020002020000020), - CONST64(0x0020200020000000), CONST64(0x0020202020000000), CONST64(0x0020200020000020), CONST64(0x0020202020000020), - CONST64(0x0020000020002000), CONST64(0x0020002020002000), CONST64(0x0020000020002020), CONST64(0x0020002020002020), - CONST64(0x0020200020002000), CONST64(0x0020202020002000), CONST64(0x0020200020002020), CONST64(0x0020202020002020), - CONST64(0x0000000020200000), CONST64(0x0000002020200000), CONST64(0x0000000020200020), CONST64(0x0000002020200020), - CONST64(0x0000200020200000), CONST64(0x0000202020200000), CONST64(0x0000200020200020), CONST64(0x0000202020200020), - CONST64(0x0000000020202000), CONST64(0x0000002020202000), CONST64(0x0000000020202020), CONST64(0x0000002020202020), - CONST64(0x0000200020202000), CONST64(0x0000202020202000), CONST64(0x0000200020202020), CONST64(0x0000202020202020), - CONST64(0x0020000020200000), CONST64(0x0020002020200000), CONST64(0x0020000020200020), CONST64(0x0020002020200020), - CONST64(0x0020200020200000), CONST64(0x0020202020200000), CONST64(0x0020200020200020), CONST64(0x0020202020200020), - CONST64(0x0020000020202000), CONST64(0x0020002020202000), CONST64(0x0020000020202020), CONST64(0x0020002020202020), - CONST64(0x0020200020202000), CONST64(0x0020202020202000), CONST64(0x0020200020202020), CONST64(0x0020202020202020), - CONST64(0x2000000020000000), CONST64(0x2000002020000000), CONST64(0x2000000020000020), CONST64(0x2000002020000020), - CONST64(0x2000200020000000), CONST64(0x2000202020000000), CONST64(0x2000200020000020), CONST64(0x2000202020000020), - CONST64(0x2000000020002000), CONST64(0x2000002020002000), CONST64(0x2000000020002020), CONST64(0x2000002020002020), - CONST64(0x2000200020002000), CONST64(0x2000202020002000), CONST64(0x2000200020002020), CONST64(0x2000202020002020), - CONST64(0x2020000020000000), CONST64(0x2020002020000000), CONST64(0x2020000020000020), CONST64(0x2020002020000020), - CONST64(0x2020200020000000), CONST64(0x2020202020000000), CONST64(0x2020200020000020), CONST64(0x2020202020000020), - CONST64(0x2020000020002000), CONST64(0x2020002020002000), CONST64(0x2020000020002020), CONST64(0x2020002020002020), - CONST64(0x2020200020002000), CONST64(0x2020202020002000), CONST64(0x2020200020002020), CONST64(0x2020202020002020), - CONST64(0x2000000020200000), CONST64(0x2000002020200000), CONST64(0x2000000020200020), CONST64(0x2000002020200020), - CONST64(0x2000200020200000), CONST64(0x2000202020200000), CONST64(0x2000200020200020), CONST64(0x2000202020200020), - CONST64(0x2000000020202000), CONST64(0x2000002020202000), CONST64(0x2000000020202020), CONST64(0x2000002020202020), - CONST64(0x2000200020202000), CONST64(0x2000202020202000), CONST64(0x2000200020202020), CONST64(0x2000202020202020), - CONST64(0x2020000020200000), CONST64(0x2020002020200000), CONST64(0x2020000020200020), CONST64(0x2020002020200020), - CONST64(0x2020200020200000), CONST64(0x2020202020200000), CONST64(0x2020200020200020), CONST64(0x2020202020200020), - CONST64(0x2020000020202000), CONST64(0x2020002020202000), CONST64(0x2020000020202020), CONST64(0x2020002020202020), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000002000000000), CONST64(0x0000000000000020), CONST64(0x0000002000000020), + CONST64(0x0000200000000000), CONST64(0x0000202000000000), CONST64(0x0000200000000020), CONST64(0x0000202000000020), + CONST64(0x0000000000002000), CONST64(0x0000002000002000), CONST64(0x0000000000002020), CONST64(0x0000002000002020), + CONST64(0x0000200000002000), CONST64(0x0000202000002000), CONST64(0x0000200000002020), CONST64(0x0000202000002020), + CONST64(0x0020000000000000), CONST64(0x0020002000000000), CONST64(0x0020000000000020), CONST64(0x0020002000000020), + CONST64(0x0020200000000000), CONST64(0x0020202000000000), CONST64(0x0020200000000020), CONST64(0x0020202000000020), + CONST64(0x0020000000002000), CONST64(0x0020002000002000), CONST64(0x0020000000002020), CONST64(0x0020002000002020), + CONST64(0x0020200000002000), CONST64(0x0020202000002000), CONST64(0x0020200000002020), CONST64(0x0020202000002020), + CONST64(0x0000000000200000), CONST64(0x0000002000200000), CONST64(0x0000000000200020), CONST64(0x0000002000200020), + CONST64(0x0000200000200000), CONST64(0x0000202000200000), CONST64(0x0000200000200020), CONST64(0x0000202000200020), + CONST64(0x0000000000202000), CONST64(0x0000002000202000), CONST64(0x0000000000202020), CONST64(0x0000002000202020), + CONST64(0x0000200000202000), CONST64(0x0000202000202000), CONST64(0x0000200000202020), CONST64(0x0000202000202020), + CONST64(0x0020000000200000), CONST64(0x0020002000200000), CONST64(0x0020000000200020), CONST64(0x0020002000200020), + CONST64(0x0020200000200000), CONST64(0x0020202000200000), CONST64(0x0020200000200020), CONST64(0x0020202000200020), + CONST64(0x0020000000202000), CONST64(0x0020002000202000), CONST64(0x0020000000202020), CONST64(0x0020002000202020), + CONST64(0x0020200000202000), CONST64(0x0020202000202000), CONST64(0x0020200000202020), CONST64(0x0020202000202020), + CONST64(0x2000000000000000), CONST64(0x2000002000000000), CONST64(0x2000000000000020), CONST64(0x2000002000000020), + CONST64(0x2000200000000000), CONST64(0x2000202000000000), CONST64(0x2000200000000020), CONST64(0x2000202000000020), + CONST64(0x2000000000002000), CONST64(0x2000002000002000), CONST64(0x2000000000002020), CONST64(0x2000002000002020), + CONST64(0x2000200000002000), CONST64(0x2000202000002000), CONST64(0x2000200000002020), CONST64(0x2000202000002020), + CONST64(0x2020000000000000), CONST64(0x2020002000000000), CONST64(0x2020000000000020), CONST64(0x2020002000000020), + CONST64(0x2020200000000000), CONST64(0x2020202000000000), CONST64(0x2020200000000020), CONST64(0x2020202000000020), + CONST64(0x2020000000002000), CONST64(0x2020002000002000), CONST64(0x2020000000002020), CONST64(0x2020002000002020), + CONST64(0x2020200000002000), CONST64(0x2020202000002000), CONST64(0x2020200000002020), CONST64(0x2020202000002020), + CONST64(0x2000000000200000), CONST64(0x2000002000200000), CONST64(0x2000000000200020), CONST64(0x2000002000200020), + CONST64(0x2000200000200000), CONST64(0x2000202000200000), CONST64(0x2000200000200020), CONST64(0x2000202000200020), + CONST64(0x2000000000202000), CONST64(0x2000002000202000), CONST64(0x2000000000202020), CONST64(0x2000002000202020), + CONST64(0x2000200000202000), CONST64(0x2000202000202000), CONST64(0x2000200000202020), CONST64(0x2000202000202020), + CONST64(0x2020000000200000), CONST64(0x2020002000200000), CONST64(0x2020000000200020), CONST64(0x2020002000200020), + CONST64(0x2020200000200000), CONST64(0x2020202000200000), CONST64(0x2020200000200020), CONST64(0x2020202000200020), + CONST64(0x2020000000202000), CONST64(0x2020002000202000), CONST64(0x2020000000202020), CONST64(0x2020002000202020), + CONST64(0x2020200000202000), CONST64(0x2020202000202000), CONST64(0x2020200000202020), CONST64(0x2020202000202020), + CONST64(0x0000000020000000), CONST64(0x0000002020000000), CONST64(0x0000000020000020), CONST64(0x0000002020000020), + CONST64(0x0000200020000000), CONST64(0x0000202020000000), CONST64(0x0000200020000020), CONST64(0x0000202020000020), + CONST64(0x0000000020002000), CONST64(0x0000002020002000), CONST64(0x0000000020002020), CONST64(0x0000002020002020), + CONST64(0x0000200020002000), CONST64(0x0000202020002000), CONST64(0x0000200020002020), CONST64(0x0000202020002020), + CONST64(0x0020000020000000), CONST64(0x0020002020000000), CONST64(0x0020000020000020), CONST64(0x0020002020000020), + CONST64(0x0020200020000000), CONST64(0x0020202020000000), CONST64(0x0020200020000020), CONST64(0x0020202020000020), + CONST64(0x0020000020002000), CONST64(0x0020002020002000), CONST64(0x0020000020002020), CONST64(0x0020002020002020), + CONST64(0x0020200020002000), CONST64(0x0020202020002000), CONST64(0x0020200020002020), CONST64(0x0020202020002020), + CONST64(0x0000000020200000), CONST64(0x0000002020200000), CONST64(0x0000000020200020), CONST64(0x0000002020200020), + CONST64(0x0000200020200000), CONST64(0x0000202020200000), CONST64(0x0000200020200020), CONST64(0x0000202020200020), + CONST64(0x0000000020202000), CONST64(0x0000002020202000), CONST64(0x0000000020202020), CONST64(0x0000002020202020), + CONST64(0x0000200020202000), CONST64(0x0000202020202000), CONST64(0x0000200020202020), CONST64(0x0000202020202020), + CONST64(0x0020000020200000), CONST64(0x0020002020200000), CONST64(0x0020000020200020), CONST64(0x0020002020200020), + CONST64(0x0020200020200000), CONST64(0x0020202020200000), CONST64(0x0020200020200020), CONST64(0x0020202020200020), + CONST64(0x0020000020202000), CONST64(0x0020002020202000), CONST64(0x0020000020202020), CONST64(0x0020002020202020), + CONST64(0x0020200020202000), CONST64(0x0020202020202000), CONST64(0x0020200020202020), CONST64(0x0020202020202020), + CONST64(0x2000000020000000), CONST64(0x2000002020000000), CONST64(0x2000000020000020), CONST64(0x2000002020000020), + CONST64(0x2000200020000000), CONST64(0x2000202020000000), CONST64(0x2000200020000020), CONST64(0x2000202020000020), + CONST64(0x2000000020002000), CONST64(0x2000002020002000), CONST64(0x2000000020002020), CONST64(0x2000002020002020), + CONST64(0x2000200020002000), CONST64(0x2000202020002000), CONST64(0x2000200020002020), CONST64(0x2000202020002020), + CONST64(0x2020000020000000), CONST64(0x2020002020000000), CONST64(0x2020000020000020), CONST64(0x2020002020000020), + CONST64(0x2020200020000000), CONST64(0x2020202020000000), CONST64(0x2020200020000020), CONST64(0x2020202020000020), + CONST64(0x2020000020002000), CONST64(0x2020002020002000), CONST64(0x2020000020002020), CONST64(0x2020002020002020), + CONST64(0x2020200020002000), CONST64(0x2020202020002000), CONST64(0x2020200020002020), CONST64(0x2020202020002020), + CONST64(0x2000000020200000), CONST64(0x2000002020200000), CONST64(0x2000000020200020), CONST64(0x2000002020200020), + CONST64(0x2000200020200000), CONST64(0x2000202020200000), CONST64(0x2000200020200020), CONST64(0x2000202020200020), + CONST64(0x2000000020202000), CONST64(0x2000002020202000), CONST64(0x2000000020202020), CONST64(0x2000002020202020), + CONST64(0x2000200020202000), CONST64(0x2000202020202000), CONST64(0x2000200020202020), CONST64(0x2000202020202020), + CONST64(0x2020000020200000), CONST64(0x2020002020200000), CONST64(0x2020000020200020), CONST64(0x2020002020200020), + CONST64(0x2020200020200000), CONST64(0x2020202020200000), CONST64(0x2020200020200020), CONST64(0x2020202020200020), + CONST64(0x2020000020202000), CONST64(0x2020002020202000), CONST64(0x2020000020202020), CONST64(0x2020002020202020), CONST64(0x2020200020202000), CONST64(0x2020202020202000), CONST64(0x2020200020202020), CONST64(0x2020202020202020) }}; - + static const ulong64 des_fp[8][256] = { -{ CONST64(0x0000000000000000), CONST64(0x0000008000000000), CONST64(0x0000000002000000), CONST64(0x0000008002000000), - CONST64(0x0000000000020000), CONST64(0x0000008000020000), CONST64(0x0000000002020000), CONST64(0x0000008002020000), - CONST64(0x0000000000000200), CONST64(0x0000008000000200), CONST64(0x0000000002000200), CONST64(0x0000008002000200), - CONST64(0x0000000000020200), CONST64(0x0000008000020200), CONST64(0x0000000002020200), CONST64(0x0000008002020200), - CONST64(0x0000000000000002), CONST64(0x0000008000000002), CONST64(0x0000000002000002), CONST64(0x0000008002000002), - CONST64(0x0000000000020002), CONST64(0x0000008000020002), CONST64(0x0000000002020002), CONST64(0x0000008002020002), - CONST64(0x0000000000000202), CONST64(0x0000008000000202), CONST64(0x0000000002000202), CONST64(0x0000008002000202), - CONST64(0x0000000000020202), CONST64(0x0000008000020202), CONST64(0x0000000002020202), CONST64(0x0000008002020202), - CONST64(0x0200000000000000), CONST64(0x0200008000000000), CONST64(0x0200000002000000), CONST64(0x0200008002000000), - CONST64(0x0200000000020000), CONST64(0x0200008000020000), CONST64(0x0200000002020000), CONST64(0x0200008002020000), - CONST64(0x0200000000000200), CONST64(0x0200008000000200), CONST64(0x0200000002000200), CONST64(0x0200008002000200), - CONST64(0x0200000000020200), CONST64(0x0200008000020200), CONST64(0x0200000002020200), CONST64(0x0200008002020200), - CONST64(0x0200000000000002), CONST64(0x0200008000000002), CONST64(0x0200000002000002), CONST64(0x0200008002000002), - CONST64(0x0200000000020002), CONST64(0x0200008000020002), CONST64(0x0200000002020002), CONST64(0x0200008002020002), - CONST64(0x0200000000000202), CONST64(0x0200008000000202), CONST64(0x0200000002000202), CONST64(0x0200008002000202), - CONST64(0x0200000000020202), CONST64(0x0200008000020202), CONST64(0x0200000002020202), CONST64(0x0200008002020202), - CONST64(0x0002000000000000), CONST64(0x0002008000000000), CONST64(0x0002000002000000), CONST64(0x0002008002000000), - CONST64(0x0002000000020000), CONST64(0x0002008000020000), CONST64(0x0002000002020000), CONST64(0x0002008002020000), - CONST64(0x0002000000000200), CONST64(0x0002008000000200), CONST64(0x0002000002000200), CONST64(0x0002008002000200), - CONST64(0x0002000000020200), CONST64(0x0002008000020200), CONST64(0x0002000002020200), CONST64(0x0002008002020200), - CONST64(0x0002000000000002), CONST64(0x0002008000000002), CONST64(0x0002000002000002), CONST64(0x0002008002000002), - CONST64(0x0002000000020002), CONST64(0x0002008000020002), CONST64(0x0002000002020002), CONST64(0x0002008002020002), - CONST64(0x0002000000000202), CONST64(0x0002008000000202), CONST64(0x0002000002000202), CONST64(0x0002008002000202), - CONST64(0x0002000000020202), CONST64(0x0002008000020202), CONST64(0x0002000002020202), CONST64(0x0002008002020202), - CONST64(0x0202000000000000), CONST64(0x0202008000000000), CONST64(0x0202000002000000), CONST64(0x0202008002000000), - CONST64(0x0202000000020000), CONST64(0x0202008000020000), CONST64(0x0202000002020000), CONST64(0x0202008002020000), - CONST64(0x0202000000000200), CONST64(0x0202008000000200), CONST64(0x0202000002000200), CONST64(0x0202008002000200), - CONST64(0x0202000000020200), CONST64(0x0202008000020200), CONST64(0x0202000002020200), CONST64(0x0202008002020200), - CONST64(0x0202000000000002), CONST64(0x0202008000000002), CONST64(0x0202000002000002), CONST64(0x0202008002000002), - CONST64(0x0202000000020002), CONST64(0x0202008000020002), CONST64(0x0202000002020002), CONST64(0x0202008002020002), - CONST64(0x0202000000000202), CONST64(0x0202008000000202), CONST64(0x0202000002000202), CONST64(0x0202008002000202), - CONST64(0x0202000000020202), CONST64(0x0202008000020202), CONST64(0x0202000002020202), CONST64(0x0202008002020202), - CONST64(0x0000020000000000), CONST64(0x0000028000000000), CONST64(0x0000020002000000), CONST64(0x0000028002000000), - CONST64(0x0000020000020000), CONST64(0x0000028000020000), CONST64(0x0000020002020000), CONST64(0x0000028002020000), - CONST64(0x0000020000000200), CONST64(0x0000028000000200), CONST64(0x0000020002000200), CONST64(0x0000028002000200), - CONST64(0x0000020000020200), CONST64(0x0000028000020200), CONST64(0x0000020002020200), CONST64(0x0000028002020200), - CONST64(0x0000020000000002), CONST64(0x0000028000000002), CONST64(0x0000020002000002), CONST64(0x0000028002000002), - CONST64(0x0000020000020002), CONST64(0x0000028000020002), CONST64(0x0000020002020002), CONST64(0x0000028002020002), - CONST64(0x0000020000000202), CONST64(0x0000028000000202), CONST64(0x0000020002000202), CONST64(0x0000028002000202), - CONST64(0x0000020000020202), CONST64(0x0000028000020202), CONST64(0x0000020002020202), CONST64(0x0000028002020202), - CONST64(0x0200020000000000), CONST64(0x0200028000000000), CONST64(0x0200020002000000), CONST64(0x0200028002000000), - CONST64(0x0200020000020000), CONST64(0x0200028000020000), CONST64(0x0200020002020000), CONST64(0x0200028002020000), - CONST64(0x0200020000000200), CONST64(0x0200028000000200), CONST64(0x0200020002000200), CONST64(0x0200028002000200), - CONST64(0x0200020000020200), CONST64(0x0200028000020200), CONST64(0x0200020002020200), CONST64(0x0200028002020200), - CONST64(0x0200020000000002), CONST64(0x0200028000000002), CONST64(0x0200020002000002), CONST64(0x0200028002000002), - CONST64(0x0200020000020002), CONST64(0x0200028000020002), CONST64(0x0200020002020002), CONST64(0x0200028002020002), - CONST64(0x0200020000000202), CONST64(0x0200028000000202), CONST64(0x0200020002000202), CONST64(0x0200028002000202), - CONST64(0x0200020000020202), CONST64(0x0200028000020202), CONST64(0x0200020002020202), CONST64(0x0200028002020202), - CONST64(0x0002020000000000), CONST64(0x0002028000000000), CONST64(0x0002020002000000), CONST64(0x0002028002000000), - CONST64(0x0002020000020000), CONST64(0x0002028000020000), CONST64(0x0002020002020000), CONST64(0x0002028002020000), - CONST64(0x0002020000000200), CONST64(0x0002028000000200), CONST64(0x0002020002000200), CONST64(0x0002028002000200), - CONST64(0x0002020000020200), CONST64(0x0002028000020200), CONST64(0x0002020002020200), CONST64(0x0002028002020200), - CONST64(0x0002020000000002), CONST64(0x0002028000000002), CONST64(0x0002020002000002), CONST64(0x0002028002000002), - CONST64(0x0002020000020002), CONST64(0x0002028000020002), CONST64(0x0002020002020002), CONST64(0x0002028002020002), - CONST64(0x0002020000000202), CONST64(0x0002028000000202), CONST64(0x0002020002000202), CONST64(0x0002028002000202), - CONST64(0x0002020000020202), CONST64(0x0002028000020202), CONST64(0x0002020002020202), CONST64(0x0002028002020202), - CONST64(0x0202020000000000), CONST64(0x0202028000000000), CONST64(0x0202020002000000), CONST64(0x0202028002000000), - CONST64(0x0202020000020000), CONST64(0x0202028000020000), CONST64(0x0202020002020000), CONST64(0x0202028002020000), - CONST64(0x0202020000000200), CONST64(0x0202028000000200), CONST64(0x0202020002000200), CONST64(0x0202028002000200), - CONST64(0x0202020000020200), CONST64(0x0202028000020200), CONST64(0x0202020002020200), CONST64(0x0202028002020200), - CONST64(0x0202020000000002), CONST64(0x0202028000000002), CONST64(0x0202020002000002), CONST64(0x0202028002000002), - CONST64(0x0202020000020002), CONST64(0x0202028000020002), CONST64(0x0202020002020002), CONST64(0x0202028002020002), - CONST64(0x0202020000000202), CONST64(0x0202028000000202), CONST64(0x0202020002000202), CONST64(0x0202028002000202), +{ CONST64(0x0000000000000000), CONST64(0x0000008000000000), CONST64(0x0000000002000000), CONST64(0x0000008002000000), + CONST64(0x0000000000020000), CONST64(0x0000008000020000), CONST64(0x0000000002020000), CONST64(0x0000008002020000), + CONST64(0x0000000000000200), CONST64(0x0000008000000200), CONST64(0x0000000002000200), CONST64(0x0000008002000200), + CONST64(0x0000000000020200), CONST64(0x0000008000020200), CONST64(0x0000000002020200), CONST64(0x0000008002020200), + CONST64(0x0000000000000002), CONST64(0x0000008000000002), CONST64(0x0000000002000002), CONST64(0x0000008002000002), + CONST64(0x0000000000020002), CONST64(0x0000008000020002), CONST64(0x0000000002020002), CONST64(0x0000008002020002), + CONST64(0x0000000000000202), CONST64(0x0000008000000202), CONST64(0x0000000002000202), CONST64(0x0000008002000202), + CONST64(0x0000000000020202), CONST64(0x0000008000020202), CONST64(0x0000000002020202), CONST64(0x0000008002020202), + CONST64(0x0200000000000000), CONST64(0x0200008000000000), CONST64(0x0200000002000000), CONST64(0x0200008002000000), + CONST64(0x0200000000020000), CONST64(0x0200008000020000), CONST64(0x0200000002020000), CONST64(0x0200008002020000), + CONST64(0x0200000000000200), CONST64(0x0200008000000200), CONST64(0x0200000002000200), CONST64(0x0200008002000200), + CONST64(0x0200000000020200), CONST64(0x0200008000020200), CONST64(0x0200000002020200), CONST64(0x0200008002020200), + CONST64(0x0200000000000002), CONST64(0x0200008000000002), CONST64(0x0200000002000002), CONST64(0x0200008002000002), + CONST64(0x0200000000020002), CONST64(0x0200008000020002), CONST64(0x0200000002020002), CONST64(0x0200008002020002), + CONST64(0x0200000000000202), CONST64(0x0200008000000202), CONST64(0x0200000002000202), CONST64(0x0200008002000202), + CONST64(0x0200000000020202), CONST64(0x0200008000020202), CONST64(0x0200000002020202), CONST64(0x0200008002020202), + CONST64(0x0002000000000000), CONST64(0x0002008000000000), CONST64(0x0002000002000000), CONST64(0x0002008002000000), + CONST64(0x0002000000020000), CONST64(0x0002008000020000), CONST64(0x0002000002020000), CONST64(0x0002008002020000), + CONST64(0x0002000000000200), CONST64(0x0002008000000200), CONST64(0x0002000002000200), CONST64(0x0002008002000200), + CONST64(0x0002000000020200), CONST64(0x0002008000020200), CONST64(0x0002000002020200), CONST64(0x0002008002020200), + CONST64(0x0002000000000002), CONST64(0x0002008000000002), CONST64(0x0002000002000002), CONST64(0x0002008002000002), + CONST64(0x0002000000020002), CONST64(0x0002008000020002), CONST64(0x0002000002020002), CONST64(0x0002008002020002), + CONST64(0x0002000000000202), CONST64(0x0002008000000202), CONST64(0x0002000002000202), CONST64(0x0002008002000202), + CONST64(0x0002000000020202), CONST64(0x0002008000020202), CONST64(0x0002000002020202), CONST64(0x0002008002020202), + CONST64(0x0202000000000000), CONST64(0x0202008000000000), CONST64(0x0202000002000000), CONST64(0x0202008002000000), + CONST64(0x0202000000020000), CONST64(0x0202008000020000), CONST64(0x0202000002020000), CONST64(0x0202008002020000), + CONST64(0x0202000000000200), CONST64(0x0202008000000200), CONST64(0x0202000002000200), CONST64(0x0202008002000200), + CONST64(0x0202000000020200), CONST64(0x0202008000020200), CONST64(0x0202000002020200), CONST64(0x0202008002020200), + CONST64(0x0202000000000002), CONST64(0x0202008000000002), CONST64(0x0202000002000002), CONST64(0x0202008002000002), + CONST64(0x0202000000020002), CONST64(0x0202008000020002), CONST64(0x0202000002020002), CONST64(0x0202008002020002), + CONST64(0x0202000000000202), CONST64(0x0202008000000202), CONST64(0x0202000002000202), CONST64(0x0202008002000202), + CONST64(0x0202000000020202), CONST64(0x0202008000020202), CONST64(0x0202000002020202), CONST64(0x0202008002020202), + CONST64(0x0000020000000000), CONST64(0x0000028000000000), CONST64(0x0000020002000000), CONST64(0x0000028002000000), + CONST64(0x0000020000020000), CONST64(0x0000028000020000), CONST64(0x0000020002020000), CONST64(0x0000028002020000), + CONST64(0x0000020000000200), CONST64(0x0000028000000200), CONST64(0x0000020002000200), CONST64(0x0000028002000200), + CONST64(0x0000020000020200), CONST64(0x0000028000020200), CONST64(0x0000020002020200), CONST64(0x0000028002020200), + CONST64(0x0000020000000002), CONST64(0x0000028000000002), CONST64(0x0000020002000002), CONST64(0x0000028002000002), + CONST64(0x0000020000020002), CONST64(0x0000028000020002), CONST64(0x0000020002020002), CONST64(0x0000028002020002), + CONST64(0x0000020000000202), CONST64(0x0000028000000202), CONST64(0x0000020002000202), CONST64(0x0000028002000202), + CONST64(0x0000020000020202), CONST64(0x0000028000020202), CONST64(0x0000020002020202), CONST64(0x0000028002020202), + CONST64(0x0200020000000000), CONST64(0x0200028000000000), CONST64(0x0200020002000000), CONST64(0x0200028002000000), + CONST64(0x0200020000020000), CONST64(0x0200028000020000), CONST64(0x0200020002020000), CONST64(0x0200028002020000), + CONST64(0x0200020000000200), CONST64(0x0200028000000200), CONST64(0x0200020002000200), CONST64(0x0200028002000200), + CONST64(0x0200020000020200), CONST64(0x0200028000020200), CONST64(0x0200020002020200), CONST64(0x0200028002020200), + CONST64(0x0200020000000002), CONST64(0x0200028000000002), CONST64(0x0200020002000002), CONST64(0x0200028002000002), + CONST64(0x0200020000020002), CONST64(0x0200028000020002), CONST64(0x0200020002020002), CONST64(0x0200028002020002), + CONST64(0x0200020000000202), CONST64(0x0200028000000202), CONST64(0x0200020002000202), CONST64(0x0200028002000202), + CONST64(0x0200020000020202), CONST64(0x0200028000020202), CONST64(0x0200020002020202), CONST64(0x0200028002020202), + CONST64(0x0002020000000000), CONST64(0x0002028000000000), CONST64(0x0002020002000000), CONST64(0x0002028002000000), + CONST64(0x0002020000020000), CONST64(0x0002028000020000), CONST64(0x0002020002020000), CONST64(0x0002028002020000), + CONST64(0x0002020000000200), CONST64(0x0002028000000200), CONST64(0x0002020002000200), CONST64(0x0002028002000200), + CONST64(0x0002020000020200), CONST64(0x0002028000020200), CONST64(0x0002020002020200), CONST64(0x0002028002020200), + CONST64(0x0002020000000002), CONST64(0x0002028000000002), CONST64(0x0002020002000002), CONST64(0x0002028002000002), + CONST64(0x0002020000020002), CONST64(0x0002028000020002), CONST64(0x0002020002020002), CONST64(0x0002028002020002), + CONST64(0x0002020000000202), CONST64(0x0002028000000202), CONST64(0x0002020002000202), CONST64(0x0002028002000202), + CONST64(0x0002020000020202), CONST64(0x0002028000020202), CONST64(0x0002020002020202), CONST64(0x0002028002020202), + CONST64(0x0202020000000000), CONST64(0x0202028000000000), CONST64(0x0202020002000000), CONST64(0x0202028002000000), + CONST64(0x0202020000020000), CONST64(0x0202028000020000), CONST64(0x0202020002020000), CONST64(0x0202028002020000), + CONST64(0x0202020000000200), CONST64(0x0202028000000200), CONST64(0x0202020002000200), CONST64(0x0202028002000200), + CONST64(0x0202020000020200), CONST64(0x0202028000020200), CONST64(0x0202020002020200), CONST64(0x0202028002020200), + CONST64(0x0202020000000002), CONST64(0x0202028000000002), CONST64(0x0202020002000002), CONST64(0x0202028002000002), + CONST64(0x0202020000020002), CONST64(0x0202028000020002), CONST64(0x0202020002020002), CONST64(0x0202028002020002), + CONST64(0x0202020000000202), CONST64(0x0202028000000202), CONST64(0x0202020002000202), CONST64(0x0202028002000202), CONST64(0x0202020000020202), CONST64(0x0202028000020202), CONST64(0x0202020002020202), CONST64(0x0202028002020202) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000200000000), CONST64(0x0000000008000000), CONST64(0x0000000208000000), - CONST64(0x0000000000080000), CONST64(0x0000000200080000), CONST64(0x0000000008080000), CONST64(0x0000000208080000), - CONST64(0x0000000000000800), CONST64(0x0000000200000800), CONST64(0x0000000008000800), CONST64(0x0000000208000800), - CONST64(0x0000000000080800), CONST64(0x0000000200080800), CONST64(0x0000000008080800), CONST64(0x0000000208080800), - CONST64(0x0000000000000008), CONST64(0x0000000200000008), CONST64(0x0000000008000008), CONST64(0x0000000208000008), - CONST64(0x0000000000080008), CONST64(0x0000000200080008), CONST64(0x0000000008080008), CONST64(0x0000000208080008), - CONST64(0x0000000000000808), CONST64(0x0000000200000808), CONST64(0x0000000008000808), CONST64(0x0000000208000808), - CONST64(0x0000000000080808), CONST64(0x0000000200080808), CONST64(0x0000000008080808), CONST64(0x0000000208080808), - CONST64(0x0800000000000000), CONST64(0x0800000200000000), CONST64(0x0800000008000000), CONST64(0x0800000208000000), - CONST64(0x0800000000080000), CONST64(0x0800000200080000), CONST64(0x0800000008080000), CONST64(0x0800000208080000), - CONST64(0x0800000000000800), CONST64(0x0800000200000800), CONST64(0x0800000008000800), CONST64(0x0800000208000800), - CONST64(0x0800000000080800), CONST64(0x0800000200080800), CONST64(0x0800000008080800), CONST64(0x0800000208080800), - CONST64(0x0800000000000008), CONST64(0x0800000200000008), CONST64(0x0800000008000008), CONST64(0x0800000208000008), - CONST64(0x0800000000080008), CONST64(0x0800000200080008), CONST64(0x0800000008080008), CONST64(0x0800000208080008), - CONST64(0x0800000000000808), CONST64(0x0800000200000808), CONST64(0x0800000008000808), CONST64(0x0800000208000808), - CONST64(0x0800000000080808), CONST64(0x0800000200080808), CONST64(0x0800000008080808), CONST64(0x0800000208080808), - CONST64(0x0008000000000000), CONST64(0x0008000200000000), CONST64(0x0008000008000000), CONST64(0x0008000208000000), - CONST64(0x0008000000080000), CONST64(0x0008000200080000), CONST64(0x0008000008080000), CONST64(0x0008000208080000), - CONST64(0x0008000000000800), CONST64(0x0008000200000800), CONST64(0x0008000008000800), CONST64(0x0008000208000800), - CONST64(0x0008000000080800), CONST64(0x0008000200080800), CONST64(0x0008000008080800), CONST64(0x0008000208080800), - CONST64(0x0008000000000008), CONST64(0x0008000200000008), CONST64(0x0008000008000008), CONST64(0x0008000208000008), - CONST64(0x0008000000080008), CONST64(0x0008000200080008), CONST64(0x0008000008080008), CONST64(0x0008000208080008), - CONST64(0x0008000000000808), CONST64(0x0008000200000808), CONST64(0x0008000008000808), CONST64(0x0008000208000808), - CONST64(0x0008000000080808), CONST64(0x0008000200080808), CONST64(0x0008000008080808), CONST64(0x0008000208080808), - CONST64(0x0808000000000000), CONST64(0x0808000200000000), CONST64(0x0808000008000000), CONST64(0x0808000208000000), - CONST64(0x0808000000080000), CONST64(0x0808000200080000), CONST64(0x0808000008080000), CONST64(0x0808000208080000), - CONST64(0x0808000000000800), CONST64(0x0808000200000800), CONST64(0x0808000008000800), CONST64(0x0808000208000800), - CONST64(0x0808000000080800), CONST64(0x0808000200080800), CONST64(0x0808000008080800), CONST64(0x0808000208080800), - CONST64(0x0808000000000008), CONST64(0x0808000200000008), CONST64(0x0808000008000008), CONST64(0x0808000208000008), - CONST64(0x0808000000080008), CONST64(0x0808000200080008), CONST64(0x0808000008080008), CONST64(0x0808000208080008), - CONST64(0x0808000000000808), CONST64(0x0808000200000808), CONST64(0x0808000008000808), CONST64(0x0808000208000808), - CONST64(0x0808000000080808), CONST64(0x0808000200080808), CONST64(0x0808000008080808), CONST64(0x0808000208080808), - CONST64(0x0000080000000000), CONST64(0x0000080200000000), CONST64(0x0000080008000000), CONST64(0x0000080208000000), - CONST64(0x0000080000080000), CONST64(0x0000080200080000), CONST64(0x0000080008080000), CONST64(0x0000080208080000), - CONST64(0x0000080000000800), CONST64(0x0000080200000800), CONST64(0x0000080008000800), CONST64(0x0000080208000800), - CONST64(0x0000080000080800), CONST64(0x0000080200080800), CONST64(0x0000080008080800), CONST64(0x0000080208080800), - CONST64(0x0000080000000008), CONST64(0x0000080200000008), CONST64(0x0000080008000008), CONST64(0x0000080208000008), - CONST64(0x0000080000080008), CONST64(0x0000080200080008), CONST64(0x0000080008080008), CONST64(0x0000080208080008), - CONST64(0x0000080000000808), CONST64(0x0000080200000808), CONST64(0x0000080008000808), CONST64(0x0000080208000808), - CONST64(0x0000080000080808), CONST64(0x0000080200080808), CONST64(0x0000080008080808), CONST64(0x0000080208080808), - CONST64(0x0800080000000000), CONST64(0x0800080200000000), CONST64(0x0800080008000000), CONST64(0x0800080208000000), - CONST64(0x0800080000080000), CONST64(0x0800080200080000), CONST64(0x0800080008080000), CONST64(0x0800080208080000), - CONST64(0x0800080000000800), CONST64(0x0800080200000800), CONST64(0x0800080008000800), CONST64(0x0800080208000800), - CONST64(0x0800080000080800), CONST64(0x0800080200080800), CONST64(0x0800080008080800), CONST64(0x0800080208080800), - CONST64(0x0800080000000008), CONST64(0x0800080200000008), CONST64(0x0800080008000008), CONST64(0x0800080208000008), - CONST64(0x0800080000080008), CONST64(0x0800080200080008), CONST64(0x0800080008080008), CONST64(0x0800080208080008), - CONST64(0x0800080000000808), CONST64(0x0800080200000808), CONST64(0x0800080008000808), CONST64(0x0800080208000808), - CONST64(0x0800080000080808), CONST64(0x0800080200080808), CONST64(0x0800080008080808), CONST64(0x0800080208080808), - CONST64(0x0008080000000000), CONST64(0x0008080200000000), CONST64(0x0008080008000000), CONST64(0x0008080208000000), - CONST64(0x0008080000080000), CONST64(0x0008080200080000), CONST64(0x0008080008080000), CONST64(0x0008080208080000), - CONST64(0x0008080000000800), CONST64(0x0008080200000800), CONST64(0x0008080008000800), CONST64(0x0008080208000800), - CONST64(0x0008080000080800), CONST64(0x0008080200080800), CONST64(0x0008080008080800), CONST64(0x0008080208080800), - CONST64(0x0008080000000008), CONST64(0x0008080200000008), CONST64(0x0008080008000008), CONST64(0x0008080208000008), - CONST64(0x0008080000080008), CONST64(0x0008080200080008), CONST64(0x0008080008080008), CONST64(0x0008080208080008), - CONST64(0x0008080000000808), CONST64(0x0008080200000808), CONST64(0x0008080008000808), CONST64(0x0008080208000808), - CONST64(0x0008080000080808), CONST64(0x0008080200080808), CONST64(0x0008080008080808), CONST64(0x0008080208080808), - CONST64(0x0808080000000000), CONST64(0x0808080200000000), CONST64(0x0808080008000000), CONST64(0x0808080208000000), - CONST64(0x0808080000080000), CONST64(0x0808080200080000), CONST64(0x0808080008080000), CONST64(0x0808080208080000), - CONST64(0x0808080000000800), CONST64(0x0808080200000800), CONST64(0x0808080008000800), CONST64(0x0808080208000800), - CONST64(0x0808080000080800), CONST64(0x0808080200080800), CONST64(0x0808080008080800), CONST64(0x0808080208080800), - CONST64(0x0808080000000008), CONST64(0x0808080200000008), CONST64(0x0808080008000008), CONST64(0x0808080208000008), - CONST64(0x0808080000080008), CONST64(0x0808080200080008), CONST64(0x0808080008080008), CONST64(0x0808080208080008), - CONST64(0x0808080000000808), CONST64(0x0808080200000808), CONST64(0x0808080008000808), CONST64(0x0808080208000808), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000200000000), CONST64(0x0000000008000000), CONST64(0x0000000208000000), + CONST64(0x0000000000080000), CONST64(0x0000000200080000), CONST64(0x0000000008080000), CONST64(0x0000000208080000), + CONST64(0x0000000000000800), CONST64(0x0000000200000800), CONST64(0x0000000008000800), CONST64(0x0000000208000800), + CONST64(0x0000000000080800), CONST64(0x0000000200080800), CONST64(0x0000000008080800), CONST64(0x0000000208080800), + CONST64(0x0000000000000008), CONST64(0x0000000200000008), CONST64(0x0000000008000008), CONST64(0x0000000208000008), + CONST64(0x0000000000080008), CONST64(0x0000000200080008), CONST64(0x0000000008080008), CONST64(0x0000000208080008), + CONST64(0x0000000000000808), CONST64(0x0000000200000808), CONST64(0x0000000008000808), CONST64(0x0000000208000808), + CONST64(0x0000000000080808), CONST64(0x0000000200080808), CONST64(0x0000000008080808), CONST64(0x0000000208080808), + CONST64(0x0800000000000000), CONST64(0x0800000200000000), CONST64(0x0800000008000000), CONST64(0x0800000208000000), + CONST64(0x0800000000080000), CONST64(0x0800000200080000), CONST64(0x0800000008080000), CONST64(0x0800000208080000), + CONST64(0x0800000000000800), CONST64(0x0800000200000800), CONST64(0x0800000008000800), CONST64(0x0800000208000800), + CONST64(0x0800000000080800), CONST64(0x0800000200080800), CONST64(0x0800000008080800), CONST64(0x0800000208080800), + CONST64(0x0800000000000008), CONST64(0x0800000200000008), CONST64(0x0800000008000008), CONST64(0x0800000208000008), + CONST64(0x0800000000080008), CONST64(0x0800000200080008), CONST64(0x0800000008080008), CONST64(0x0800000208080008), + CONST64(0x0800000000000808), CONST64(0x0800000200000808), CONST64(0x0800000008000808), CONST64(0x0800000208000808), + CONST64(0x0800000000080808), CONST64(0x0800000200080808), CONST64(0x0800000008080808), CONST64(0x0800000208080808), + CONST64(0x0008000000000000), CONST64(0x0008000200000000), CONST64(0x0008000008000000), CONST64(0x0008000208000000), + CONST64(0x0008000000080000), CONST64(0x0008000200080000), CONST64(0x0008000008080000), CONST64(0x0008000208080000), + CONST64(0x0008000000000800), CONST64(0x0008000200000800), CONST64(0x0008000008000800), CONST64(0x0008000208000800), + CONST64(0x0008000000080800), CONST64(0x0008000200080800), CONST64(0x0008000008080800), CONST64(0x0008000208080800), + CONST64(0x0008000000000008), CONST64(0x0008000200000008), CONST64(0x0008000008000008), CONST64(0x0008000208000008), + CONST64(0x0008000000080008), CONST64(0x0008000200080008), CONST64(0x0008000008080008), CONST64(0x0008000208080008), + CONST64(0x0008000000000808), CONST64(0x0008000200000808), CONST64(0x0008000008000808), CONST64(0x0008000208000808), + CONST64(0x0008000000080808), CONST64(0x0008000200080808), CONST64(0x0008000008080808), CONST64(0x0008000208080808), + CONST64(0x0808000000000000), CONST64(0x0808000200000000), CONST64(0x0808000008000000), CONST64(0x0808000208000000), + CONST64(0x0808000000080000), CONST64(0x0808000200080000), CONST64(0x0808000008080000), CONST64(0x0808000208080000), + CONST64(0x0808000000000800), CONST64(0x0808000200000800), CONST64(0x0808000008000800), CONST64(0x0808000208000800), + CONST64(0x0808000000080800), CONST64(0x0808000200080800), CONST64(0x0808000008080800), CONST64(0x0808000208080800), + CONST64(0x0808000000000008), CONST64(0x0808000200000008), CONST64(0x0808000008000008), CONST64(0x0808000208000008), + CONST64(0x0808000000080008), CONST64(0x0808000200080008), CONST64(0x0808000008080008), CONST64(0x0808000208080008), + CONST64(0x0808000000000808), CONST64(0x0808000200000808), CONST64(0x0808000008000808), CONST64(0x0808000208000808), + CONST64(0x0808000000080808), CONST64(0x0808000200080808), CONST64(0x0808000008080808), CONST64(0x0808000208080808), + CONST64(0x0000080000000000), CONST64(0x0000080200000000), CONST64(0x0000080008000000), CONST64(0x0000080208000000), + CONST64(0x0000080000080000), CONST64(0x0000080200080000), CONST64(0x0000080008080000), CONST64(0x0000080208080000), + CONST64(0x0000080000000800), CONST64(0x0000080200000800), CONST64(0x0000080008000800), CONST64(0x0000080208000800), + CONST64(0x0000080000080800), CONST64(0x0000080200080800), CONST64(0x0000080008080800), CONST64(0x0000080208080800), + CONST64(0x0000080000000008), CONST64(0x0000080200000008), CONST64(0x0000080008000008), CONST64(0x0000080208000008), + CONST64(0x0000080000080008), CONST64(0x0000080200080008), CONST64(0x0000080008080008), CONST64(0x0000080208080008), + CONST64(0x0000080000000808), CONST64(0x0000080200000808), CONST64(0x0000080008000808), CONST64(0x0000080208000808), + CONST64(0x0000080000080808), CONST64(0x0000080200080808), CONST64(0x0000080008080808), CONST64(0x0000080208080808), + CONST64(0x0800080000000000), CONST64(0x0800080200000000), CONST64(0x0800080008000000), CONST64(0x0800080208000000), + CONST64(0x0800080000080000), CONST64(0x0800080200080000), CONST64(0x0800080008080000), CONST64(0x0800080208080000), + CONST64(0x0800080000000800), CONST64(0x0800080200000800), CONST64(0x0800080008000800), CONST64(0x0800080208000800), + CONST64(0x0800080000080800), CONST64(0x0800080200080800), CONST64(0x0800080008080800), CONST64(0x0800080208080800), + CONST64(0x0800080000000008), CONST64(0x0800080200000008), CONST64(0x0800080008000008), CONST64(0x0800080208000008), + CONST64(0x0800080000080008), CONST64(0x0800080200080008), CONST64(0x0800080008080008), CONST64(0x0800080208080008), + CONST64(0x0800080000000808), CONST64(0x0800080200000808), CONST64(0x0800080008000808), CONST64(0x0800080208000808), + CONST64(0x0800080000080808), CONST64(0x0800080200080808), CONST64(0x0800080008080808), CONST64(0x0800080208080808), + CONST64(0x0008080000000000), CONST64(0x0008080200000000), CONST64(0x0008080008000000), CONST64(0x0008080208000000), + CONST64(0x0008080000080000), CONST64(0x0008080200080000), CONST64(0x0008080008080000), CONST64(0x0008080208080000), + CONST64(0x0008080000000800), CONST64(0x0008080200000800), CONST64(0x0008080008000800), CONST64(0x0008080208000800), + CONST64(0x0008080000080800), CONST64(0x0008080200080800), CONST64(0x0008080008080800), CONST64(0x0008080208080800), + CONST64(0x0008080000000008), CONST64(0x0008080200000008), CONST64(0x0008080008000008), CONST64(0x0008080208000008), + CONST64(0x0008080000080008), CONST64(0x0008080200080008), CONST64(0x0008080008080008), CONST64(0x0008080208080008), + CONST64(0x0008080000000808), CONST64(0x0008080200000808), CONST64(0x0008080008000808), CONST64(0x0008080208000808), + CONST64(0x0008080000080808), CONST64(0x0008080200080808), CONST64(0x0008080008080808), CONST64(0x0008080208080808), + CONST64(0x0808080000000000), CONST64(0x0808080200000000), CONST64(0x0808080008000000), CONST64(0x0808080208000000), + CONST64(0x0808080000080000), CONST64(0x0808080200080000), CONST64(0x0808080008080000), CONST64(0x0808080208080000), + CONST64(0x0808080000000800), CONST64(0x0808080200000800), CONST64(0x0808080008000800), CONST64(0x0808080208000800), + CONST64(0x0808080000080800), CONST64(0x0808080200080800), CONST64(0x0808080008080800), CONST64(0x0808080208080800), + CONST64(0x0808080000000008), CONST64(0x0808080200000008), CONST64(0x0808080008000008), CONST64(0x0808080208000008), + CONST64(0x0808080000080008), CONST64(0x0808080200080008), CONST64(0x0808080008080008), CONST64(0x0808080208080008), + CONST64(0x0808080000000808), CONST64(0x0808080200000808), CONST64(0x0808080008000808), CONST64(0x0808080208000808), CONST64(0x0808080000080808), CONST64(0x0808080200080808), CONST64(0x0808080008080808), CONST64(0x0808080208080808) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000800000000), CONST64(0x0000000020000000), CONST64(0x0000000820000000), - CONST64(0x0000000000200000), CONST64(0x0000000800200000), CONST64(0x0000000020200000), CONST64(0x0000000820200000), - CONST64(0x0000000000002000), CONST64(0x0000000800002000), CONST64(0x0000000020002000), CONST64(0x0000000820002000), - CONST64(0x0000000000202000), CONST64(0x0000000800202000), CONST64(0x0000000020202000), CONST64(0x0000000820202000), - CONST64(0x0000000000000020), CONST64(0x0000000800000020), CONST64(0x0000000020000020), CONST64(0x0000000820000020), - CONST64(0x0000000000200020), CONST64(0x0000000800200020), CONST64(0x0000000020200020), CONST64(0x0000000820200020), - CONST64(0x0000000000002020), CONST64(0x0000000800002020), CONST64(0x0000000020002020), CONST64(0x0000000820002020), - CONST64(0x0000000000202020), CONST64(0x0000000800202020), CONST64(0x0000000020202020), CONST64(0x0000000820202020), - CONST64(0x2000000000000000), CONST64(0x2000000800000000), CONST64(0x2000000020000000), CONST64(0x2000000820000000), - CONST64(0x2000000000200000), CONST64(0x2000000800200000), CONST64(0x2000000020200000), CONST64(0x2000000820200000), - CONST64(0x2000000000002000), CONST64(0x2000000800002000), CONST64(0x2000000020002000), CONST64(0x2000000820002000), - CONST64(0x2000000000202000), CONST64(0x2000000800202000), CONST64(0x2000000020202000), CONST64(0x2000000820202000), - CONST64(0x2000000000000020), CONST64(0x2000000800000020), CONST64(0x2000000020000020), CONST64(0x2000000820000020), - CONST64(0x2000000000200020), CONST64(0x2000000800200020), CONST64(0x2000000020200020), CONST64(0x2000000820200020), - CONST64(0x2000000000002020), CONST64(0x2000000800002020), CONST64(0x2000000020002020), CONST64(0x2000000820002020), - CONST64(0x2000000000202020), CONST64(0x2000000800202020), CONST64(0x2000000020202020), CONST64(0x2000000820202020), - CONST64(0x0020000000000000), CONST64(0x0020000800000000), CONST64(0x0020000020000000), CONST64(0x0020000820000000), - CONST64(0x0020000000200000), CONST64(0x0020000800200000), CONST64(0x0020000020200000), CONST64(0x0020000820200000), - CONST64(0x0020000000002000), CONST64(0x0020000800002000), CONST64(0x0020000020002000), CONST64(0x0020000820002000), - CONST64(0x0020000000202000), CONST64(0x0020000800202000), CONST64(0x0020000020202000), CONST64(0x0020000820202000), - CONST64(0x0020000000000020), CONST64(0x0020000800000020), CONST64(0x0020000020000020), CONST64(0x0020000820000020), - CONST64(0x0020000000200020), CONST64(0x0020000800200020), CONST64(0x0020000020200020), CONST64(0x0020000820200020), - CONST64(0x0020000000002020), CONST64(0x0020000800002020), CONST64(0x0020000020002020), CONST64(0x0020000820002020), - CONST64(0x0020000000202020), CONST64(0x0020000800202020), CONST64(0x0020000020202020), CONST64(0x0020000820202020), - CONST64(0x2020000000000000), CONST64(0x2020000800000000), CONST64(0x2020000020000000), CONST64(0x2020000820000000), - CONST64(0x2020000000200000), CONST64(0x2020000800200000), CONST64(0x2020000020200000), CONST64(0x2020000820200000), - CONST64(0x2020000000002000), CONST64(0x2020000800002000), CONST64(0x2020000020002000), CONST64(0x2020000820002000), - CONST64(0x2020000000202000), CONST64(0x2020000800202000), CONST64(0x2020000020202000), CONST64(0x2020000820202000), - CONST64(0x2020000000000020), CONST64(0x2020000800000020), CONST64(0x2020000020000020), CONST64(0x2020000820000020), - CONST64(0x2020000000200020), CONST64(0x2020000800200020), CONST64(0x2020000020200020), CONST64(0x2020000820200020), - CONST64(0x2020000000002020), CONST64(0x2020000800002020), CONST64(0x2020000020002020), CONST64(0x2020000820002020), - CONST64(0x2020000000202020), CONST64(0x2020000800202020), CONST64(0x2020000020202020), CONST64(0x2020000820202020), - CONST64(0x0000200000000000), CONST64(0x0000200800000000), CONST64(0x0000200020000000), CONST64(0x0000200820000000), - CONST64(0x0000200000200000), CONST64(0x0000200800200000), CONST64(0x0000200020200000), CONST64(0x0000200820200000), - CONST64(0x0000200000002000), CONST64(0x0000200800002000), CONST64(0x0000200020002000), CONST64(0x0000200820002000), - CONST64(0x0000200000202000), CONST64(0x0000200800202000), CONST64(0x0000200020202000), CONST64(0x0000200820202000), - CONST64(0x0000200000000020), CONST64(0x0000200800000020), CONST64(0x0000200020000020), CONST64(0x0000200820000020), - CONST64(0x0000200000200020), CONST64(0x0000200800200020), CONST64(0x0000200020200020), CONST64(0x0000200820200020), - CONST64(0x0000200000002020), CONST64(0x0000200800002020), CONST64(0x0000200020002020), CONST64(0x0000200820002020), - CONST64(0x0000200000202020), CONST64(0x0000200800202020), CONST64(0x0000200020202020), CONST64(0x0000200820202020), - CONST64(0x2000200000000000), CONST64(0x2000200800000000), CONST64(0x2000200020000000), CONST64(0x2000200820000000), - CONST64(0x2000200000200000), CONST64(0x2000200800200000), CONST64(0x2000200020200000), CONST64(0x2000200820200000), - CONST64(0x2000200000002000), CONST64(0x2000200800002000), CONST64(0x2000200020002000), CONST64(0x2000200820002000), - CONST64(0x2000200000202000), CONST64(0x2000200800202000), CONST64(0x2000200020202000), CONST64(0x2000200820202000), - CONST64(0x2000200000000020), CONST64(0x2000200800000020), CONST64(0x2000200020000020), CONST64(0x2000200820000020), - CONST64(0x2000200000200020), CONST64(0x2000200800200020), CONST64(0x2000200020200020), CONST64(0x2000200820200020), - CONST64(0x2000200000002020), CONST64(0x2000200800002020), CONST64(0x2000200020002020), CONST64(0x2000200820002020), - CONST64(0x2000200000202020), CONST64(0x2000200800202020), CONST64(0x2000200020202020), CONST64(0x2000200820202020), - CONST64(0x0020200000000000), CONST64(0x0020200800000000), CONST64(0x0020200020000000), CONST64(0x0020200820000000), - CONST64(0x0020200000200000), CONST64(0x0020200800200000), CONST64(0x0020200020200000), CONST64(0x0020200820200000), - CONST64(0x0020200000002000), CONST64(0x0020200800002000), CONST64(0x0020200020002000), CONST64(0x0020200820002000), - CONST64(0x0020200000202000), CONST64(0x0020200800202000), CONST64(0x0020200020202000), CONST64(0x0020200820202000), - CONST64(0x0020200000000020), CONST64(0x0020200800000020), CONST64(0x0020200020000020), CONST64(0x0020200820000020), - CONST64(0x0020200000200020), CONST64(0x0020200800200020), CONST64(0x0020200020200020), CONST64(0x0020200820200020), - CONST64(0x0020200000002020), CONST64(0x0020200800002020), CONST64(0x0020200020002020), CONST64(0x0020200820002020), - CONST64(0x0020200000202020), CONST64(0x0020200800202020), CONST64(0x0020200020202020), CONST64(0x0020200820202020), - CONST64(0x2020200000000000), CONST64(0x2020200800000000), CONST64(0x2020200020000000), CONST64(0x2020200820000000), - CONST64(0x2020200000200000), CONST64(0x2020200800200000), CONST64(0x2020200020200000), CONST64(0x2020200820200000), - CONST64(0x2020200000002000), CONST64(0x2020200800002000), CONST64(0x2020200020002000), CONST64(0x2020200820002000), - CONST64(0x2020200000202000), CONST64(0x2020200800202000), CONST64(0x2020200020202000), CONST64(0x2020200820202000), - CONST64(0x2020200000000020), CONST64(0x2020200800000020), CONST64(0x2020200020000020), CONST64(0x2020200820000020), - CONST64(0x2020200000200020), CONST64(0x2020200800200020), CONST64(0x2020200020200020), CONST64(0x2020200820200020), - CONST64(0x2020200000002020), CONST64(0x2020200800002020), CONST64(0x2020200020002020), CONST64(0x2020200820002020), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000800000000), CONST64(0x0000000020000000), CONST64(0x0000000820000000), + CONST64(0x0000000000200000), CONST64(0x0000000800200000), CONST64(0x0000000020200000), CONST64(0x0000000820200000), + CONST64(0x0000000000002000), CONST64(0x0000000800002000), CONST64(0x0000000020002000), CONST64(0x0000000820002000), + CONST64(0x0000000000202000), CONST64(0x0000000800202000), CONST64(0x0000000020202000), CONST64(0x0000000820202000), + CONST64(0x0000000000000020), CONST64(0x0000000800000020), CONST64(0x0000000020000020), CONST64(0x0000000820000020), + CONST64(0x0000000000200020), CONST64(0x0000000800200020), CONST64(0x0000000020200020), CONST64(0x0000000820200020), + CONST64(0x0000000000002020), CONST64(0x0000000800002020), CONST64(0x0000000020002020), CONST64(0x0000000820002020), + CONST64(0x0000000000202020), CONST64(0x0000000800202020), CONST64(0x0000000020202020), CONST64(0x0000000820202020), + CONST64(0x2000000000000000), CONST64(0x2000000800000000), CONST64(0x2000000020000000), CONST64(0x2000000820000000), + CONST64(0x2000000000200000), CONST64(0x2000000800200000), CONST64(0x2000000020200000), CONST64(0x2000000820200000), + CONST64(0x2000000000002000), CONST64(0x2000000800002000), CONST64(0x2000000020002000), CONST64(0x2000000820002000), + CONST64(0x2000000000202000), CONST64(0x2000000800202000), CONST64(0x2000000020202000), CONST64(0x2000000820202000), + CONST64(0x2000000000000020), CONST64(0x2000000800000020), CONST64(0x2000000020000020), CONST64(0x2000000820000020), + CONST64(0x2000000000200020), CONST64(0x2000000800200020), CONST64(0x2000000020200020), CONST64(0x2000000820200020), + CONST64(0x2000000000002020), CONST64(0x2000000800002020), CONST64(0x2000000020002020), CONST64(0x2000000820002020), + CONST64(0x2000000000202020), CONST64(0x2000000800202020), CONST64(0x2000000020202020), CONST64(0x2000000820202020), + CONST64(0x0020000000000000), CONST64(0x0020000800000000), CONST64(0x0020000020000000), CONST64(0x0020000820000000), + CONST64(0x0020000000200000), CONST64(0x0020000800200000), CONST64(0x0020000020200000), CONST64(0x0020000820200000), + CONST64(0x0020000000002000), CONST64(0x0020000800002000), CONST64(0x0020000020002000), CONST64(0x0020000820002000), + CONST64(0x0020000000202000), CONST64(0x0020000800202000), CONST64(0x0020000020202000), CONST64(0x0020000820202000), + CONST64(0x0020000000000020), CONST64(0x0020000800000020), CONST64(0x0020000020000020), CONST64(0x0020000820000020), + CONST64(0x0020000000200020), CONST64(0x0020000800200020), CONST64(0x0020000020200020), CONST64(0x0020000820200020), + CONST64(0x0020000000002020), CONST64(0x0020000800002020), CONST64(0x0020000020002020), CONST64(0x0020000820002020), + CONST64(0x0020000000202020), CONST64(0x0020000800202020), CONST64(0x0020000020202020), CONST64(0x0020000820202020), + CONST64(0x2020000000000000), CONST64(0x2020000800000000), CONST64(0x2020000020000000), CONST64(0x2020000820000000), + CONST64(0x2020000000200000), CONST64(0x2020000800200000), CONST64(0x2020000020200000), CONST64(0x2020000820200000), + CONST64(0x2020000000002000), CONST64(0x2020000800002000), CONST64(0x2020000020002000), CONST64(0x2020000820002000), + CONST64(0x2020000000202000), CONST64(0x2020000800202000), CONST64(0x2020000020202000), CONST64(0x2020000820202000), + CONST64(0x2020000000000020), CONST64(0x2020000800000020), CONST64(0x2020000020000020), CONST64(0x2020000820000020), + CONST64(0x2020000000200020), CONST64(0x2020000800200020), CONST64(0x2020000020200020), CONST64(0x2020000820200020), + CONST64(0x2020000000002020), CONST64(0x2020000800002020), CONST64(0x2020000020002020), CONST64(0x2020000820002020), + CONST64(0x2020000000202020), CONST64(0x2020000800202020), CONST64(0x2020000020202020), CONST64(0x2020000820202020), + CONST64(0x0000200000000000), CONST64(0x0000200800000000), CONST64(0x0000200020000000), CONST64(0x0000200820000000), + CONST64(0x0000200000200000), CONST64(0x0000200800200000), CONST64(0x0000200020200000), CONST64(0x0000200820200000), + CONST64(0x0000200000002000), CONST64(0x0000200800002000), CONST64(0x0000200020002000), CONST64(0x0000200820002000), + CONST64(0x0000200000202000), CONST64(0x0000200800202000), CONST64(0x0000200020202000), CONST64(0x0000200820202000), + CONST64(0x0000200000000020), CONST64(0x0000200800000020), CONST64(0x0000200020000020), CONST64(0x0000200820000020), + CONST64(0x0000200000200020), CONST64(0x0000200800200020), CONST64(0x0000200020200020), CONST64(0x0000200820200020), + CONST64(0x0000200000002020), CONST64(0x0000200800002020), CONST64(0x0000200020002020), CONST64(0x0000200820002020), + CONST64(0x0000200000202020), CONST64(0x0000200800202020), CONST64(0x0000200020202020), CONST64(0x0000200820202020), + CONST64(0x2000200000000000), CONST64(0x2000200800000000), CONST64(0x2000200020000000), CONST64(0x2000200820000000), + CONST64(0x2000200000200000), CONST64(0x2000200800200000), CONST64(0x2000200020200000), CONST64(0x2000200820200000), + CONST64(0x2000200000002000), CONST64(0x2000200800002000), CONST64(0x2000200020002000), CONST64(0x2000200820002000), + CONST64(0x2000200000202000), CONST64(0x2000200800202000), CONST64(0x2000200020202000), CONST64(0x2000200820202000), + CONST64(0x2000200000000020), CONST64(0x2000200800000020), CONST64(0x2000200020000020), CONST64(0x2000200820000020), + CONST64(0x2000200000200020), CONST64(0x2000200800200020), CONST64(0x2000200020200020), CONST64(0x2000200820200020), + CONST64(0x2000200000002020), CONST64(0x2000200800002020), CONST64(0x2000200020002020), CONST64(0x2000200820002020), + CONST64(0x2000200000202020), CONST64(0x2000200800202020), CONST64(0x2000200020202020), CONST64(0x2000200820202020), + CONST64(0x0020200000000000), CONST64(0x0020200800000000), CONST64(0x0020200020000000), CONST64(0x0020200820000000), + CONST64(0x0020200000200000), CONST64(0x0020200800200000), CONST64(0x0020200020200000), CONST64(0x0020200820200000), + CONST64(0x0020200000002000), CONST64(0x0020200800002000), CONST64(0x0020200020002000), CONST64(0x0020200820002000), + CONST64(0x0020200000202000), CONST64(0x0020200800202000), CONST64(0x0020200020202000), CONST64(0x0020200820202000), + CONST64(0x0020200000000020), CONST64(0x0020200800000020), CONST64(0x0020200020000020), CONST64(0x0020200820000020), + CONST64(0x0020200000200020), CONST64(0x0020200800200020), CONST64(0x0020200020200020), CONST64(0x0020200820200020), + CONST64(0x0020200000002020), CONST64(0x0020200800002020), CONST64(0x0020200020002020), CONST64(0x0020200820002020), + CONST64(0x0020200000202020), CONST64(0x0020200800202020), CONST64(0x0020200020202020), CONST64(0x0020200820202020), + CONST64(0x2020200000000000), CONST64(0x2020200800000000), CONST64(0x2020200020000000), CONST64(0x2020200820000000), + CONST64(0x2020200000200000), CONST64(0x2020200800200000), CONST64(0x2020200020200000), CONST64(0x2020200820200000), + CONST64(0x2020200000002000), CONST64(0x2020200800002000), CONST64(0x2020200020002000), CONST64(0x2020200820002000), + CONST64(0x2020200000202000), CONST64(0x2020200800202000), CONST64(0x2020200020202000), CONST64(0x2020200820202000), + CONST64(0x2020200000000020), CONST64(0x2020200800000020), CONST64(0x2020200020000020), CONST64(0x2020200820000020), + CONST64(0x2020200000200020), CONST64(0x2020200800200020), CONST64(0x2020200020200020), CONST64(0x2020200820200020), + CONST64(0x2020200000002020), CONST64(0x2020200800002020), CONST64(0x2020200020002020), CONST64(0x2020200820002020), CONST64(0x2020200000202020), CONST64(0x2020200800202020), CONST64(0x2020200020202020), CONST64(0x2020200820202020) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000002000000000), CONST64(0x0000000080000000), CONST64(0x0000002080000000), - CONST64(0x0000000000800000), CONST64(0x0000002000800000), CONST64(0x0000000080800000), CONST64(0x0000002080800000), - CONST64(0x0000000000008000), CONST64(0x0000002000008000), CONST64(0x0000000080008000), CONST64(0x0000002080008000), - CONST64(0x0000000000808000), CONST64(0x0000002000808000), CONST64(0x0000000080808000), CONST64(0x0000002080808000), - CONST64(0x0000000000000080), CONST64(0x0000002000000080), CONST64(0x0000000080000080), CONST64(0x0000002080000080), - CONST64(0x0000000000800080), CONST64(0x0000002000800080), CONST64(0x0000000080800080), CONST64(0x0000002080800080), - CONST64(0x0000000000008080), CONST64(0x0000002000008080), CONST64(0x0000000080008080), CONST64(0x0000002080008080), - CONST64(0x0000000000808080), CONST64(0x0000002000808080), CONST64(0x0000000080808080), CONST64(0x0000002080808080), - CONST64(0x8000000000000000), CONST64(0x8000002000000000), CONST64(0x8000000080000000), CONST64(0x8000002080000000), - CONST64(0x8000000000800000), CONST64(0x8000002000800000), CONST64(0x8000000080800000), CONST64(0x8000002080800000), - CONST64(0x8000000000008000), CONST64(0x8000002000008000), CONST64(0x8000000080008000), CONST64(0x8000002080008000), - CONST64(0x8000000000808000), CONST64(0x8000002000808000), CONST64(0x8000000080808000), CONST64(0x8000002080808000), - CONST64(0x8000000000000080), CONST64(0x8000002000000080), CONST64(0x8000000080000080), CONST64(0x8000002080000080), - CONST64(0x8000000000800080), CONST64(0x8000002000800080), CONST64(0x8000000080800080), CONST64(0x8000002080800080), - CONST64(0x8000000000008080), CONST64(0x8000002000008080), CONST64(0x8000000080008080), CONST64(0x8000002080008080), - CONST64(0x8000000000808080), CONST64(0x8000002000808080), CONST64(0x8000000080808080), CONST64(0x8000002080808080), - CONST64(0x0080000000000000), CONST64(0x0080002000000000), CONST64(0x0080000080000000), CONST64(0x0080002080000000), - CONST64(0x0080000000800000), CONST64(0x0080002000800000), CONST64(0x0080000080800000), CONST64(0x0080002080800000), - CONST64(0x0080000000008000), CONST64(0x0080002000008000), CONST64(0x0080000080008000), CONST64(0x0080002080008000), - CONST64(0x0080000000808000), CONST64(0x0080002000808000), CONST64(0x0080000080808000), CONST64(0x0080002080808000), - CONST64(0x0080000000000080), CONST64(0x0080002000000080), CONST64(0x0080000080000080), CONST64(0x0080002080000080), - CONST64(0x0080000000800080), CONST64(0x0080002000800080), CONST64(0x0080000080800080), CONST64(0x0080002080800080), - CONST64(0x0080000000008080), CONST64(0x0080002000008080), CONST64(0x0080000080008080), CONST64(0x0080002080008080), - CONST64(0x0080000000808080), CONST64(0x0080002000808080), CONST64(0x0080000080808080), CONST64(0x0080002080808080), - CONST64(0x8080000000000000), CONST64(0x8080002000000000), CONST64(0x8080000080000000), CONST64(0x8080002080000000), - CONST64(0x8080000000800000), CONST64(0x8080002000800000), CONST64(0x8080000080800000), CONST64(0x8080002080800000), - CONST64(0x8080000000008000), CONST64(0x8080002000008000), CONST64(0x8080000080008000), CONST64(0x8080002080008000), - CONST64(0x8080000000808000), CONST64(0x8080002000808000), CONST64(0x8080000080808000), CONST64(0x8080002080808000), - CONST64(0x8080000000000080), CONST64(0x8080002000000080), CONST64(0x8080000080000080), CONST64(0x8080002080000080), - CONST64(0x8080000000800080), CONST64(0x8080002000800080), CONST64(0x8080000080800080), CONST64(0x8080002080800080), - CONST64(0x8080000000008080), CONST64(0x8080002000008080), CONST64(0x8080000080008080), CONST64(0x8080002080008080), - CONST64(0x8080000000808080), CONST64(0x8080002000808080), CONST64(0x8080000080808080), CONST64(0x8080002080808080), - CONST64(0x0000800000000000), CONST64(0x0000802000000000), CONST64(0x0000800080000000), CONST64(0x0000802080000000), - CONST64(0x0000800000800000), CONST64(0x0000802000800000), CONST64(0x0000800080800000), CONST64(0x0000802080800000), - CONST64(0x0000800000008000), CONST64(0x0000802000008000), CONST64(0x0000800080008000), CONST64(0x0000802080008000), - CONST64(0x0000800000808000), CONST64(0x0000802000808000), CONST64(0x0000800080808000), CONST64(0x0000802080808000), - CONST64(0x0000800000000080), CONST64(0x0000802000000080), CONST64(0x0000800080000080), CONST64(0x0000802080000080), - CONST64(0x0000800000800080), CONST64(0x0000802000800080), CONST64(0x0000800080800080), CONST64(0x0000802080800080), - CONST64(0x0000800000008080), CONST64(0x0000802000008080), CONST64(0x0000800080008080), CONST64(0x0000802080008080), - CONST64(0x0000800000808080), CONST64(0x0000802000808080), CONST64(0x0000800080808080), CONST64(0x0000802080808080), - CONST64(0x8000800000000000), CONST64(0x8000802000000000), CONST64(0x8000800080000000), CONST64(0x8000802080000000), - CONST64(0x8000800000800000), CONST64(0x8000802000800000), CONST64(0x8000800080800000), CONST64(0x8000802080800000), - CONST64(0x8000800000008000), CONST64(0x8000802000008000), CONST64(0x8000800080008000), CONST64(0x8000802080008000), - CONST64(0x8000800000808000), CONST64(0x8000802000808000), CONST64(0x8000800080808000), CONST64(0x8000802080808000), - CONST64(0x8000800000000080), CONST64(0x8000802000000080), CONST64(0x8000800080000080), CONST64(0x8000802080000080), - CONST64(0x8000800000800080), CONST64(0x8000802000800080), CONST64(0x8000800080800080), CONST64(0x8000802080800080), - CONST64(0x8000800000008080), CONST64(0x8000802000008080), CONST64(0x8000800080008080), CONST64(0x8000802080008080), - CONST64(0x8000800000808080), CONST64(0x8000802000808080), CONST64(0x8000800080808080), CONST64(0x8000802080808080), - CONST64(0x0080800000000000), CONST64(0x0080802000000000), CONST64(0x0080800080000000), CONST64(0x0080802080000000), - CONST64(0x0080800000800000), CONST64(0x0080802000800000), CONST64(0x0080800080800000), CONST64(0x0080802080800000), - CONST64(0x0080800000008000), CONST64(0x0080802000008000), CONST64(0x0080800080008000), CONST64(0x0080802080008000), - CONST64(0x0080800000808000), CONST64(0x0080802000808000), CONST64(0x0080800080808000), CONST64(0x0080802080808000), - CONST64(0x0080800000000080), CONST64(0x0080802000000080), CONST64(0x0080800080000080), CONST64(0x0080802080000080), - CONST64(0x0080800000800080), CONST64(0x0080802000800080), CONST64(0x0080800080800080), CONST64(0x0080802080800080), - CONST64(0x0080800000008080), CONST64(0x0080802000008080), CONST64(0x0080800080008080), CONST64(0x0080802080008080), - CONST64(0x0080800000808080), CONST64(0x0080802000808080), CONST64(0x0080800080808080), CONST64(0x0080802080808080), - CONST64(0x8080800000000000), CONST64(0x8080802000000000), CONST64(0x8080800080000000), CONST64(0x8080802080000000), - CONST64(0x8080800000800000), CONST64(0x8080802000800000), CONST64(0x8080800080800000), CONST64(0x8080802080800000), - CONST64(0x8080800000008000), CONST64(0x8080802000008000), CONST64(0x8080800080008000), CONST64(0x8080802080008000), - CONST64(0x8080800000808000), CONST64(0x8080802000808000), CONST64(0x8080800080808000), CONST64(0x8080802080808000), - CONST64(0x8080800000000080), CONST64(0x8080802000000080), CONST64(0x8080800080000080), CONST64(0x8080802080000080), - CONST64(0x8080800000800080), CONST64(0x8080802000800080), CONST64(0x8080800080800080), CONST64(0x8080802080800080), - CONST64(0x8080800000008080), CONST64(0x8080802000008080), CONST64(0x8080800080008080), CONST64(0x8080802080008080), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000002000000000), CONST64(0x0000000080000000), CONST64(0x0000002080000000), + CONST64(0x0000000000800000), CONST64(0x0000002000800000), CONST64(0x0000000080800000), CONST64(0x0000002080800000), + CONST64(0x0000000000008000), CONST64(0x0000002000008000), CONST64(0x0000000080008000), CONST64(0x0000002080008000), + CONST64(0x0000000000808000), CONST64(0x0000002000808000), CONST64(0x0000000080808000), CONST64(0x0000002080808000), + CONST64(0x0000000000000080), CONST64(0x0000002000000080), CONST64(0x0000000080000080), CONST64(0x0000002080000080), + CONST64(0x0000000000800080), CONST64(0x0000002000800080), CONST64(0x0000000080800080), CONST64(0x0000002080800080), + CONST64(0x0000000000008080), CONST64(0x0000002000008080), CONST64(0x0000000080008080), CONST64(0x0000002080008080), + CONST64(0x0000000000808080), CONST64(0x0000002000808080), CONST64(0x0000000080808080), CONST64(0x0000002080808080), + CONST64(0x8000000000000000), CONST64(0x8000002000000000), CONST64(0x8000000080000000), CONST64(0x8000002080000000), + CONST64(0x8000000000800000), CONST64(0x8000002000800000), CONST64(0x8000000080800000), CONST64(0x8000002080800000), + CONST64(0x8000000000008000), CONST64(0x8000002000008000), CONST64(0x8000000080008000), CONST64(0x8000002080008000), + CONST64(0x8000000000808000), CONST64(0x8000002000808000), CONST64(0x8000000080808000), CONST64(0x8000002080808000), + CONST64(0x8000000000000080), CONST64(0x8000002000000080), CONST64(0x8000000080000080), CONST64(0x8000002080000080), + CONST64(0x8000000000800080), CONST64(0x8000002000800080), CONST64(0x8000000080800080), CONST64(0x8000002080800080), + CONST64(0x8000000000008080), CONST64(0x8000002000008080), CONST64(0x8000000080008080), CONST64(0x8000002080008080), + CONST64(0x8000000000808080), CONST64(0x8000002000808080), CONST64(0x8000000080808080), CONST64(0x8000002080808080), + CONST64(0x0080000000000000), CONST64(0x0080002000000000), CONST64(0x0080000080000000), CONST64(0x0080002080000000), + CONST64(0x0080000000800000), CONST64(0x0080002000800000), CONST64(0x0080000080800000), CONST64(0x0080002080800000), + CONST64(0x0080000000008000), CONST64(0x0080002000008000), CONST64(0x0080000080008000), CONST64(0x0080002080008000), + CONST64(0x0080000000808000), CONST64(0x0080002000808000), CONST64(0x0080000080808000), CONST64(0x0080002080808000), + CONST64(0x0080000000000080), CONST64(0x0080002000000080), CONST64(0x0080000080000080), CONST64(0x0080002080000080), + CONST64(0x0080000000800080), CONST64(0x0080002000800080), CONST64(0x0080000080800080), CONST64(0x0080002080800080), + CONST64(0x0080000000008080), CONST64(0x0080002000008080), CONST64(0x0080000080008080), CONST64(0x0080002080008080), + CONST64(0x0080000000808080), CONST64(0x0080002000808080), CONST64(0x0080000080808080), CONST64(0x0080002080808080), + CONST64(0x8080000000000000), CONST64(0x8080002000000000), CONST64(0x8080000080000000), CONST64(0x8080002080000000), + CONST64(0x8080000000800000), CONST64(0x8080002000800000), CONST64(0x8080000080800000), CONST64(0x8080002080800000), + CONST64(0x8080000000008000), CONST64(0x8080002000008000), CONST64(0x8080000080008000), CONST64(0x8080002080008000), + CONST64(0x8080000000808000), CONST64(0x8080002000808000), CONST64(0x8080000080808000), CONST64(0x8080002080808000), + CONST64(0x8080000000000080), CONST64(0x8080002000000080), CONST64(0x8080000080000080), CONST64(0x8080002080000080), + CONST64(0x8080000000800080), CONST64(0x8080002000800080), CONST64(0x8080000080800080), CONST64(0x8080002080800080), + CONST64(0x8080000000008080), CONST64(0x8080002000008080), CONST64(0x8080000080008080), CONST64(0x8080002080008080), + CONST64(0x8080000000808080), CONST64(0x8080002000808080), CONST64(0x8080000080808080), CONST64(0x8080002080808080), + CONST64(0x0000800000000000), CONST64(0x0000802000000000), CONST64(0x0000800080000000), CONST64(0x0000802080000000), + CONST64(0x0000800000800000), CONST64(0x0000802000800000), CONST64(0x0000800080800000), CONST64(0x0000802080800000), + CONST64(0x0000800000008000), CONST64(0x0000802000008000), CONST64(0x0000800080008000), CONST64(0x0000802080008000), + CONST64(0x0000800000808000), CONST64(0x0000802000808000), CONST64(0x0000800080808000), CONST64(0x0000802080808000), + CONST64(0x0000800000000080), CONST64(0x0000802000000080), CONST64(0x0000800080000080), CONST64(0x0000802080000080), + CONST64(0x0000800000800080), CONST64(0x0000802000800080), CONST64(0x0000800080800080), CONST64(0x0000802080800080), + CONST64(0x0000800000008080), CONST64(0x0000802000008080), CONST64(0x0000800080008080), CONST64(0x0000802080008080), + CONST64(0x0000800000808080), CONST64(0x0000802000808080), CONST64(0x0000800080808080), CONST64(0x0000802080808080), + CONST64(0x8000800000000000), CONST64(0x8000802000000000), CONST64(0x8000800080000000), CONST64(0x8000802080000000), + CONST64(0x8000800000800000), CONST64(0x8000802000800000), CONST64(0x8000800080800000), CONST64(0x8000802080800000), + CONST64(0x8000800000008000), CONST64(0x8000802000008000), CONST64(0x8000800080008000), CONST64(0x8000802080008000), + CONST64(0x8000800000808000), CONST64(0x8000802000808000), CONST64(0x8000800080808000), CONST64(0x8000802080808000), + CONST64(0x8000800000000080), CONST64(0x8000802000000080), CONST64(0x8000800080000080), CONST64(0x8000802080000080), + CONST64(0x8000800000800080), CONST64(0x8000802000800080), CONST64(0x8000800080800080), CONST64(0x8000802080800080), + CONST64(0x8000800000008080), CONST64(0x8000802000008080), CONST64(0x8000800080008080), CONST64(0x8000802080008080), + CONST64(0x8000800000808080), CONST64(0x8000802000808080), CONST64(0x8000800080808080), CONST64(0x8000802080808080), + CONST64(0x0080800000000000), CONST64(0x0080802000000000), CONST64(0x0080800080000000), CONST64(0x0080802080000000), + CONST64(0x0080800000800000), CONST64(0x0080802000800000), CONST64(0x0080800080800000), CONST64(0x0080802080800000), + CONST64(0x0080800000008000), CONST64(0x0080802000008000), CONST64(0x0080800080008000), CONST64(0x0080802080008000), + CONST64(0x0080800000808000), CONST64(0x0080802000808000), CONST64(0x0080800080808000), CONST64(0x0080802080808000), + CONST64(0x0080800000000080), CONST64(0x0080802000000080), CONST64(0x0080800080000080), CONST64(0x0080802080000080), + CONST64(0x0080800000800080), CONST64(0x0080802000800080), CONST64(0x0080800080800080), CONST64(0x0080802080800080), + CONST64(0x0080800000008080), CONST64(0x0080802000008080), CONST64(0x0080800080008080), CONST64(0x0080802080008080), + CONST64(0x0080800000808080), CONST64(0x0080802000808080), CONST64(0x0080800080808080), CONST64(0x0080802080808080), + CONST64(0x8080800000000000), CONST64(0x8080802000000000), CONST64(0x8080800080000000), CONST64(0x8080802080000000), + CONST64(0x8080800000800000), CONST64(0x8080802000800000), CONST64(0x8080800080800000), CONST64(0x8080802080800000), + CONST64(0x8080800000008000), CONST64(0x8080802000008000), CONST64(0x8080800080008000), CONST64(0x8080802080008000), + CONST64(0x8080800000808000), CONST64(0x8080802000808000), CONST64(0x8080800080808000), CONST64(0x8080802080808000), + CONST64(0x8080800000000080), CONST64(0x8080802000000080), CONST64(0x8080800080000080), CONST64(0x8080802080000080), + CONST64(0x8080800000800080), CONST64(0x8080802000800080), CONST64(0x8080800080800080), CONST64(0x8080802080800080), + CONST64(0x8080800000008080), CONST64(0x8080802000008080), CONST64(0x8080800080008080), CONST64(0x8080802080008080), CONST64(0x8080800000808080), CONST64(0x8080802000808080), CONST64(0x8080800080808080), CONST64(0x8080802080808080) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000004000000000), CONST64(0x0000000001000000), CONST64(0x0000004001000000), - CONST64(0x0000000000010000), CONST64(0x0000004000010000), CONST64(0x0000000001010000), CONST64(0x0000004001010000), - CONST64(0x0000000000000100), CONST64(0x0000004000000100), CONST64(0x0000000001000100), CONST64(0x0000004001000100), - CONST64(0x0000000000010100), CONST64(0x0000004000010100), CONST64(0x0000000001010100), CONST64(0x0000004001010100), - CONST64(0x0000000000000001), CONST64(0x0000004000000001), CONST64(0x0000000001000001), CONST64(0x0000004001000001), - CONST64(0x0000000000010001), CONST64(0x0000004000010001), CONST64(0x0000000001010001), CONST64(0x0000004001010001), - CONST64(0x0000000000000101), CONST64(0x0000004000000101), CONST64(0x0000000001000101), CONST64(0x0000004001000101), - CONST64(0x0000000000010101), CONST64(0x0000004000010101), CONST64(0x0000000001010101), CONST64(0x0000004001010101), - CONST64(0x0100000000000000), CONST64(0x0100004000000000), CONST64(0x0100000001000000), CONST64(0x0100004001000000), - CONST64(0x0100000000010000), CONST64(0x0100004000010000), CONST64(0x0100000001010000), CONST64(0x0100004001010000), - CONST64(0x0100000000000100), CONST64(0x0100004000000100), CONST64(0x0100000001000100), CONST64(0x0100004001000100), - CONST64(0x0100000000010100), CONST64(0x0100004000010100), CONST64(0x0100000001010100), CONST64(0x0100004001010100), - CONST64(0x0100000000000001), CONST64(0x0100004000000001), CONST64(0x0100000001000001), CONST64(0x0100004001000001), - CONST64(0x0100000000010001), CONST64(0x0100004000010001), CONST64(0x0100000001010001), CONST64(0x0100004001010001), - CONST64(0x0100000000000101), CONST64(0x0100004000000101), CONST64(0x0100000001000101), CONST64(0x0100004001000101), - CONST64(0x0100000000010101), CONST64(0x0100004000010101), CONST64(0x0100000001010101), CONST64(0x0100004001010101), - CONST64(0x0001000000000000), CONST64(0x0001004000000000), CONST64(0x0001000001000000), CONST64(0x0001004001000000), - CONST64(0x0001000000010000), CONST64(0x0001004000010000), CONST64(0x0001000001010000), CONST64(0x0001004001010000), - CONST64(0x0001000000000100), CONST64(0x0001004000000100), CONST64(0x0001000001000100), CONST64(0x0001004001000100), - CONST64(0x0001000000010100), CONST64(0x0001004000010100), CONST64(0x0001000001010100), CONST64(0x0001004001010100), - CONST64(0x0001000000000001), CONST64(0x0001004000000001), CONST64(0x0001000001000001), CONST64(0x0001004001000001), - CONST64(0x0001000000010001), CONST64(0x0001004000010001), CONST64(0x0001000001010001), CONST64(0x0001004001010001), - CONST64(0x0001000000000101), CONST64(0x0001004000000101), CONST64(0x0001000001000101), CONST64(0x0001004001000101), - CONST64(0x0001000000010101), CONST64(0x0001004000010101), CONST64(0x0001000001010101), CONST64(0x0001004001010101), - CONST64(0x0101000000000000), CONST64(0x0101004000000000), CONST64(0x0101000001000000), CONST64(0x0101004001000000), - CONST64(0x0101000000010000), CONST64(0x0101004000010000), CONST64(0x0101000001010000), CONST64(0x0101004001010000), - CONST64(0x0101000000000100), CONST64(0x0101004000000100), CONST64(0x0101000001000100), CONST64(0x0101004001000100), - CONST64(0x0101000000010100), CONST64(0x0101004000010100), CONST64(0x0101000001010100), CONST64(0x0101004001010100), - CONST64(0x0101000000000001), CONST64(0x0101004000000001), CONST64(0x0101000001000001), CONST64(0x0101004001000001), - CONST64(0x0101000000010001), CONST64(0x0101004000010001), CONST64(0x0101000001010001), CONST64(0x0101004001010001), - CONST64(0x0101000000000101), CONST64(0x0101004000000101), CONST64(0x0101000001000101), CONST64(0x0101004001000101), - CONST64(0x0101000000010101), CONST64(0x0101004000010101), CONST64(0x0101000001010101), CONST64(0x0101004001010101), - CONST64(0x0000010000000000), CONST64(0x0000014000000000), CONST64(0x0000010001000000), CONST64(0x0000014001000000), - CONST64(0x0000010000010000), CONST64(0x0000014000010000), CONST64(0x0000010001010000), CONST64(0x0000014001010000), - CONST64(0x0000010000000100), CONST64(0x0000014000000100), CONST64(0x0000010001000100), CONST64(0x0000014001000100), - CONST64(0x0000010000010100), CONST64(0x0000014000010100), CONST64(0x0000010001010100), CONST64(0x0000014001010100), - CONST64(0x0000010000000001), CONST64(0x0000014000000001), CONST64(0x0000010001000001), CONST64(0x0000014001000001), - CONST64(0x0000010000010001), CONST64(0x0000014000010001), CONST64(0x0000010001010001), CONST64(0x0000014001010001), - CONST64(0x0000010000000101), CONST64(0x0000014000000101), CONST64(0x0000010001000101), CONST64(0x0000014001000101), - CONST64(0x0000010000010101), CONST64(0x0000014000010101), CONST64(0x0000010001010101), CONST64(0x0000014001010101), - CONST64(0x0100010000000000), CONST64(0x0100014000000000), CONST64(0x0100010001000000), CONST64(0x0100014001000000), - CONST64(0x0100010000010000), CONST64(0x0100014000010000), CONST64(0x0100010001010000), CONST64(0x0100014001010000), - CONST64(0x0100010000000100), CONST64(0x0100014000000100), CONST64(0x0100010001000100), CONST64(0x0100014001000100), - CONST64(0x0100010000010100), CONST64(0x0100014000010100), CONST64(0x0100010001010100), CONST64(0x0100014001010100), - CONST64(0x0100010000000001), CONST64(0x0100014000000001), CONST64(0x0100010001000001), CONST64(0x0100014001000001), - CONST64(0x0100010000010001), CONST64(0x0100014000010001), CONST64(0x0100010001010001), CONST64(0x0100014001010001), - CONST64(0x0100010000000101), CONST64(0x0100014000000101), CONST64(0x0100010001000101), CONST64(0x0100014001000101), - CONST64(0x0100010000010101), CONST64(0x0100014000010101), CONST64(0x0100010001010101), CONST64(0x0100014001010101), - CONST64(0x0001010000000000), CONST64(0x0001014000000000), CONST64(0x0001010001000000), CONST64(0x0001014001000000), - CONST64(0x0001010000010000), CONST64(0x0001014000010000), CONST64(0x0001010001010000), CONST64(0x0001014001010000), - CONST64(0x0001010000000100), CONST64(0x0001014000000100), CONST64(0x0001010001000100), CONST64(0x0001014001000100), - CONST64(0x0001010000010100), CONST64(0x0001014000010100), CONST64(0x0001010001010100), CONST64(0x0001014001010100), - CONST64(0x0001010000000001), CONST64(0x0001014000000001), CONST64(0x0001010001000001), CONST64(0x0001014001000001), - CONST64(0x0001010000010001), CONST64(0x0001014000010001), CONST64(0x0001010001010001), CONST64(0x0001014001010001), - CONST64(0x0001010000000101), CONST64(0x0001014000000101), CONST64(0x0001010001000101), CONST64(0x0001014001000101), - CONST64(0x0001010000010101), CONST64(0x0001014000010101), CONST64(0x0001010001010101), CONST64(0x0001014001010101), - CONST64(0x0101010000000000), CONST64(0x0101014000000000), CONST64(0x0101010001000000), CONST64(0x0101014001000000), - CONST64(0x0101010000010000), CONST64(0x0101014000010000), CONST64(0x0101010001010000), CONST64(0x0101014001010000), - CONST64(0x0101010000000100), CONST64(0x0101014000000100), CONST64(0x0101010001000100), CONST64(0x0101014001000100), - CONST64(0x0101010000010100), CONST64(0x0101014000010100), CONST64(0x0101010001010100), CONST64(0x0101014001010100), - CONST64(0x0101010000000001), CONST64(0x0101014000000001), CONST64(0x0101010001000001), CONST64(0x0101014001000001), - CONST64(0x0101010000010001), CONST64(0x0101014000010001), CONST64(0x0101010001010001), CONST64(0x0101014001010001), - CONST64(0x0101010000000101), CONST64(0x0101014000000101), CONST64(0x0101010001000101), CONST64(0x0101014001000101), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000004000000000), CONST64(0x0000000001000000), CONST64(0x0000004001000000), + CONST64(0x0000000000010000), CONST64(0x0000004000010000), CONST64(0x0000000001010000), CONST64(0x0000004001010000), + CONST64(0x0000000000000100), CONST64(0x0000004000000100), CONST64(0x0000000001000100), CONST64(0x0000004001000100), + CONST64(0x0000000000010100), CONST64(0x0000004000010100), CONST64(0x0000000001010100), CONST64(0x0000004001010100), + CONST64(0x0000000000000001), CONST64(0x0000004000000001), CONST64(0x0000000001000001), CONST64(0x0000004001000001), + CONST64(0x0000000000010001), CONST64(0x0000004000010001), CONST64(0x0000000001010001), CONST64(0x0000004001010001), + CONST64(0x0000000000000101), CONST64(0x0000004000000101), CONST64(0x0000000001000101), CONST64(0x0000004001000101), + CONST64(0x0000000000010101), CONST64(0x0000004000010101), CONST64(0x0000000001010101), CONST64(0x0000004001010101), + CONST64(0x0100000000000000), CONST64(0x0100004000000000), CONST64(0x0100000001000000), CONST64(0x0100004001000000), + CONST64(0x0100000000010000), CONST64(0x0100004000010000), CONST64(0x0100000001010000), CONST64(0x0100004001010000), + CONST64(0x0100000000000100), CONST64(0x0100004000000100), CONST64(0x0100000001000100), CONST64(0x0100004001000100), + CONST64(0x0100000000010100), CONST64(0x0100004000010100), CONST64(0x0100000001010100), CONST64(0x0100004001010100), + CONST64(0x0100000000000001), CONST64(0x0100004000000001), CONST64(0x0100000001000001), CONST64(0x0100004001000001), + CONST64(0x0100000000010001), CONST64(0x0100004000010001), CONST64(0x0100000001010001), CONST64(0x0100004001010001), + CONST64(0x0100000000000101), CONST64(0x0100004000000101), CONST64(0x0100000001000101), CONST64(0x0100004001000101), + CONST64(0x0100000000010101), CONST64(0x0100004000010101), CONST64(0x0100000001010101), CONST64(0x0100004001010101), + CONST64(0x0001000000000000), CONST64(0x0001004000000000), CONST64(0x0001000001000000), CONST64(0x0001004001000000), + CONST64(0x0001000000010000), CONST64(0x0001004000010000), CONST64(0x0001000001010000), CONST64(0x0001004001010000), + CONST64(0x0001000000000100), CONST64(0x0001004000000100), CONST64(0x0001000001000100), CONST64(0x0001004001000100), + CONST64(0x0001000000010100), CONST64(0x0001004000010100), CONST64(0x0001000001010100), CONST64(0x0001004001010100), + CONST64(0x0001000000000001), CONST64(0x0001004000000001), CONST64(0x0001000001000001), CONST64(0x0001004001000001), + CONST64(0x0001000000010001), CONST64(0x0001004000010001), CONST64(0x0001000001010001), CONST64(0x0001004001010001), + CONST64(0x0001000000000101), CONST64(0x0001004000000101), CONST64(0x0001000001000101), CONST64(0x0001004001000101), + CONST64(0x0001000000010101), CONST64(0x0001004000010101), CONST64(0x0001000001010101), CONST64(0x0001004001010101), + CONST64(0x0101000000000000), CONST64(0x0101004000000000), CONST64(0x0101000001000000), CONST64(0x0101004001000000), + CONST64(0x0101000000010000), CONST64(0x0101004000010000), CONST64(0x0101000001010000), CONST64(0x0101004001010000), + CONST64(0x0101000000000100), CONST64(0x0101004000000100), CONST64(0x0101000001000100), CONST64(0x0101004001000100), + CONST64(0x0101000000010100), CONST64(0x0101004000010100), CONST64(0x0101000001010100), CONST64(0x0101004001010100), + CONST64(0x0101000000000001), CONST64(0x0101004000000001), CONST64(0x0101000001000001), CONST64(0x0101004001000001), + CONST64(0x0101000000010001), CONST64(0x0101004000010001), CONST64(0x0101000001010001), CONST64(0x0101004001010001), + CONST64(0x0101000000000101), CONST64(0x0101004000000101), CONST64(0x0101000001000101), CONST64(0x0101004001000101), + CONST64(0x0101000000010101), CONST64(0x0101004000010101), CONST64(0x0101000001010101), CONST64(0x0101004001010101), + CONST64(0x0000010000000000), CONST64(0x0000014000000000), CONST64(0x0000010001000000), CONST64(0x0000014001000000), + CONST64(0x0000010000010000), CONST64(0x0000014000010000), CONST64(0x0000010001010000), CONST64(0x0000014001010000), + CONST64(0x0000010000000100), CONST64(0x0000014000000100), CONST64(0x0000010001000100), CONST64(0x0000014001000100), + CONST64(0x0000010000010100), CONST64(0x0000014000010100), CONST64(0x0000010001010100), CONST64(0x0000014001010100), + CONST64(0x0000010000000001), CONST64(0x0000014000000001), CONST64(0x0000010001000001), CONST64(0x0000014001000001), + CONST64(0x0000010000010001), CONST64(0x0000014000010001), CONST64(0x0000010001010001), CONST64(0x0000014001010001), + CONST64(0x0000010000000101), CONST64(0x0000014000000101), CONST64(0x0000010001000101), CONST64(0x0000014001000101), + CONST64(0x0000010000010101), CONST64(0x0000014000010101), CONST64(0x0000010001010101), CONST64(0x0000014001010101), + CONST64(0x0100010000000000), CONST64(0x0100014000000000), CONST64(0x0100010001000000), CONST64(0x0100014001000000), + CONST64(0x0100010000010000), CONST64(0x0100014000010000), CONST64(0x0100010001010000), CONST64(0x0100014001010000), + CONST64(0x0100010000000100), CONST64(0x0100014000000100), CONST64(0x0100010001000100), CONST64(0x0100014001000100), + CONST64(0x0100010000010100), CONST64(0x0100014000010100), CONST64(0x0100010001010100), CONST64(0x0100014001010100), + CONST64(0x0100010000000001), CONST64(0x0100014000000001), CONST64(0x0100010001000001), CONST64(0x0100014001000001), + CONST64(0x0100010000010001), CONST64(0x0100014000010001), CONST64(0x0100010001010001), CONST64(0x0100014001010001), + CONST64(0x0100010000000101), CONST64(0x0100014000000101), CONST64(0x0100010001000101), CONST64(0x0100014001000101), + CONST64(0x0100010000010101), CONST64(0x0100014000010101), CONST64(0x0100010001010101), CONST64(0x0100014001010101), + CONST64(0x0001010000000000), CONST64(0x0001014000000000), CONST64(0x0001010001000000), CONST64(0x0001014001000000), + CONST64(0x0001010000010000), CONST64(0x0001014000010000), CONST64(0x0001010001010000), CONST64(0x0001014001010000), + CONST64(0x0001010000000100), CONST64(0x0001014000000100), CONST64(0x0001010001000100), CONST64(0x0001014001000100), + CONST64(0x0001010000010100), CONST64(0x0001014000010100), CONST64(0x0001010001010100), CONST64(0x0001014001010100), + CONST64(0x0001010000000001), CONST64(0x0001014000000001), CONST64(0x0001010001000001), CONST64(0x0001014001000001), + CONST64(0x0001010000010001), CONST64(0x0001014000010001), CONST64(0x0001010001010001), CONST64(0x0001014001010001), + CONST64(0x0001010000000101), CONST64(0x0001014000000101), CONST64(0x0001010001000101), CONST64(0x0001014001000101), + CONST64(0x0001010000010101), CONST64(0x0001014000010101), CONST64(0x0001010001010101), CONST64(0x0001014001010101), + CONST64(0x0101010000000000), CONST64(0x0101014000000000), CONST64(0x0101010001000000), CONST64(0x0101014001000000), + CONST64(0x0101010000010000), CONST64(0x0101014000010000), CONST64(0x0101010001010000), CONST64(0x0101014001010000), + CONST64(0x0101010000000100), CONST64(0x0101014000000100), CONST64(0x0101010001000100), CONST64(0x0101014001000100), + CONST64(0x0101010000010100), CONST64(0x0101014000010100), CONST64(0x0101010001010100), CONST64(0x0101014001010100), + CONST64(0x0101010000000001), CONST64(0x0101014000000001), CONST64(0x0101010001000001), CONST64(0x0101014001000001), + CONST64(0x0101010000010001), CONST64(0x0101014000010001), CONST64(0x0101010001010001), CONST64(0x0101014001010001), + CONST64(0x0101010000000101), CONST64(0x0101014000000101), CONST64(0x0101010001000101), CONST64(0x0101014001000101), CONST64(0x0101010000010101), CONST64(0x0101014000010101), CONST64(0x0101010001010101), CONST64(0x0101014001010101) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000100000000), CONST64(0x0000000004000000), CONST64(0x0000000104000000), - CONST64(0x0000000000040000), CONST64(0x0000000100040000), CONST64(0x0000000004040000), CONST64(0x0000000104040000), - CONST64(0x0000000000000400), CONST64(0x0000000100000400), CONST64(0x0000000004000400), CONST64(0x0000000104000400), - CONST64(0x0000000000040400), CONST64(0x0000000100040400), CONST64(0x0000000004040400), CONST64(0x0000000104040400), - CONST64(0x0000000000000004), CONST64(0x0000000100000004), CONST64(0x0000000004000004), CONST64(0x0000000104000004), - CONST64(0x0000000000040004), CONST64(0x0000000100040004), CONST64(0x0000000004040004), CONST64(0x0000000104040004), - CONST64(0x0000000000000404), CONST64(0x0000000100000404), CONST64(0x0000000004000404), CONST64(0x0000000104000404), - CONST64(0x0000000000040404), CONST64(0x0000000100040404), CONST64(0x0000000004040404), CONST64(0x0000000104040404), - CONST64(0x0400000000000000), CONST64(0x0400000100000000), CONST64(0x0400000004000000), CONST64(0x0400000104000000), - CONST64(0x0400000000040000), CONST64(0x0400000100040000), CONST64(0x0400000004040000), CONST64(0x0400000104040000), - CONST64(0x0400000000000400), CONST64(0x0400000100000400), CONST64(0x0400000004000400), CONST64(0x0400000104000400), - CONST64(0x0400000000040400), CONST64(0x0400000100040400), CONST64(0x0400000004040400), CONST64(0x0400000104040400), - CONST64(0x0400000000000004), CONST64(0x0400000100000004), CONST64(0x0400000004000004), CONST64(0x0400000104000004), - CONST64(0x0400000000040004), CONST64(0x0400000100040004), CONST64(0x0400000004040004), CONST64(0x0400000104040004), - CONST64(0x0400000000000404), CONST64(0x0400000100000404), CONST64(0x0400000004000404), CONST64(0x0400000104000404), - CONST64(0x0400000000040404), CONST64(0x0400000100040404), CONST64(0x0400000004040404), CONST64(0x0400000104040404), - CONST64(0x0004000000000000), CONST64(0x0004000100000000), CONST64(0x0004000004000000), CONST64(0x0004000104000000), - CONST64(0x0004000000040000), CONST64(0x0004000100040000), CONST64(0x0004000004040000), CONST64(0x0004000104040000), - CONST64(0x0004000000000400), CONST64(0x0004000100000400), CONST64(0x0004000004000400), CONST64(0x0004000104000400), - CONST64(0x0004000000040400), CONST64(0x0004000100040400), CONST64(0x0004000004040400), CONST64(0x0004000104040400), - CONST64(0x0004000000000004), CONST64(0x0004000100000004), CONST64(0x0004000004000004), CONST64(0x0004000104000004), - CONST64(0x0004000000040004), CONST64(0x0004000100040004), CONST64(0x0004000004040004), CONST64(0x0004000104040004), - CONST64(0x0004000000000404), CONST64(0x0004000100000404), CONST64(0x0004000004000404), CONST64(0x0004000104000404), - CONST64(0x0004000000040404), CONST64(0x0004000100040404), CONST64(0x0004000004040404), CONST64(0x0004000104040404), - CONST64(0x0404000000000000), CONST64(0x0404000100000000), CONST64(0x0404000004000000), CONST64(0x0404000104000000), - CONST64(0x0404000000040000), CONST64(0x0404000100040000), CONST64(0x0404000004040000), CONST64(0x0404000104040000), - CONST64(0x0404000000000400), CONST64(0x0404000100000400), CONST64(0x0404000004000400), CONST64(0x0404000104000400), - CONST64(0x0404000000040400), CONST64(0x0404000100040400), CONST64(0x0404000004040400), CONST64(0x0404000104040400), - CONST64(0x0404000000000004), CONST64(0x0404000100000004), CONST64(0x0404000004000004), CONST64(0x0404000104000004), - CONST64(0x0404000000040004), CONST64(0x0404000100040004), CONST64(0x0404000004040004), CONST64(0x0404000104040004), - CONST64(0x0404000000000404), CONST64(0x0404000100000404), CONST64(0x0404000004000404), CONST64(0x0404000104000404), - CONST64(0x0404000000040404), CONST64(0x0404000100040404), CONST64(0x0404000004040404), CONST64(0x0404000104040404), - CONST64(0x0000040000000000), CONST64(0x0000040100000000), CONST64(0x0000040004000000), CONST64(0x0000040104000000), - CONST64(0x0000040000040000), CONST64(0x0000040100040000), CONST64(0x0000040004040000), CONST64(0x0000040104040000), - CONST64(0x0000040000000400), CONST64(0x0000040100000400), CONST64(0x0000040004000400), CONST64(0x0000040104000400), - CONST64(0x0000040000040400), CONST64(0x0000040100040400), CONST64(0x0000040004040400), CONST64(0x0000040104040400), - CONST64(0x0000040000000004), CONST64(0x0000040100000004), CONST64(0x0000040004000004), CONST64(0x0000040104000004), - CONST64(0x0000040000040004), CONST64(0x0000040100040004), CONST64(0x0000040004040004), CONST64(0x0000040104040004), - CONST64(0x0000040000000404), CONST64(0x0000040100000404), CONST64(0x0000040004000404), CONST64(0x0000040104000404), - CONST64(0x0000040000040404), CONST64(0x0000040100040404), CONST64(0x0000040004040404), CONST64(0x0000040104040404), - CONST64(0x0400040000000000), CONST64(0x0400040100000000), CONST64(0x0400040004000000), CONST64(0x0400040104000000), - CONST64(0x0400040000040000), CONST64(0x0400040100040000), CONST64(0x0400040004040000), CONST64(0x0400040104040000), - CONST64(0x0400040000000400), CONST64(0x0400040100000400), CONST64(0x0400040004000400), CONST64(0x0400040104000400), - CONST64(0x0400040000040400), CONST64(0x0400040100040400), CONST64(0x0400040004040400), CONST64(0x0400040104040400), - CONST64(0x0400040000000004), CONST64(0x0400040100000004), CONST64(0x0400040004000004), CONST64(0x0400040104000004), - CONST64(0x0400040000040004), CONST64(0x0400040100040004), CONST64(0x0400040004040004), CONST64(0x0400040104040004), - CONST64(0x0400040000000404), CONST64(0x0400040100000404), CONST64(0x0400040004000404), CONST64(0x0400040104000404), - CONST64(0x0400040000040404), CONST64(0x0400040100040404), CONST64(0x0400040004040404), CONST64(0x0400040104040404), - CONST64(0x0004040000000000), CONST64(0x0004040100000000), CONST64(0x0004040004000000), CONST64(0x0004040104000000), - CONST64(0x0004040000040000), CONST64(0x0004040100040000), CONST64(0x0004040004040000), CONST64(0x0004040104040000), - CONST64(0x0004040000000400), CONST64(0x0004040100000400), CONST64(0x0004040004000400), CONST64(0x0004040104000400), - CONST64(0x0004040000040400), CONST64(0x0004040100040400), CONST64(0x0004040004040400), CONST64(0x0004040104040400), - CONST64(0x0004040000000004), CONST64(0x0004040100000004), CONST64(0x0004040004000004), CONST64(0x0004040104000004), - CONST64(0x0004040000040004), CONST64(0x0004040100040004), CONST64(0x0004040004040004), CONST64(0x0004040104040004), - CONST64(0x0004040000000404), CONST64(0x0004040100000404), CONST64(0x0004040004000404), CONST64(0x0004040104000404), - CONST64(0x0004040000040404), CONST64(0x0004040100040404), CONST64(0x0004040004040404), CONST64(0x0004040104040404), - CONST64(0x0404040000000000), CONST64(0x0404040100000000), CONST64(0x0404040004000000), CONST64(0x0404040104000000), - CONST64(0x0404040000040000), CONST64(0x0404040100040000), CONST64(0x0404040004040000), CONST64(0x0404040104040000), - CONST64(0x0404040000000400), CONST64(0x0404040100000400), CONST64(0x0404040004000400), CONST64(0x0404040104000400), - CONST64(0x0404040000040400), CONST64(0x0404040100040400), CONST64(0x0404040004040400), CONST64(0x0404040104040400), - CONST64(0x0404040000000004), CONST64(0x0404040100000004), CONST64(0x0404040004000004), CONST64(0x0404040104000004), - CONST64(0x0404040000040004), CONST64(0x0404040100040004), CONST64(0x0404040004040004), CONST64(0x0404040104040004), - CONST64(0x0404040000000404), CONST64(0x0404040100000404), CONST64(0x0404040004000404), CONST64(0x0404040104000404), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000100000000), CONST64(0x0000000004000000), CONST64(0x0000000104000000), + CONST64(0x0000000000040000), CONST64(0x0000000100040000), CONST64(0x0000000004040000), CONST64(0x0000000104040000), + CONST64(0x0000000000000400), CONST64(0x0000000100000400), CONST64(0x0000000004000400), CONST64(0x0000000104000400), + CONST64(0x0000000000040400), CONST64(0x0000000100040400), CONST64(0x0000000004040400), CONST64(0x0000000104040400), + CONST64(0x0000000000000004), CONST64(0x0000000100000004), CONST64(0x0000000004000004), CONST64(0x0000000104000004), + CONST64(0x0000000000040004), CONST64(0x0000000100040004), CONST64(0x0000000004040004), CONST64(0x0000000104040004), + CONST64(0x0000000000000404), CONST64(0x0000000100000404), CONST64(0x0000000004000404), CONST64(0x0000000104000404), + CONST64(0x0000000000040404), CONST64(0x0000000100040404), CONST64(0x0000000004040404), CONST64(0x0000000104040404), + CONST64(0x0400000000000000), CONST64(0x0400000100000000), CONST64(0x0400000004000000), CONST64(0x0400000104000000), + CONST64(0x0400000000040000), CONST64(0x0400000100040000), CONST64(0x0400000004040000), CONST64(0x0400000104040000), + CONST64(0x0400000000000400), CONST64(0x0400000100000400), CONST64(0x0400000004000400), CONST64(0x0400000104000400), + CONST64(0x0400000000040400), CONST64(0x0400000100040400), CONST64(0x0400000004040400), CONST64(0x0400000104040400), + CONST64(0x0400000000000004), CONST64(0x0400000100000004), CONST64(0x0400000004000004), CONST64(0x0400000104000004), + CONST64(0x0400000000040004), CONST64(0x0400000100040004), CONST64(0x0400000004040004), CONST64(0x0400000104040004), + CONST64(0x0400000000000404), CONST64(0x0400000100000404), CONST64(0x0400000004000404), CONST64(0x0400000104000404), + CONST64(0x0400000000040404), CONST64(0x0400000100040404), CONST64(0x0400000004040404), CONST64(0x0400000104040404), + CONST64(0x0004000000000000), CONST64(0x0004000100000000), CONST64(0x0004000004000000), CONST64(0x0004000104000000), + CONST64(0x0004000000040000), CONST64(0x0004000100040000), CONST64(0x0004000004040000), CONST64(0x0004000104040000), + CONST64(0x0004000000000400), CONST64(0x0004000100000400), CONST64(0x0004000004000400), CONST64(0x0004000104000400), + CONST64(0x0004000000040400), CONST64(0x0004000100040400), CONST64(0x0004000004040400), CONST64(0x0004000104040400), + CONST64(0x0004000000000004), CONST64(0x0004000100000004), CONST64(0x0004000004000004), CONST64(0x0004000104000004), + CONST64(0x0004000000040004), CONST64(0x0004000100040004), CONST64(0x0004000004040004), CONST64(0x0004000104040004), + CONST64(0x0004000000000404), CONST64(0x0004000100000404), CONST64(0x0004000004000404), CONST64(0x0004000104000404), + CONST64(0x0004000000040404), CONST64(0x0004000100040404), CONST64(0x0004000004040404), CONST64(0x0004000104040404), + CONST64(0x0404000000000000), CONST64(0x0404000100000000), CONST64(0x0404000004000000), CONST64(0x0404000104000000), + CONST64(0x0404000000040000), CONST64(0x0404000100040000), CONST64(0x0404000004040000), CONST64(0x0404000104040000), + CONST64(0x0404000000000400), CONST64(0x0404000100000400), CONST64(0x0404000004000400), CONST64(0x0404000104000400), + CONST64(0x0404000000040400), CONST64(0x0404000100040400), CONST64(0x0404000004040400), CONST64(0x0404000104040400), + CONST64(0x0404000000000004), CONST64(0x0404000100000004), CONST64(0x0404000004000004), CONST64(0x0404000104000004), + CONST64(0x0404000000040004), CONST64(0x0404000100040004), CONST64(0x0404000004040004), CONST64(0x0404000104040004), + CONST64(0x0404000000000404), CONST64(0x0404000100000404), CONST64(0x0404000004000404), CONST64(0x0404000104000404), + CONST64(0x0404000000040404), CONST64(0x0404000100040404), CONST64(0x0404000004040404), CONST64(0x0404000104040404), + CONST64(0x0000040000000000), CONST64(0x0000040100000000), CONST64(0x0000040004000000), CONST64(0x0000040104000000), + CONST64(0x0000040000040000), CONST64(0x0000040100040000), CONST64(0x0000040004040000), CONST64(0x0000040104040000), + CONST64(0x0000040000000400), CONST64(0x0000040100000400), CONST64(0x0000040004000400), CONST64(0x0000040104000400), + CONST64(0x0000040000040400), CONST64(0x0000040100040400), CONST64(0x0000040004040400), CONST64(0x0000040104040400), + CONST64(0x0000040000000004), CONST64(0x0000040100000004), CONST64(0x0000040004000004), CONST64(0x0000040104000004), + CONST64(0x0000040000040004), CONST64(0x0000040100040004), CONST64(0x0000040004040004), CONST64(0x0000040104040004), + CONST64(0x0000040000000404), CONST64(0x0000040100000404), CONST64(0x0000040004000404), CONST64(0x0000040104000404), + CONST64(0x0000040000040404), CONST64(0x0000040100040404), CONST64(0x0000040004040404), CONST64(0x0000040104040404), + CONST64(0x0400040000000000), CONST64(0x0400040100000000), CONST64(0x0400040004000000), CONST64(0x0400040104000000), + CONST64(0x0400040000040000), CONST64(0x0400040100040000), CONST64(0x0400040004040000), CONST64(0x0400040104040000), + CONST64(0x0400040000000400), CONST64(0x0400040100000400), CONST64(0x0400040004000400), CONST64(0x0400040104000400), + CONST64(0x0400040000040400), CONST64(0x0400040100040400), CONST64(0x0400040004040400), CONST64(0x0400040104040400), + CONST64(0x0400040000000004), CONST64(0x0400040100000004), CONST64(0x0400040004000004), CONST64(0x0400040104000004), + CONST64(0x0400040000040004), CONST64(0x0400040100040004), CONST64(0x0400040004040004), CONST64(0x0400040104040004), + CONST64(0x0400040000000404), CONST64(0x0400040100000404), CONST64(0x0400040004000404), CONST64(0x0400040104000404), + CONST64(0x0400040000040404), CONST64(0x0400040100040404), CONST64(0x0400040004040404), CONST64(0x0400040104040404), + CONST64(0x0004040000000000), CONST64(0x0004040100000000), CONST64(0x0004040004000000), CONST64(0x0004040104000000), + CONST64(0x0004040000040000), CONST64(0x0004040100040000), CONST64(0x0004040004040000), CONST64(0x0004040104040000), + CONST64(0x0004040000000400), CONST64(0x0004040100000400), CONST64(0x0004040004000400), CONST64(0x0004040104000400), + CONST64(0x0004040000040400), CONST64(0x0004040100040400), CONST64(0x0004040004040400), CONST64(0x0004040104040400), + CONST64(0x0004040000000004), CONST64(0x0004040100000004), CONST64(0x0004040004000004), CONST64(0x0004040104000004), + CONST64(0x0004040000040004), CONST64(0x0004040100040004), CONST64(0x0004040004040004), CONST64(0x0004040104040004), + CONST64(0x0004040000000404), CONST64(0x0004040100000404), CONST64(0x0004040004000404), CONST64(0x0004040104000404), + CONST64(0x0004040000040404), CONST64(0x0004040100040404), CONST64(0x0004040004040404), CONST64(0x0004040104040404), + CONST64(0x0404040000000000), CONST64(0x0404040100000000), CONST64(0x0404040004000000), CONST64(0x0404040104000000), + CONST64(0x0404040000040000), CONST64(0x0404040100040000), CONST64(0x0404040004040000), CONST64(0x0404040104040000), + CONST64(0x0404040000000400), CONST64(0x0404040100000400), CONST64(0x0404040004000400), CONST64(0x0404040104000400), + CONST64(0x0404040000040400), CONST64(0x0404040100040400), CONST64(0x0404040004040400), CONST64(0x0404040104040400), + CONST64(0x0404040000000004), CONST64(0x0404040100000004), CONST64(0x0404040004000004), CONST64(0x0404040104000004), + CONST64(0x0404040000040004), CONST64(0x0404040100040004), CONST64(0x0404040004040004), CONST64(0x0404040104040004), + CONST64(0x0404040000000404), CONST64(0x0404040100000404), CONST64(0x0404040004000404), CONST64(0x0404040104000404), CONST64(0x0404040000040404), CONST64(0x0404040100040404), CONST64(0x0404040004040404), CONST64(0x0404040104040404) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000000400000000), CONST64(0x0000000010000000), CONST64(0x0000000410000000), - CONST64(0x0000000000100000), CONST64(0x0000000400100000), CONST64(0x0000000010100000), CONST64(0x0000000410100000), - CONST64(0x0000000000001000), CONST64(0x0000000400001000), CONST64(0x0000000010001000), CONST64(0x0000000410001000), - CONST64(0x0000000000101000), CONST64(0x0000000400101000), CONST64(0x0000000010101000), CONST64(0x0000000410101000), - CONST64(0x0000000000000010), CONST64(0x0000000400000010), CONST64(0x0000000010000010), CONST64(0x0000000410000010), - CONST64(0x0000000000100010), CONST64(0x0000000400100010), CONST64(0x0000000010100010), CONST64(0x0000000410100010), - CONST64(0x0000000000001010), CONST64(0x0000000400001010), CONST64(0x0000000010001010), CONST64(0x0000000410001010), - CONST64(0x0000000000101010), CONST64(0x0000000400101010), CONST64(0x0000000010101010), CONST64(0x0000000410101010), - CONST64(0x1000000000000000), CONST64(0x1000000400000000), CONST64(0x1000000010000000), CONST64(0x1000000410000000), - CONST64(0x1000000000100000), CONST64(0x1000000400100000), CONST64(0x1000000010100000), CONST64(0x1000000410100000), - CONST64(0x1000000000001000), CONST64(0x1000000400001000), CONST64(0x1000000010001000), CONST64(0x1000000410001000), - CONST64(0x1000000000101000), CONST64(0x1000000400101000), CONST64(0x1000000010101000), CONST64(0x1000000410101000), - CONST64(0x1000000000000010), CONST64(0x1000000400000010), CONST64(0x1000000010000010), CONST64(0x1000000410000010), - CONST64(0x1000000000100010), CONST64(0x1000000400100010), CONST64(0x1000000010100010), CONST64(0x1000000410100010), - CONST64(0x1000000000001010), CONST64(0x1000000400001010), CONST64(0x1000000010001010), CONST64(0x1000000410001010), - CONST64(0x1000000000101010), CONST64(0x1000000400101010), CONST64(0x1000000010101010), CONST64(0x1000000410101010), - CONST64(0x0010000000000000), CONST64(0x0010000400000000), CONST64(0x0010000010000000), CONST64(0x0010000410000000), - CONST64(0x0010000000100000), CONST64(0x0010000400100000), CONST64(0x0010000010100000), CONST64(0x0010000410100000), - CONST64(0x0010000000001000), CONST64(0x0010000400001000), CONST64(0x0010000010001000), CONST64(0x0010000410001000), - CONST64(0x0010000000101000), CONST64(0x0010000400101000), CONST64(0x0010000010101000), CONST64(0x0010000410101000), - CONST64(0x0010000000000010), CONST64(0x0010000400000010), CONST64(0x0010000010000010), CONST64(0x0010000410000010), - CONST64(0x0010000000100010), CONST64(0x0010000400100010), CONST64(0x0010000010100010), CONST64(0x0010000410100010), - CONST64(0x0010000000001010), CONST64(0x0010000400001010), CONST64(0x0010000010001010), CONST64(0x0010000410001010), - CONST64(0x0010000000101010), CONST64(0x0010000400101010), CONST64(0x0010000010101010), CONST64(0x0010000410101010), - CONST64(0x1010000000000000), CONST64(0x1010000400000000), CONST64(0x1010000010000000), CONST64(0x1010000410000000), - CONST64(0x1010000000100000), CONST64(0x1010000400100000), CONST64(0x1010000010100000), CONST64(0x1010000410100000), - CONST64(0x1010000000001000), CONST64(0x1010000400001000), CONST64(0x1010000010001000), CONST64(0x1010000410001000), - CONST64(0x1010000000101000), CONST64(0x1010000400101000), CONST64(0x1010000010101000), CONST64(0x1010000410101000), - CONST64(0x1010000000000010), CONST64(0x1010000400000010), CONST64(0x1010000010000010), CONST64(0x1010000410000010), - CONST64(0x1010000000100010), CONST64(0x1010000400100010), CONST64(0x1010000010100010), CONST64(0x1010000410100010), - CONST64(0x1010000000001010), CONST64(0x1010000400001010), CONST64(0x1010000010001010), CONST64(0x1010000410001010), - CONST64(0x1010000000101010), CONST64(0x1010000400101010), CONST64(0x1010000010101010), CONST64(0x1010000410101010), - CONST64(0x0000100000000000), CONST64(0x0000100400000000), CONST64(0x0000100010000000), CONST64(0x0000100410000000), - CONST64(0x0000100000100000), CONST64(0x0000100400100000), CONST64(0x0000100010100000), CONST64(0x0000100410100000), - CONST64(0x0000100000001000), CONST64(0x0000100400001000), CONST64(0x0000100010001000), CONST64(0x0000100410001000), - CONST64(0x0000100000101000), CONST64(0x0000100400101000), CONST64(0x0000100010101000), CONST64(0x0000100410101000), - CONST64(0x0000100000000010), CONST64(0x0000100400000010), CONST64(0x0000100010000010), CONST64(0x0000100410000010), - CONST64(0x0000100000100010), CONST64(0x0000100400100010), CONST64(0x0000100010100010), CONST64(0x0000100410100010), - CONST64(0x0000100000001010), CONST64(0x0000100400001010), CONST64(0x0000100010001010), CONST64(0x0000100410001010), - CONST64(0x0000100000101010), CONST64(0x0000100400101010), CONST64(0x0000100010101010), CONST64(0x0000100410101010), - CONST64(0x1000100000000000), CONST64(0x1000100400000000), CONST64(0x1000100010000000), CONST64(0x1000100410000000), - CONST64(0x1000100000100000), CONST64(0x1000100400100000), CONST64(0x1000100010100000), CONST64(0x1000100410100000), - CONST64(0x1000100000001000), CONST64(0x1000100400001000), CONST64(0x1000100010001000), CONST64(0x1000100410001000), - CONST64(0x1000100000101000), CONST64(0x1000100400101000), CONST64(0x1000100010101000), CONST64(0x1000100410101000), - CONST64(0x1000100000000010), CONST64(0x1000100400000010), CONST64(0x1000100010000010), CONST64(0x1000100410000010), - CONST64(0x1000100000100010), CONST64(0x1000100400100010), CONST64(0x1000100010100010), CONST64(0x1000100410100010), - CONST64(0x1000100000001010), CONST64(0x1000100400001010), CONST64(0x1000100010001010), CONST64(0x1000100410001010), - CONST64(0x1000100000101010), CONST64(0x1000100400101010), CONST64(0x1000100010101010), CONST64(0x1000100410101010), - CONST64(0x0010100000000000), CONST64(0x0010100400000000), CONST64(0x0010100010000000), CONST64(0x0010100410000000), - CONST64(0x0010100000100000), CONST64(0x0010100400100000), CONST64(0x0010100010100000), CONST64(0x0010100410100000), - CONST64(0x0010100000001000), CONST64(0x0010100400001000), CONST64(0x0010100010001000), CONST64(0x0010100410001000), - CONST64(0x0010100000101000), CONST64(0x0010100400101000), CONST64(0x0010100010101000), CONST64(0x0010100410101000), - CONST64(0x0010100000000010), CONST64(0x0010100400000010), CONST64(0x0010100010000010), CONST64(0x0010100410000010), - CONST64(0x0010100000100010), CONST64(0x0010100400100010), CONST64(0x0010100010100010), CONST64(0x0010100410100010), - CONST64(0x0010100000001010), CONST64(0x0010100400001010), CONST64(0x0010100010001010), CONST64(0x0010100410001010), - CONST64(0x0010100000101010), CONST64(0x0010100400101010), CONST64(0x0010100010101010), CONST64(0x0010100410101010), - CONST64(0x1010100000000000), CONST64(0x1010100400000000), CONST64(0x1010100010000000), CONST64(0x1010100410000000), - CONST64(0x1010100000100000), CONST64(0x1010100400100000), CONST64(0x1010100010100000), CONST64(0x1010100410100000), - CONST64(0x1010100000001000), CONST64(0x1010100400001000), CONST64(0x1010100010001000), CONST64(0x1010100410001000), - CONST64(0x1010100000101000), CONST64(0x1010100400101000), CONST64(0x1010100010101000), CONST64(0x1010100410101000), - CONST64(0x1010100000000010), CONST64(0x1010100400000010), CONST64(0x1010100010000010), CONST64(0x1010100410000010), - CONST64(0x1010100000100010), CONST64(0x1010100400100010), CONST64(0x1010100010100010), CONST64(0x1010100410100010), - CONST64(0x1010100000001010), CONST64(0x1010100400001010), CONST64(0x1010100010001010), CONST64(0x1010100410001010), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000000400000000), CONST64(0x0000000010000000), CONST64(0x0000000410000000), + CONST64(0x0000000000100000), CONST64(0x0000000400100000), CONST64(0x0000000010100000), CONST64(0x0000000410100000), + CONST64(0x0000000000001000), CONST64(0x0000000400001000), CONST64(0x0000000010001000), CONST64(0x0000000410001000), + CONST64(0x0000000000101000), CONST64(0x0000000400101000), CONST64(0x0000000010101000), CONST64(0x0000000410101000), + CONST64(0x0000000000000010), CONST64(0x0000000400000010), CONST64(0x0000000010000010), CONST64(0x0000000410000010), + CONST64(0x0000000000100010), CONST64(0x0000000400100010), CONST64(0x0000000010100010), CONST64(0x0000000410100010), + CONST64(0x0000000000001010), CONST64(0x0000000400001010), CONST64(0x0000000010001010), CONST64(0x0000000410001010), + CONST64(0x0000000000101010), CONST64(0x0000000400101010), CONST64(0x0000000010101010), CONST64(0x0000000410101010), + CONST64(0x1000000000000000), CONST64(0x1000000400000000), CONST64(0x1000000010000000), CONST64(0x1000000410000000), + CONST64(0x1000000000100000), CONST64(0x1000000400100000), CONST64(0x1000000010100000), CONST64(0x1000000410100000), + CONST64(0x1000000000001000), CONST64(0x1000000400001000), CONST64(0x1000000010001000), CONST64(0x1000000410001000), + CONST64(0x1000000000101000), CONST64(0x1000000400101000), CONST64(0x1000000010101000), CONST64(0x1000000410101000), + CONST64(0x1000000000000010), CONST64(0x1000000400000010), CONST64(0x1000000010000010), CONST64(0x1000000410000010), + CONST64(0x1000000000100010), CONST64(0x1000000400100010), CONST64(0x1000000010100010), CONST64(0x1000000410100010), + CONST64(0x1000000000001010), CONST64(0x1000000400001010), CONST64(0x1000000010001010), CONST64(0x1000000410001010), + CONST64(0x1000000000101010), CONST64(0x1000000400101010), CONST64(0x1000000010101010), CONST64(0x1000000410101010), + CONST64(0x0010000000000000), CONST64(0x0010000400000000), CONST64(0x0010000010000000), CONST64(0x0010000410000000), + CONST64(0x0010000000100000), CONST64(0x0010000400100000), CONST64(0x0010000010100000), CONST64(0x0010000410100000), + CONST64(0x0010000000001000), CONST64(0x0010000400001000), CONST64(0x0010000010001000), CONST64(0x0010000410001000), + CONST64(0x0010000000101000), CONST64(0x0010000400101000), CONST64(0x0010000010101000), CONST64(0x0010000410101000), + CONST64(0x0010000000000010), CONST64(0x0010000400000010), CONST64(0x0010000010000010), CONST64(0x0010000410000010), + CONST64(0x0010000000100010), CONST64(0x0010000400100010), CONST64(0x0010000010100010), CONST64(0x0010000410100010), + CONST64(0x0010000000001010), CONST64(0x0010000400001010), CONST64(0x0010000010001010), CONST64(0x0010000410001010), + CONST64(0x0010000000101010), CONST64(0x0010000400101010), CONST64(0x0010000010101010), CONST64(0x0010000410101010), + CONST64(0x1010000000000000), CONST64(0x1010000400000000), CONST64(0x1010000010000000), CONST64(0x1010000410000000), + CONST64(0x1010000000100000), CONST64(0x1010000400100000), CONST64(0x1010000010100000), CONST64(0x1010000410100000), + CONST64(0x1010000000001000), CONST64(0x1010000400001000), CONST64(0x1010000010001000), CONST64(0x1010000410001000), + CONST64(0x1010000000101000), CONST64(0x1010000400101000), CONST64(0x1010000010101000), CONST64(0x1010000410101000), + CONST64(0x1010000000000010), CONST64(0x1010000400000010), CONST64(0x1010000010000010), CONST64(0x1010000410000010), + CONST64(0x1010000000100010), CONST64(0x1010000400100010), CONST64(0x1010000010100010), CONST64(0x1010000410100010), + CONST64(0x1010000000001010), CONST64(0x1010000400001010), CONST64(0x1010000010001010), CONST64(0x1010000410001010), + CONST64(0x1010000000101010), CONST64(0x1010000400101010), CONST64(0x1010000010101010), CONST64(0x1010000410101010), + CONST64(0x0000100000000000), CONST64(0x0000100400000000), CONST64(0x0000100010000000), CONST64(0x0000100410000000), + CONST64(0x0000100000100000), CONST64(0x0000100400100000), CONST64(0x0000100010100000), CONST64(0x0000100410100000), + CONST64(0x0000100000001000), CONST64(0x0000100400001000), CONST64(0x0000100010001000), CONST64(0x0000100410001000), + CONST64(0x0000100000101000), CONST64(0x0000100400101000), CONST64(0x0000100010101000), CONST64(0x0000100410101000), + CONST64(0x0000100000000010), CONST64(0x0000100400000010), CONST64(0x0000100010000010), CONST64(0x0000100410000010), + CONST64(0x0000100000100010), CONST64(0x0000100400100010), CONST64(0x0000100010100010), CONST64(0x0000100410100010), + CONST64(0x0000100000001010), CONST64(0x0000100400001010), CONST64(0x0000100010001010), CONST64(0x0000100410001010), + CONST64(0x0000100000101010), CONST64(0x0000100400101010), CONST64(0x0000100010101010), CONST64(0x0000100410101010), + CONST64(0x1000100000000000), CONST64(0x1000100400000000), CONST64(0x1000100010000000), CONST64(0x1000100410000000), + CONST64(0x1000100000100000), CONST64(0x1000100400100000), CONST64(0x1000100010100000), CONST64(0x1000100410100000), + CONST64(0x1000100000001000), CONST64(0x1000100400001000), CONST64(0x1000100010001000), CONST64(0x1000100410001000), + CONST64(0x1000100000101000), CONST64(0x1000100400101000), CONST64(0x1000100010101000), CONST64(0x1000100410101000), + CONST64(0x1000100000000010), CONST64(0x1000100400000010), CONST64(0x1000100010000010), CONST64(0x1000100410000010), + CONST64(0x1000100000100010), CONST64(0x1000100400100010), CONST64(0x1000100010100010), CONST64(0x1000100410100010), + CONST64(0x1000100000001010), CONST64(0x1000100400001010), CONST64(0x1000100010001010), CONST64(0x1000100410001010), + CONST64(0x1000100000101010), CONST64(0x1000100400101010), CONST64(0x1000100010101010), CONST64(0x1000100410101010), + CONST64(0x0010100000000000), CONST64(0x0010100400000000), CONST64(0x0010100010000000), CONST64(0x0010100410000000), + CONST64(0x0010100000100000), CONST64(0x0010100400100000), CONST64(0x0010100010100000), CONST64(0x0010100410100000), + CONST64(0x0010100000001000), CONST64(0x0010100400001000), CONST64(0x0010100010001000), CONST64(0x0010100410001000), + CONST64(0x0010100000101000), CONST64(0x0010100400101000), CONST64(0x0010100010101000), CONST64(0x0010100410101000), + CONST64(0x0010100000000010), CONST64(0x0010100400000010), CONST64(0x0010100010000010), CONST64(0x0010100410000010), + CONST64(0x0010100000100010), CONST64(0x0010100400100010), CONST64(0x0010100010100010), CONST64(0x0010100410100010), + CONST64(0x0010100000001010), CONST64(0x0010100400001010), CONST64(0x0010100010001010), CONST64(0x0010100410001010), + CONST64(0x0010100000101010), CONST64(0x0010100400101010), CONST64(0x0010100010101010), CONST64(0x0010100410101010), + CONST64(0x1010100000000000), CONST64(0x1010100400000000), CONST64(0x1010100010000000), CONST64(0x1010100410000000), + CONST64(0x1010100000100000), CONST64(0x1010100400100000), CONST64(0x1010100010100000), CONST64(0x1010100410100000), + CONST64(0x1010100000001000), CONST64(0x1010100400001000), CONST64(0x1010100010001000), CONST64(0x1010100410001000), + CONST64(0x1010100000101000), CONST64(0x1010100400101000), CONST64(0x1010100010101000), CONST64(0x1010100410101000), + CONST64(0x1010100000000010), CONST64(0x1010100400000010), CONST64(0x1010100010000010), CONST64(0x1010100410000010), + CONST64(0x1010100000100010), CONST64(0x1010100400100010), CONST64(0x1010100010100010), CONST64(0x1010100410100010), + CONST64(0x1010100000001010), CONST64(0x1010100400001010), CONST64(0x1010100010001010), CONST64(0x1010100410001010), CONST64(0x1010100000101010), CONST64(0x1010100400101010), CONST64(0x1010100010101010), CONST64(0x1010100410101010) - }, -{ CONST64(0x0000000000000000), CONST64(0x0000001000000000), CONST64(0x0000000040000000), CONST64(0x0000001040000000), - CONST64(0x0000000000400000), CONST64(0x0000001000400000), CONST64(0x0000000040400000), CONST64(0x0000001040400000), - CONST64(0x0000000000004000), CONST64(0x0000001000004000), CONST64(0x0000000040004000), CONST64(0x0000001040004000), - CONST64(0x0000000000404000), CONST64(0x0000001000404000), CONST64(0x0000000040404000), CONST64(0x0000001040404000), - CONST64(0x0000000000000040), CONST64(0x0000001000000040), CONST64(0x0000000040000040), CONST64(0x0000001040000040), - CONST64(0x0000000000400040), CONST64(0x0000001000400040), CONST64(0x0000000040400040), CONST64(0x0000001040400040), - CONST64(0x0000000000004040), CONST64(0x0000001000004040), CONST64(0x0000000040004040), CONST64(0x0000001040004040), - CONST64(0x0000000000404040), CONST64(0x0000001000404040), CONST64(0x0000000040404040), CONST64(0x0000001040404040), - CONST64(0x4000000000000000), CONST64(0x4000001000000000), CONST64(0x4000000040000000), CONST64(0x4000001040000000), - CONST64(0x4000000000400000), CONST64(0x4000001000400000), CONST64(0x4000000040400000), CONST64(0x4000001040400000), - CONST64(0x4000000000004000), CONST64(0x4000001000004000), CONST64(0x4000000040004000), CONST64(0x4000001040004000), - CONST64(0x4000000000404000), CONST64(0x4000001000404000), CONST64(0x4000000040404000), CONST64(0x4000001040404000), - CONST64(0x4000000000000040), CONST64(0x4000001000000040), CONST64(0x4000000040000040), CONST64(0x4000001040000040), - CONST64(0x4000000000400040), CONST64(0x4000001000400040), CONST64(0x4000000040400040), CONST64(0x4000001040400040), - CONST64(0x4000000000004040), CONST64(0x4000001000004040), CONST64(0x4000000040004040), CONST64(0x4000001040004040), - CONST64(0x4000000000404040), CONST64(0x4000001000404040), CONST64(0x4000000040404040), CONST64(0x4000001040404040), - CONST64(0x0040000000000000), CONST64(0x0040001000000000), CONST64(0x0040000040000000), CONST64(0x0040001040000000), - CONST64(0x0040000000400000), CONST64(0x0040001000400000), CONST64(0x0040000040400000), CONST64(0x0040001040400000), - CONST64(0x0040000000004000), CONST64(0x0040001000004000), CONST64(0x0040000040004000), CONST64(0x0040001040004000), - CONST64(0x0040000000404000), CONST64(0x0040001000404000), CONST64(0x0040000040404000), CONST64(0x0040001040404000), - CONST64(0x0040000000000040), CONST64(0x0040001000000040), CONST64(0x0040000040000040), CONST64(0x0040001040000040), - CONST64(0x0040000000400040), CONST64(0x0040001000400040), CONST64(0x0040000040400040), CONST64(0x0040001040400040), - CONST64(0x0040000000004040), CONST64(0x0040001000004040), CONST64(0x0040000040004040), CONST64(0x0040001040004040), - CONST64(0x0040000000404040), CONST64(0x0040001000404040), CONST64(0x0040000040404040), CONST64(0x0040001040404040), - CONST64(0x4040000000000000), CONST64(0x4040001000000000), CONST64(0x4040000040000000), CONST64(0x4040001040000000), - CONST64(0x4040000000400000), CONST64(0x4040001000400000), CONST64(0x4040000040400000), CONST64(0x4040001040400000), - CONST64(0x4040000000004000), CONST64(0x4040001000004000), CONST64(0x4040000040004000), CONST64(0x4040001040004000), - CONST64(0x4040000000404000), CONST64(0x4040001000404000), CONST64(0x4040000040404000), CONST64(0x4040001040404000), - CONST64(0x4040000000000040), CONST64(0x4040001000000040), CONST64(0x4040000040000040), CONST64(0x4040001040000040), - CONST64(0x4040000000400040), CONST64(0x4040001000400040), CONST64(0x4040000040400040), CONST64(0x4040001040400040), - CONST64(0x4040000000004040), CONST64(0x4040001000004040), CONST64(0x4040000040004040), CONST64(0x4040001040004040), - CONST64(0x4040000000404040), CONST64(0x4040001000404040), CONST64(0x4040000040404040), CONST64(0x4040001040404040), - CONST64(0x0000400000000000), CONST64(0x0000401000000000), CONST64(0x0000400040000000), CONST64(0x0000401040000000), - CONST64(0x0000400000400000), CONST64(0x0000401000400000), CONST64(0x0000400040400000), CONST64(0x0000401040400000), - CONST64(0x0000400000004000), CONST64(0x0000401000004000), CONST64(0x0000400040004000), CONST64(0x0000401040004000), - CONST64(0x0000400000404000), CONST64(0x0000401000404000), CONST64(0x0000400040404000), CONST64(0x0000401040404000), - CONST64(0x0000400000000040), CONST64(0x0000401000000040), CONST64(0x0000400040000040), CONST64(0x0000401040000040), - CONST64(0x0000400000400040), CONST64(0x0000401000400040), CONST64(0x0000400040400040), CONST64(0x0000401040400040), - CONST64(0x0000400000004040), CONST64(0x0000401000004040), CONST64(0x0000400040004040), CONST64(0x0000401040004040), - CONST64(0x0000400000404040), CONST64(0x0000401000404040), CONST64(0x0000400040404040), CONST64(0x0000401040404040), - CONST64(0x4000400000000000), CONST64(0x4000401000000000), CONST64(0x4000400040000000), CONST64(0x4000401040000000), - CONST64(0x4000400000400000), CONST64(0x4000401000400000), CONST64(0x4000400040400000), CONST64(0x4000401040400000), - CONST64(0x4000400000004000), CONST64(0x4000401000004000), CONST64(0x4000400040004000), CONST64(0x4000401040004000), - CONST64(0x4000400000404000), CONST64(0x4000401000404000), CONST64(0x4000400040404000), CONST64(0x4000401040404000), - CONST64(0x4000400000000040), CONST64(0x4000401000000040), CONST64(0x4000400040000040), CONST64(0x4000401040000040), - CONST64(0x4000400000400040), CONST64(0x4000401000400040), CONST64(0x4000400040400040), CONST64(0x4000401040400040), - CONST64(0x4000400000004040), CONST64(0x4000401000004040), CONST64(0x4000400040004040), CONST64(0x4000401040004040), - CONST64(0x4000400000404040), CONST64(0x4000401000404040), CONST64(0x4000400040404040), CONST64(0x4000401040404040), - CONST64(0x0040400000000000), CONST64(0x0040401000000000), CONST64(0x0040400040000000), CONST64(0x0040401040000000), - CONST64(0x0040400000400000), CONST64(0x0040401000400000), CONST64(0x0040400040400000), CONST64(0x0040401040400000), - CONST64(0x0040400000004000), CONST64(0x0040401000004000), CONST64(0x0040400040004000), CONST64(0x0040401040004000), - CONST64(0x0040400000404000), CONST64(0x0040401000404000), CONST64(0x0040400040404000), CONST64(0x0040401040404000), - CONST64(0x0040400000000040), CONST64(0x0040401000000040), CONST64(0x0040400040000040), CONST64(0x0040401040000040), - CONST64(0x0040400000400040), CONST64(0x0040401000400040), CONST64(0x0040400040400040), CONST64(0x0040401040400040), - CONST64(0x0040400000004040), CONST64(0x0040401000004040), CONST64(0x0040400040004040), CONST64(0x0040401040004040), - CONST64(0x0040400000404040), CONST64(0x0040401000404040), CONST64(0x0040400040404040), CONST64(0x0040401040404040), - CONST64(0x4040400000000000), CONST64(0x4040401000000000), CONST64(0x4040400040000000), CONST64(0x4040401040000000), - CONST64(0x4040400000400000), CONST64(0x4040401000400000), CONST64(0x4040400040400000), CONST64(0x4040401040400000), - CONST64(0x4040400000004000), CONST64(0x4040401000004000), CONST64(0x4040400040004000), CONST64(0x4040401040004000), - CONST64(0x4040400000404000), CONST64(0x4040401000404000), CONST64(0x4040400040404000), CONST64(0x4040401040404000), - CONST64(0x4040400000000040), CONST64(0x4040401000000040), CONST64(0x4040400040000040), CONST64(0x4040401040000040), - CONST64(0x4040400000400040), CONST64(0x4040401000400040), CONST64(0x4040400040400040), CONST64(0x4040401040400040), - CONST64(0x4040400000004040), CONST64(0x4040401000004040), CONST64(0x4040400040004040), CONST64(0x4040401040004040), + }, +{ CONST64(0x0000000000000000), CONST64(0x0000001000000000), CONST64(0x0000000040000000), CONST64(0x0000001040000000), + CONST64(0x0000000000400000), CONST64(0x0000001000400000), CONST64(0x0000000040400000), CONST64(0x0000001040400000), + CONST64(0x0000000000004000), CONST64(0x0000001000004000), CONST64(0x0000000040004000), CONST64(0x0000001040004000), + CONST64(0x0000000000404000), CONST64(0x0000001000404000), CONST64(0x0000000040404000), CONST64(0x0000001040404000), + CONST64(0x0000000000000040), CONST64(0x0000001000000040), CONST64(0x0000000040000040), CONST64(0x0000001040000040), + CONST64(0x0000000000400040), CONST64(0x0000001000400040), CONST64(0x0000000040400040), CONST64(0x0000001040400040), + CONST64(0x0000000000004040), CONST64(0x0000001000004040), CONST64(0x0000000040004040), CONST64(0x0000001040004040), + CONST64(0x0000000000404040), CONST64(0x0000001000404040), CONST64(0x0000000040404040), CONST64(0x0000001040404040), + CONST64(0x4000000000000000), CONST64(0x4000001000000000), CONST64(0x4000000040000000), CONST64(0x4000001040000000), + CONST64(0x4000000000400000), CONST64(0x4000001000400000), CONST64(0x4000000040400000), CONST64(0x4000001040400000), + CONST64(0x4000000000004000), CONST64(0x4000001000004000), CONST64(0x4000000040004000), CONST64(0x4000001040004000), + CONST64(0x4000000000404000), CONST64(0x4000001000404000), CONST64(0x4000000040404000), CONST64(0x4000001040404000), + CONST64(0x4000000000000040), CONST64(0x4000001000000040), CONST64(0x4000000040000040), CONST64(0x4000001040000040), + CONST64(0x4000000000400040), CONST64(0x4000001000400040), CONST64(0x4000000040400040), CONST64(0x4000001040400040), + CONST64(0x4000000000004040), CONST64(0x4000001000004040), CONST64(0x4000000040004040), CONST64(0x4000001040004040), + CONST64(0x4000000000404040), CONST64(0x4000001000404040), CONST64(0x4000000040404040), CONST64(0x4000001040404040), + CONST64(0x0040000000000000), CONST64(0x0040001000000000), CONST64(0x0040000040000000), CONST64(0x0040001040000000), + CONST64(0x0040000000400000), CONST64(0x0040001000400000), CONST64(0x0040000040400000), CONST64(0x0040001040400000), + CONST64(0x0040000000004000), CONST64(0x0040001000004000), CONST64(0x0040000040004000), CONST64(0x0040001040004000), + CONST64(0x0040000000404000), CONST64(0x0040001000404000), CONST64(0x0040000040404000), CONST64(0x0040001040404000), + CONST64(0x0040000000000040), CONST64(0x0040001000000040), CONST64(0x0040000040000040), CONST64(0x0040001040000040), + CONST64(0x0040000000400040), CONST64(0x0040001000400040), CONST64(0x0040000040400040), CONST64(0x0040001040400040), + CONST64(0x0040000000004040), CONST64(0x0040001000004040), CONST64(0x0040000040004040), CONST64(0x0040001040004040), + CONST64(0x0040000000404040), CONST64(0x0040001000404040), CONST64(0x0040000040404040), CONST64(0x0040001040404040), + CONST64(0x4040000000000000), CONST64(0x4040001000000000), CONST64(0x4040000040000000), CONST64(0x4040001040000000), + CONST64(0x4040000000400000), CONST64(0x4040001000400000), CONST64(0x4040000040400000), CONST64(0x4040001040400000), + CONST64(0x4040000000004000), CONST64(0x4040001000004000), CONST64(0x4040000040004000), CONST64(0x4040001040004000), + CONST64(0x4040000000404000), CONST64(0x4040001000404000), CONST64(0x4040000040404000), CONST64(0x4040001040404000), + CONST64(0x4040000000000040), CONST64(0x4040001000000040), CONST64(0x4040000040000040), CONST64(0x4040001040000040), + CONST64(0x4040000000400040), CONST64(0x4040001000400040), CONST64(0x4040000040400040), CONST64(0x4040001040400040), + CONST64(0x4040000000004040), CONST64(0x4040001000004040), CONST64(0x4040000040004040), CONST64(0x4040001040004040), + CONST64(0x4040000000404040), CONST64(0x4040001000404040), CONST64(0x4040000040404040), CONST64(0x4040001040404040), + CONST64(0x0000400000000000), CONST64(0x0000401000000000), CONST64(0x0000400040000000), CONST64(0x0000401040000000), + CONST64(0x0000400000400000), CONST64(0x0000401000400000), CONST64(0x0000400040400000), CONST64(0x0000401040400000), + CONST64(0x0000400000004000), CONST64(0x0000401000004000), CONST64(0x0000400040004000), CONST64(0x0000401040004000), + CONST64(0x0000400000404000), CONST64(0x0000401000404000), CONST64(0x0000400040404000), CONST64(0x0000401040404000), + CONST64(0x0000400000000040), CONST64(0x0000401000000040), CONST64(0x0000400040000040), CONST64(0x0000401040000040), + CONST64(0x0000400000400040), CONST64(0x0000401000400040), CONST64(0x0000400040400040), CONST64(0x0000401040400040), + CONST64(0x0000400000004040), CONST64(0x0000401000004040), CONST64(0x0000400040004040), CONST64(0x0000401040004040), + CONST64(0x0000400000404040), CONST64(0x0000401000404040), CONST64(0x0000400040404040), CONST64(0x0000401040404040), + CONST64(0x4000400000000000), CONST64(0x4000401000000000), CONST64(0x4000400040000000), CONST64(0x4000401040000000), + CONST64(0x4000400000400000), CONST64(0x4000401000400000), CONST64(0x4000400040400000), CONST64(0x4000401040400000), + CONST64(0x4000400000004000), CONST64(0x4000401000004000), CONST64(0x4000400040004000), CONST64(0x4000401040004000), + CONST64(0x4000400000404000), CONST64(0x4000401000404000), CONST64(0x4000400040404000), CONST64(0x4000401040404000), + CONST64(0x4000400000000040), CONST64(0x4000401000000040), CONST64(0x4000400040000040), CONST64(0x4000401040000040), + CONST64(0x4000400000400040), CONST64(0x4000401000400040), CONST64(0x4000400040400040), CONST64(0x4000401040400040), + CONST64(0x4000400000004040), CONST64(0x4000401000004040), CONST64(0x4000400040004040), CONST64(0x4000401040004040), + CONST64(0x4000400000404040), CONST64(0x4000401000404040), CONST64(0x4000400040404040), CONST64(0x4000401040404040), + CONST64(0x0040400000000000), CONST64(0x0040401000000000), CONST64(0x0040400040000000), CONST64(0x0040401040000000), + CONST64(0x0040400000400000), CONST64(0x0040401000400000), CONST64(0x0040400040400000), CONST64(0x0040401040400000), + CONST64(0x0040400000004000), CONST64(0x0040401000004000), CONST64(0x0040400040004000), CONST64(0x0040401040004000), + CONST64(0x0040400000404000), CONST64(0x0040401000404000), CONST64(0x0040400040404000), CONST64(0x0040401040404000), + CONST64(0x0040400000000040), CONST64(0x0040401000000040), CONST64(0x0040400040000040), CONST64(0x0040401040000040), + CONST64(0x0040400000400040), CONST64(0x0040401000400040), CONST64(0x0040400040400040), CONST64(0x0040401040400040), + CONST64(0x0040400000004040), CONST64(0x0040401000004040), CONST64(0x0040400040004040), CONST64(0x0040401040004040), + CONST64(0x0040400000404040), CONST64(0x0040401000404040), CONST64(0x0040400040404040), CONST64(0x0040401040404040), + CONST64(0x4040400000000000), CONST64(0x4040401000000000), CONST64(0x4040400040000000), CONST64(0x4040401040000000), + CONST64(0x4040400000400000), CONST64(0x4040401000400000), CONST64(0x4040400040400000), CONST64(0x4040401040400000), + CONST64(0x4040400000004000), CONST64(0x4040401000004000), CONST64(0x4040400040004000), CONST64(0x4040401040004000), + CONST64(0x4040400000404000), CONST64(0x4040401000404000), CONST64(0x4040400040404000), CONST64(0x4040401040404000), + CONST64(0x4040400000000040), CONST64(0x4040401000000040), CONST64(0x4040400040000040), CONST64(0x4040401040000040), + CONST64(0x4040400000400040), CONST64(0x4040401000400040), CONST64(0x4040400040400040), CONST64(0x4040401040400040), + CONST64(0x4040400000004040), CONST64(0x4040401000004040), CONST64(0x4040400040004040), CONST64(0x4040401040004040), CONST64(0x4040400000404040), CONST64(0x4040401000404040), CONST64(0x4040400040404040), CONST64(0x4040401040404040) }}; - + #endif @@ -1429,11 +1429,11 @@ static void _desfunc(ulong32 *block, const ulong32 *keys) right = ROLc(right, 1); work = (leftt ^ right) & 0xaaaaaaaaL; - + leftt ^= work; right ^= work; leftt = ROLc(leftt, 1); -#else +#else { ulong64 tmp; tmp = des_ip[0][byte(leftt, 0)] ^ @@ -1473,7 +1473,7 @@ static void _desfunc(ulong32 *block, const ulong32 *keys) ^ SP2[(work >> 24) & 0x3fL]; } -#ifdef LTC_SMALL_CODE +#ifdef LTC_SMALL_CODE right = RORc(right, 1); work = (leftt ^ right) & 0xaaaaaaaaL; leftt ^= work; @@ -1492,7 +1492,7 @@ static void _desfunc(ulong32 *block, const ulong32 *keys) work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL; leftt ^= work; right ^= (work << 4); -#else +#else { ulong64 tmp; tmp = des_fp[0][byte(leftt, 0)] ^ @@ -1507,7 +1507,7 @@ static void _desfunc(ulong32 *block, const ulong32 *keys) right = (ulong32)(tmp & 0xFFFFFFFFUL); } #endif - + block[0] = right; block[1] = leftt; } @@ -1606,7 +1606,7 @@ int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s Decrypts a block of text with LTC_DES @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) - @param skey The key as scheduled + @param skey The key as scheduled @return CRYPT_OK if successful */ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) @@ -1619,7 +1619,7 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s LOAD32H(work[1], ct+4); desfunc(work, skey->des.dk); STORE32H(work[0],pt+0); - STORE32H(work[1],pt+4); + STORE32H(work[1],pt+4); return CRYPT_OK; } @@ -1634,7 +1634,7 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) { ulong32 work[2]; - + LTC_ARGCHK(pt != NULL); LTC_ARGCHK(ct != NULL); LTC_ARGCHK(skey != NULL); @@ -1652,7 +1652,7 @@ int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key * Decrypts a block of text with 3LTC_DES-EDE @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) - @param skey The key as scheduled + @param skey The key as scheduled @return CRYPT_OK if successful */ int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) @@ -1680,7 +1680,7 @@ int des_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else int err; static const struct des_test_case { int num, mode; /* mode 1 = encrypt */ @@ -1711,7 +1711,7 @@ int des_test(void) { 0x6C, 0xC5, 0xDE, 0xFA, 0xAF, 0x04, 0x51, 0x2F }, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, { 9, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x0D, 0x9F, 0x27, 0x9B, 0xA5, 0xD8, 0x72, 0x60 }, + { 0x0D, 0x9F, 0x27, 0x9B, 0xA5, 0xD8, 0x72, 0x60 }, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, {10, 1, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, { 0xD9, 0x03, 0x1B, 0x02, 0x71, 0xBD, 0x5A, 0x0A }, @@ -1743,7 +1743,7 @@ int des_test(void) { 0x6C, 0xC5, 0xDE, 0xFA, 0xAF, 0x04, 0x51, 0x2F } }, { 9, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x0D, 0x9F, 0x27, 0x9B, 0xA5, 0xD8, 0x72, 0x60 } }, + { 0x0D, 0x9F, 0x27, 0x9B, 0xA5, 0xD8, 0x72, 0x60 } }, {10, 0, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, { 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0xD9, 0x03, 0x1B, 0x02, 0x71, 0xBD, 0x5A, 0x0A } } @@ -1798,7 +1798,7 @@ int des_test(void) if ((err = des_setup(cases[i].key, 8, 0, &des)) != CRYPT_OK) { return err; } - if (cases[i].mode != 0) { + if (cases[i].mode != 0) { des_ecb_encrypt(cases[i].txt, tmp, &des); } else { des_ecb_decrypt(cases[i].txt, tmp, &des); @@ -1824,7 +1824,7 @@ int des3_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else unsigned char key[24], pt[8], ct[8], tmp[8]; symmetric_key skey; int x, err; @@ -1836,7 +1836,7 @@ int des3_test(void) for (x = 0; x < 8; x++) { pt[x] = x; } - + for (x = 0; x < 24; x++) { key[x] = x; } @@ -1844,20 +1844,20 @@ int des3_test(void) if ((err = des3_setup(key, 24, 0, &skey)) != CRYPT_OK) { return err; } - + des3_ecb_encrypt(pt, ct, &skey); des3_ecb_decrypt(ct, tmp, &skey); - + if (XMEMCMP(pt, tmp, 8) != 0) { return CRYPT_FAIL_TESTVECTOR; } - + return CRYPT_OK; #endif } #endif -/** Terminate the context +/** Terminate the context @param skey The scheduled key */ void des_done(symmetric_key *skey) @@ -1865,7 +1865,7 @@ void des_done(symmetric_key *skey) } #ifdef LTC_DES3 -/** Terminate the context +/** Terminate the context @param skey The scheduled key */ void des3_done(symmetric_key *skey) diff --git a/crypto/md4.c b/crypto/md4.c index 2bd742d4..a030d301 100644 --- a/crypto/md4.c +++ b/crypto/md4.c @@ -12,7 +12,7 @@ /** @param md4.c - Submitted by Dobes Vandermeer (dobes@smartt.com) + Submitted by Dobes Vandermeer (dobes@smartt.com) */ #ifdef LTC_MD4 @@ -23,7 +23,7 @@ const struct ltc_hash_descriptor md4_desc = 6, 16, 64, - + /* OID */ { 1, 2, 840, 113549, 2, 4, }, 6, @@ -56,8 +56,8 @@ const struct ltc_hash_descriptor md4_desc = /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) ROLc(x, n) -/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ -/* Rotation is separate from addition to prevent recomputation */ +/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ +/* Rotation is separate from addition to prevent recomputation */ #define FF(a, b, c, d, x, s) { \ (a) += F ((b), (c), (d)) + (x); \ @@ -91,61 +91,61 @@ static int md4_compress(hash_state *md, unsigned char *buf) for (i = 0; i < 16; i++) { LOAD32L(x[i], buf + (4*i)); } - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11); /* 1 */ - FF (d, a, b, c, x[ 1], S12); /* 2 */ - FF (c, d, a, b, x[ 2], S13); /* 3 */ - FF (b, c, d, a, x[ 3], S14); /* 4 */ - FF (a, b, c, d, x[ 4], S11); /* 5 */ - FF (d, a, b, c, x[ 5], S12); /* 6 */ - FF (c, d, a, b, x[ 6], S13); /* 7 */ - FF (b, c, d, a, x[ 7], S14); /* 8 */ - FF (a, b, c, d, x[ 8], S11); /* 9 */ + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11); /* 1 */ + FF (d, a, b, c, x[ 1], S12); /* 2 */ + FF (c, d, a, b, x[ 2], S13); /* 3 */ + FF (b, c, d, a, x[ 3], S14); /* 4 */ + FF (a, b, c, d, x[ 4], S11); /* 5 */ + FF (d, a, b, c, x[ 5], S12); /* 6 */ + FF (c, d, a, b, x[ 6], S13); /* 7 */ + FF (b, c, d, a, x[ 7], S14); /* 8 */ + FF (a, b, c, d, x[ 8], S11); /* 9 */ FF (d, a, b, c, x[ 9], S12); /* 10 */ - FF (c, d, a, b, x[10], S13); /* 11 */ + FF (c, d, a, b, x[10], S13); /* 11 */ FF (b, c, d, a, x[11], S14); /* 12 */ FF (a, b, c, d, x[12], S11); /* 13 */ - FF (d, a, b, c, x[13], S12); /* 14 */ - FF (c, d, a, b, x[14], S13); /* 15 */ - FF (b, c, d, a, x[15], S14); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 0], S21); /* 17 */ - GG (d, a, b, c, x[ 4], S22); /* 18 */ - GG (c, d, a, b, x[ 8], S23); /* 19 */ - GG (b, c, d, a, x[12], S24); /* 20 */ - GG (a, b, c, d, x[ 1], S21); /* 21 */ - GG (d, a, b, c, x[ 5], S22); /* 22 */ - GG (c, d, a, b, x[ 9], S23); /* 23 */ - GG (b, c, d, a, x[13], S24); /* 24 */ - GG (a, b, c, d, x[ 2], S21); /* 25 */ - GG (d, a, b, c, x[ 6], S22); /* 26 */ - GG (c, d, a, b, x[10], S23); /* 27 */ - GG (b, c, d, a, x[14], S24); /* 28 */ - GG (a, b, c, d, x[ 3], S21); /* 29 */ - GG (d, a, b, c, x[ 7], S22); /* 30 */ - GG (c, d, a, b, x[11], S23); /* 31 */ - GG (b, c, d, a, x[15], S24); /* 32 */ - + FF (d, a, b, c, x[13], S12); /* 14 */ + FF (c, d, a, b, x[14], S13); /* 15 */ + FF (b, c, d, a, x[15], S14); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 0], S21); /* 17 */ + GG (d, a, b, c, x[ 4], S22); /* 18 */ + GG (c, d, a, b, x[ 8], S23); /* 19 */ + GG (b, c, d, a, x[12], S24); /* 20 */ + GG (a, b, c, d, x[ 1], S21); /* 21 */ + GG (d, a, b, c, x[ 5], S22); /* 22 */ + GG (c, d, a, b, x[ 9], S23); /* 23 */ + GG (b, c, d, a, x[13], S24); /* 24 */ + GG (a, b, c, d, x[ 2], S21); /* 25 */ + GG (d, a, b, c, x[ 6], S22); /* 26 */ + GG (c, d, a, b, x[10], S23); /* 27 */ + GG (b, c, d, a, x[14], S24); /* 28 */ + GG (a, b, c, d, x[ 3], S21); /* 29 */ + GG (d, a, b, c, x[ 7], S22); /* 30 */ + GG (c, d, a, b, x[11], S23); /* 31 */ + GG (b, c, d, a, x[15], S24); /* 32 */ + /* Round 3 */ - HH (a, b, c, d, x[ 0], S31); /* 33 */ - HH (d, a, b, c, x[ 8], S32); /* 34 */ - HH (c, d, a, b, x[ 4], S33); /* 35 */ - HH (b, c, d, a, x[12], S34); /* 36 */ - HH (a, b, c, d, x[ 2], S31); /* 37 */ - HH (d, a, b, c, x[10], S32); /* 38 */ - HH (c, d, a, b, x[ 6], S33); /* 39 */ - HH (b, c, d, a, x[14], S34); /* 40 */ - HH (a, b, c, d, x[ 1], S31); /* 41 */ - HH (d, a, b, c, x[ 9], S32); /* 42 */ - HH (c, d, a, b, x[ 5], S33); /* 43 */ - HH (b, c, d, a, x[13], S34); /* 44 */ - HH (a, b, c, d, x[ 3], S31); /* 45 */ - HH (d, a, b, c, x[11], S32); /* 46 */ - HH (c, d, a, b, x[ 7], S33); /* 47 */ - HH (b, c, d, a, x[15], S34); /* 48 */ - + HH (a, b, c, d, x[ 0], S31); /* 33 */ + HH (d, a, b, c, x[ 8], S32); /* 34 */ + HH (c, d, a, b, x[ 4], S33); /* 35 */ + HH (b, c, d, a, x[12], S34); /* 36 */ + HH (a, b, c, d, x[ 2], S31); /* 37 */ + HH (d, a, b, c, x[10], S32); /* 38 */ + HH (c, d, a, b, x[ 6], S33); /* 39 */ + HH (b, c, d, a, x[14], S34); /* 40 */ + HH (a, b, c, d, x[ 1], S31); /* 41 */ + HH (d, a, b, c, x[ 9], S32); /* 42 */ + HH (c, d, a, b, x[ 5], S33); /* 43 */ + HH (b, c, d, a, x[13], S34); /* 44 */ + HH (a, b, c, d, x[ 3], S31); /* 45 */ + HH (d, a, b, c, x[11], S32); /* 46 */ + HH (c, d, a, b, x[ 7], S33); /* 47 */ + HH (b, c, d, a, x[15], S34); /* 48 */ + /* Update our state */ md->md4.state[0] = md->md4.state[0] + a; @@ -242,43 +242,43 @@ int md4_done(hash_state * md, unsigned char *out) } #ifdef LTC_CLEAN_STACK zeromem(md, sizeof(hash_state)); -#endif +#endif return CRYPT_OK; } /** Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ +*/ int md4_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else static const struct md4_test_case { char *input; unsigned char digest[16]; } cases[] = { - { "", + { "", {0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0} }, { "a", {0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24} }, { "abc", - {0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, + {0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d} }, - { "message digest", - {0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, + { "message digest", + {0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b} }, - { "abcdefghijklmnopqrstuvwxyz", - {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, + { "abcdefghijklmnopqrstuvwxyz", + {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9} }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - {0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + {0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4} }, - { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - {0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, + { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + {0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36} }, }; int i; diff --git a/crypto/md5.c b/crypto/md5.c index 3875ca6f..78a861af 100644 --- a/crypto/md5.c +++ b/crypto/md5.c @@ -13,7 +13,7 @@ /** @file md5.c - LTC_MD5 hash function by Tom St Denis + LTC_MD5 hash function by Tom St Denis */ #ifdef LTC_MD5 @@ -95,7 +95,7 @@ static const ulong32 Korder[64] = { a = (a + I(b,c,d) + M + t); a = ROLc(a, s) + b; -#endif +#endif #ifdef LTC_CLEAN_STACK static int _md5_compress(hash_state *md, unsigned char *buf) @@ -112,7 +112,7 @@ static int md5_compress(hash_state *md, unsigned char *buf) for (i = 0; i < 16; i++) { LOAD32L(W[i], buf + (4*i)); } - + /* copy state */ a = md->md5.state[0]; b = md->md5.state[1]; @@ -309,37 +309,37 @@ int md5_done(hash_state * md, unsigned char *out) /** Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ +*/ int md5_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else static const struct { char *msg; unsigned char hash[16]; } tests[] = { { "", - { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, + { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } }, { "a", - {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, + {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } }, { "abc", - { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, + { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } }, - { "message digest", - { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, - 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } }, + { "message digest", + { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, + 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } }, { "abcdefghijklmnopqrstuvwxyz", - { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, + { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b } }, { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, + { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f } }, { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, - 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } }, + { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, + 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a } }, { NULL, { 0 } } }; diff --git a/crypto/sha1.c b/crypto/sha1.c index 835de18b..a1a216e6 100644 --- a/crypto/sha1.c +++ b/crypto/sha1.c @@ -12,7 +12,7 @@ /** @file sha1.c - LTC_SHA1 code by Tom St Denis + LTC_SHA1 code by Tom St Denis */ @@ -66,7 +66,7 @@ static int sha1_compress(hash_state *md, unsigned char *buf) /* expand it */ for (i = 16; i < 80; i++) { - W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); + W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); } /* compress */ @@ -75,9 +75,9 @@ static int sha1_compress(hash_state *md, unsigned char *buf) #define FF1(a,b,c,d,e,i) e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30); #define FF2(a,b,c,d,e,i) e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30); #define FF3(a,b,c,d,e,i) e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30); - + #ifdef LTC_SMALL_CODE - + for (i = 0; i < 20; ) { FF0(a,b,c,d,e,i++); t = e; e = d; d = c; c = b; b = a; a = t; } @@ -105,7 +105,7 @@ static int sha1_compress(hash_state *md, unsigned char *buf) } /* round two */ - for (; i < 40; ) { + for (; i < 40; ) { FF1(a,b,c,d,e,i++); FF1(e,a,b,c,d,i++); FF1(d,e,a,b,c,i++); @@ -114,7 +114,7 @@ static int sha1_compress(hash_state *md, unsigned char *buf) } /* round three */ - for (; i < 60; ) { + for (; i < 60; ) { FF2(a,b,c,d,e,i++); FF2(e,a,b,c,d,i++); FF2(d,e,a,b,c,i++); @@ -123,7 +123,7 @@ static int sha1_compress(hash_state *md, unsigned char *buf) } /* round four */ - for (; i < 80; ) { + for (; i < 80; ) { FF3(a,b,c,d,e,i++); FF3(e,a,b,c,d,i++); FF3(d,e,a,b,c,i++); @@ -241,12 +241,12 @@ int sha1_done(hash_state * md, unsigned char *out) /** Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ +*/ int sha1_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else static const struct { char *msg; unsigned char hash[20]; diff --git a/crypto/tomcrypt_argchk.h b/crypto/tomcrypt_argchk.h index cfc93ad7..aed53dbe 100644 --- a/crypto/tomcrypt_argchk.h +++ b/crypto/tomcrypt_argchk.h @@ -22,7 +22,7 @@ void crypt_argchk(char *v, char *s, int d); #elif ARGTYPE == 3 -#define LTC_ARGCHK(x) +#define LTC_ARGCHK(x) #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) #elif ARGTYPE == 4 diff --git a/crypto/tomcrypt_cfg.h b/crypto/tomcrypt_cfg.h index 7feae6e8..34eaad26 100644 --- a/crypto/tomcrypt_cfg.h +++ b/crypto/tomcrypt_cfg.h @@ -48,8 +48,8 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2); #define ARGTYPE 0 #endif -/* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code - * +/* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code + * * Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes. * The x86 platforms allow this but some others [ARM for instance] do not. On those platforms you **MUST** * use the portable [slower] macros. @@ -83,7 +83,7 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2); #define ENDIAN_32BITWORD #define LTC_FAST #define LTC_FAST_TYPE unsigned long -#endif +#endif /* detect sparc and sparc64 */ #if defined(__sparc__) diff --git a/crypto/tomcrypt_cipher.h b/crypto/tomcrypt_cipher.h index c7bab4f3..24e1f781 100644 --- a/crypto/tomcrypt_cipher.h +++ b/crypto/tomcrypt_cipher.h @@ -1,6 +1,6 @@ /* ---- SYMMETRIC KEY STUFF ----- * - * We put each of the ciphers scheduled keys in their own structs then we put all of + * We put each of the ciphers scheduled keys in their own structs then we put all of * the key formats in one union. This makes the function prototypes easier to use. */ #ifdef LTC_BLOWFISH @@ -110,7 +110,7 @@ struct noekeon_key { }; #endif -#ifdef LTC_SKIPJACK +#ifdef LTC_SKIPJACK struct skipjack_key { unsigned char key[10]; }; @@ -118,18 +118,18 @@ struct skipjack_key { #ifdef LTC_KHAZAD struct khazad_key { - ulong64 roundKeyEnc[8 + 1]; - ulong64 roundKeyDec[8 + 1]; + ulong64 roundKeyEnc[8 + 1]; + ulong64 roundKeyDec[8 + 1]; }; #endif #ifdef LTC_ANUBIS -struct anubis_key { - int keyBits; - int R; - ulong32 roundKeyEnc[18 + 1][4]; - ulong32 roundKeyDec[18 + 1][4]; -}; +struct anubis_key { + int keyBits; + int R; + ulong32 roundKeyEnc[18 + 1][4]; + ulong32 roundKeyDec[18 + 1][4]; +}; #endif #ifdef LTC_MULTI2 @@ -178,7 +178,7 @@ typedef union Symmetric_key { #endif #ifdef LTC_NOEKEON struct noekeon_key noekeon; -#endif +#endif #ifdef LTC_SKIPJACK struct skipjack_key skipjack; #endif @@ -193,7 +193,7 @@ typedef union Symmetric_key { #endif #ifdef LTC_KASUMI struct kasumi_key kasumi; -#endif +#endif #ifdef LTC_MULTI2 struct multi2_key multi2; #endif @@ -204,10 +204,10 @@ typedef union Symmetric_key { /** A block cipher ECB structure */ typedef struct { /** The index of the cipher chosen */ - int cipher, + int cipher, /** The block size of the given cipher */ blocklen; - /** The scheduled key */ + /** The scheduled key */ symmetric_key key; } symmetric_ECB; #endif @@ -216,14 +216,14 @@ typedef struct { /** A block cipher CFB structure */ typedef struct { /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, + int cipher, + /** The block size of the given cipher */ + blocklen, /** The padding offset */ padlen; /** The current IV */ - unsigned char IV[MAXBLOCKSIZE], - /** The pad used to encrypt/decrypt */ + unsigned char IV[MAXBLOCKSIZE], + /** The pad used to encrypt/decrypt */ pad[MAXBLOCKSIZE]; /** The scheduled key */ symmetric_key key; @@ -234,9 +234,9 @@ typedef struct { /** A block cipher OFB structure */ typedef struct { /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, + int cipher, + /** The block size of the given cipher */ + blocklen, /** The padding offset */ padlen; /** The current IV */ @@ -250,8 +250,8 @@ typedef struct { /** A block cipher CBC structure */ typedef struct { /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ + int cipher, + /** The block size of the given cipher */ blocklen; /** The current IV */ unsigned char IV[MAXBLOCKSIZE]; @@ -266,18 +266,18 @@ typedef struct { typedef struct { /** The index of the cipher chosen */ int cipher, - /** The block size of the given cipher */ - blocklen, + /** The block size of the given cipher */ + blocklen, /** The padding offset */ - padlen, + padlen, /** The mode (endianess) of the CTR, 0==little, 1==big */ mode, /** counter width */ ctrlen; - /** The counter */ - unsigned char ctr[MAXBLOCKSIZE], - /** The pad used to encrypt/decrypt */ + /** The counter */ + unsigned char ctr[MAXBLOCKSIZE], + /** The pad used to encrypt/decrypt */ pad[MAXBLOCKSIZE]; /** The scheduled key */ symmetric_key key; @@ -293,7 +293,7 @@ typedef struct { /** The current IV */ unsigned char IV[16], - + /** the tweak key */ tweak[16], @@ -314,9 +314,9 @@ typedef struct { /** A block cipher F8 structure */ typedef struct { /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen, + int cipher, + /** The block size of the given cipher */ + blocklen, /** The padding offset */ padlen; /** The current IV */ @@ -337,14 +337,14 @@ extern struct ltc_cipher_descriptor { /** internal ID */ unsigned char ID; /** min keysize (octets) */ - int min_key_length, + int min_key_length, /** max keysize (octets) */ - max_key_length, + max_key_length, /** block size (octets) */ - block_length, + block_length, /** default number of rounds */ default_rounds; - /** Setup the cipher + /** Setup the cipher @param key The input symmetric key @param keylen The length of the input key (octets) @param num_rounds The requested number of rounds (0==default) @@ -371,10 +371,10 @@ extern struct ltc_cipher_descriptor { */ int (*test)(void); - /** Terminate the context + /** Terminate the context @param skey The scheduled key */ - void (*done)(symmetric_key *skey); + void (*done)(symmetric_key *skey); /** Determine a key size @param keysize [in/out] The size of the key desired and the suggested size @@ -383,7 +383,7 @@ extern struct ltc_cipher_descriptor { int (*keysize)(int *keysize); /** Accelerators **/ - /** Accelerated ECB encryption + /** Accelerated ECB encryption @param pt Plaintext @param ct Ciphertext @param blocks The number of complete blocks to process @@ -392,7 +392,7 @@ extern struct ltc_cipher_descriptor { */ int (*accel_ecb_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, symmetric_key *skey); - /** Accelerated ECB decryption + /** Accelerated ECB decryption @param pt Plaintext @param ct Ciphertext @param blocks The number of complete blocks to process @@ -401,7 +401,7 @@ extern struct ltc_cipher_descriptor { */ int (*accel_ecb_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, symmetric_key *skey); - /** Accelerated CBC encryption + /** Accelerated CBC encryption @param pt Plaintext @param ct Ciphertext @param blocks The number of complete blocks to process @@ -411,7 +411,7 @@ extern struct ltc_cipher_descriptor { */ int (*accel_cbc_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, symmetric_key *skey); - /** Accelerated CBC decryption + /** Accelerated CBC decryption @param pt Plaintext @param ct Ciphertext @param blocks The number of complete blocks to process @@ -421,7 +421,7 @@ extern struct ltc_cipher_descriptor { */ int (*accel_cbc_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, symmetric_key *skey); - /** Accelerated CTR encryption + /** Accelerated CTR encryption @param pt Plaintext @param ct Ciphertext @param blocks The number of complete blocks to process @@ -432,7 +432,7 @@ extern struct ltc_cipher_descriptor { */ int (*accel_ctr_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, int mode, symmetric_key *skey); - /** Accelerated LRW + /** Accelerated LRW @param pt Plaintext @param ct Ciphertext @param blocks The number of complete blocks to process @@ -443,7 +443,7 @@ extern struct ltc_cipher_descriptor { */ int (*accel_lrw_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey); - /** Accelerated LRW + /** Accelerated LRW @param ct Ciphertext @param pt Plaintext @param blocks The number of complete blocks to process @@ -483,7 +483,7 @@ extern struct ltc_cipher_descriptor { /** Accelerated GCM packet (one shot) @param key The secret key @param keylen The length of the secret key - @param IV The initial vector + @param IV The initial vector @param IVlen The length of the initial vector @param adata The additional authentication data (header) @param adatalen The length of the adata @@ -500,14 +500,14 @@ extern struct ltc_cipher_descriptor { const unsigned char *IV, unsigned long IVlen, const unsigned char *adata, unsigned long adatalen, unsigned char *pt, unsigned long ptlen, - unsigned char *ct, + unsigned char *ct, unsigned char *tag, unsigned long *taglen, int direction); - /** Accelerated one shot LTC_OMAC + /** Accelerated one shot LTC_OMAC @param key The secret key - @param keylen The key length (octets) - @param in The message + @param keylen The key length (octets) + @param in The message @param inlen Length of message (octets) @param out [out] Destination for tag @param outlen [in/out] Initial and final size of out @@ -518,10 +518,10 @@ extern struct ltc_cipher_descriptor { const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); - /** Accelerated one shot XCBC + /** Accelerated one shot XCBC @param key The secret key - @param keylen The key length (octets) - @param in The message + @param keylen The key length (octets) + @param in The message @param inlen Length of message (octets) @param out [out] Destination for tag @param outlen [in/out] Initial and final size of out @@ -532,10 +532,10 @@ extern struct ltc_cipher_descriptor { const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); - /** Accelerated one shot F9 + /** Accelerated one shot F9 @param key The secret key - @param keylen The key length (octets) - @param in The message + @param keylen The key length (octets) + @param in The message @param inlen Length of message (octets) @param out [out] Destination for tag @param outlen [in/out] Initial and final size of out @@ -763,7 +763,7 @@ extern const struct ltc_cipher_descriptor multi2_desc; #endif #ifdef LTC_ECB_MODE -int ecb_start(int cipher, const unsigned char *key, +int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds, symmetric_ECB *ecb); int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_ECB *ecb); int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_ECB *ecb); @@ -771,7 +771,7 @@ int ecb_done(symmetric_ECB *ecb); #endif #ifdef LTC_CFB_MODE -int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, +int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, int num_rounds, symmetric_CFB *cfb); int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb); int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb); @@ -781,7 +781,7 @@ int cfb_done(symmetric_CFB *cfb); #endif #ifdef LTC_OFB_MODE -int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, +int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, int keylen, int num_rounds, symmetric_OFB *ofb); int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_OFB *ofb); int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_OFB *ofb); @@ -828,7 +828,7 @@ int lrw_start( int cipher, const unsigned char *IV, const unsigned char *key, int keylen, const unsigned char *tweak, - int num_rounds, + int num_rounds, symmetric_LRW *lrw); int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_LRW *lrw); int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw); @@ -839,11 +839,11 @@ int lrw_test(void); /* don't call */ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, int mode, symmetric_LRW *lrw); -#endif +#endif #ifdef LTC_F8_MODE -int f8_start( int cipher, const unsigned char *IV, - const unsigned char *key, int keylen, +int f8_start( int cipher, const unsigned char *IV, + const unsigned char *key, int keylen, const unsigned char *salt_key, int skeylen, int num_rounds, symmetric_F8 *f8); int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_F8 *f8); @@ -861,10 +861,10 @@ typedef struct { } symmetric_xts; int xts_start( int cipher, - const unsigned char *key1, - const unsigned char *key2, + const unsigned char *key1, + const unsigned char *key2, unsigned long keylen, - int num_rounds, + int num_rounds, symmetric_xts *xts); int xts_encrypt( diff --git a/crypto/tomcrypt_custom.h b/crypto/tomcrypt_custom.h index 0baf6fb2..2eb51545 100644 --- a/crypto/tomcrypt_custom.h +++ b/crypto/tomcrypt_custom.h @@ -20,19 +20,19 @@ /* macros for various libc functions you can change for embedded targets */ #ifndef XMALLOC - #ifdef malloc + #ifdef malloc #define LTC_NO_PROTOTYPES #endif #define XMALLOC malloc #endif #ifndef XREALLOC - #ifdef realloc + #ifdef realloc #define LTC_NO_PROTOTYPES #endif #define XREALLOC realloc #endif #ifndef XCALLOC - #ifdef calloc + #ifdef calloc #define LTC_NO_PROTOTYPES #endif #define XCALLOC calloc @@ -57,7 +57,7 @@ #define XMEMCPY memcpy #endif #ifndef XMEMCMP - #ifdef memcmp + #ifdef memcmp #define LTC_NO_PROTOTYPES #endif #define XMEMCMP memcmp @@ -91,19 +91,19 @@ #define LTC_DES #define LTC_DES3 #define LTC_CAST5 - + #define LTC_NO_MODES #define LTC_ECB_MODE #define LTC_CBC_MODE #define LTC_CTR_MODE - + #define LTC_NO_HASHES #define LTC_SHA1 #define LTC_SHA512 #define LTC_SHA384 #define LTC_SHA256 #define LTC_SHA224 - + #define LTC_NO_MACS #define LTC_HMAC #define LTC_OMAC @@ -114,11 +114,11 @@ #define LTC_YARROW #define LTC_DEVRANDOM #define TRY_URANDOM_FIRST - + #define LTC_NO_PK #define LTC_MRSA #define LTC_MECC -#endif +#endif /* Use small code where possible */ /* #define LTC_SMALL_CODE */ @@ -195,7 +195,7 @@ #define LTC_LRW_MODE #ifndef LTC_NO_TABLES /* like GCM mode this will enable 16 8x128 tables [64KB] that make - * seeking very fast. + * seeking very fast. */ #define LRW_TABLES #endif @@ -206,7 +206,7 @@ #endif /* LTC_NO_MODES */ /* ---> One-Way Hash Functions <--- */ -#ifndef LTC_NO_HASHES +#ifndef LTC_NO_HASHES #define LTC_CHC_HASH #define LTC_WHIRLPOOL @@ -253,7 +253,7 @@ /* Use 64KiB tables */ #ifndef LTC_NO_TABLES - #define LTC_GCM_TABLES + #define LTC_GCM_TABLES #endif /* USE SSE2? requires GCC works on x86_32 and x86_64*/ @@ -320,7 +320,7 @@ #define LTC_MRSA /* Include Katja (a Rabin variant like RSA) */ -/* #define MKAT */ +/* #define MKAT */ /* Digital Signature Algorithm */ #define LTC_MDSA @@ -333,7 +333,7 @@ #if defined(TFM_LTC_DESC) && defined(LTC_MECC) #define LTC_MECC_ACCEL -#endif +#endif /* do we want fixed point ECC */ /* #define LTC_MECC_FP */ @@ -377,9 +377,9 @@ #ifdef LTC_MRSA #define LTC_PKCS_1 -#endif +#endif -#if defined(LTC_DER) && !defined(MPI) +#if defined(LTC_DER) && !defined(MPI) #error ASN.1 DER requires MPI functionality #endif diff --git a/crypto/tomcrypt_hash.h b/crypto/tomcrypt_hash.h index ac1e7133..c3a3179e 100644 --- a/crypto/tomcrypt_hash.h +++ b/crypto/tomcrypt_hash.h @@ -166,7 +166,7 @@ extern struct ltc_hash_descriptor { @return CRYPT_OK if successful */ int (*init)(hash_state *hash); - /** Process a block of data + /** Process a block of data @param hash The hash state @param in The data to hash @param inlen The length of the data (octets) @@ -186,7 +186,7 @@ extern struct ltc_hash_descriptor { /* accelerated hmac callback: if you need to-do multiple packets just use the generic hmac_memory and provide a hash callback */ int (*hmac_block)(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, + const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); } hash_descriptor[]; @@ -329,8 +329,8 @@ int hash_is_valid(int idx); LTC_MUTEX_PROTO(ltc_hash_mutex) -int hash_memory(int hash, - const unsigned char *in, unsigned long inlen, +int hash_memory(int hash, + const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, const unsigned char *in, unsigned long inlen, ...); diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c index 8eb82f30..b353fbc1 100644 --- a/drivers/ipoe/ipoe.c +++ b/drivers/ipoe/ipoe.c @@ -82,7 +82,7 @@ struct ipoe_session { struct ipoe_network { struct rcu_head rcu_head; struct list_head entry; - + __be32 addr; __be32 mask; }; @@ -90,7 +90,7 @@ struct ipoe_network { struct ipoe_iface { struct rcu_head rcu_head; struct list_head entry; - + int ifindex; }; @@ -158,7 +158,7 @@ static inline int hash_addr(__be32 addr) return ((addr >> 24) ^ (addr >> 16)) & HASH_BITS; #else return (addr ^ (addr >> 8)) & HASH_BITS; -#endif +#endif } #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) @@ -202,7 +202,7 @@ static int ipoe_check_exclude(__be32 addr) struct ipoe_network *n; struct list_head *ht; int r = 0; - + ht = &ipoe_excl_list[hash_addr(addr)]; rcu_read_lock(); @@ -324,7 +324,7 @@ static int ipoe_do_nat(struct sk_buff *skb, __be32 new_addr, int to_peer) icmph = (void *)(skb_network_header(skb) + ihl); iph = (void *)(icmph + 1); - + if (skb_cloned(skb) && !skb_clone_writable(skb, ihl + sizeof(*icmph) + sizeof(*iph) + noff) && @@ -422,19 +422,19 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) if (!ses->peer_addr) goto drop; - + skb->tc_verd = SET_TC_NCLS(0); - + noff = skb_network_offset(skb); if (skb->protocol == htons(ETH_P_IP)) { if (!pskb_may_pull(skb, sizeof(*iph) + noff)) goto drop; - + iph = ip_hdr(skb); //pr_info("ipoe: xmit %08x %08x\n", iph->saddr, iph->daddr); - + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) ipoe_update_stats(skb, this_cpu_ptr(ses->tx_stats), ETH_HLEN); #else @@ -442,7 +442,7 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) stats->tx_bytes += skb->len - ETH_HLEN; #endif - + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30) dst = skb_dst(skb); #else @@ -470,9 +470,9 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) if (!ses->link_dev) { iph = ip_hdr(skb); - + ip_send_check(iph); - + if (ipoe_route4(skb)) goto drop; @@ -486,7 +486,7 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) #else skb->iif = dev->ifindex; #endif - + //pr_info("ipoe: xmit2 %08x %08x %p %p\n", iph->saddr, iph->daddr, dev, skb->dev); nf_reset(skb); secpath_reset(skb); @@ -498,17 +498,17 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } else { eth = (struct ethhdr *)skb->data; - + memcpy(eth->h_dest, ses->hwaddr, ETH_ALEN); memcpy(eth->h_source, ses->link_dev->dev_addr, ETH_ALEN); } } /*else if (skb->protocol == htons(ETH_P_ARP)) { if (!pskb_may_pull(skb, arp_hdr_len(dev) + noff)) goto drop; - + arp = arp_hdr(skb); arp_ptr = (unsigned char *)(arp + 1); - + if (arp->ar_op == htons(ARPOP_REQUEST)) { memcpy(&tip, arp_ptr + ETH_ALEN + 4 + ETH_ALEN, 4); if (tip == ses->addr) { @@ -516,14 +516,14 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) !skb_clone_writable(skb, arp_hdr_len(dev) + noff) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) goto drop; - + arp = arp_hdr(skb); arp_ptr = (unsigned char *)(arp + 1); memcpy(arp_ptr + ETH_ALEN + 4 + ETH_ALEN, &ses->peer_addr, 4); } } }*/ - + if (ses->link_dev) { cb_ptr = skb->cb + sizeof(skb->cb) - 2; *(__u16 *)cb_ptr = IPOE_MAGIC; @@ -548,7 +548,7 @@ static int ipoe_lookup1_u(__be32 addr, unsigned long *ts) struct ipoe_entry_u *e; struct list_head *head = &ipoe_list1_u[hash_addr(addr)]; int r = 0; - + rcu_read_lock(); list_for_each_entry_rcu(e, head, entry1) { @@ -586,14 +586,14 @@ static void ipoe_queue_u(struct sk_buff *skb, __u32 addr) //pr_info("not queue %08x\n", addr); return; } - + if (skb_queue_len(&ipoe_queue) > IPOE_QUEUE_LEN) return; skb = skb_clone(skb, GFP_ATOMIC); if (!skb) return; - + //pr_info("queue %08x\n", addr); skb_queue_tail(&ipoe_queue, skb); @@ -620,9 +620,9 @@ static void ipoe_process_queue(struct work_struct *w) while ((skb = skb_dequeue(&ipoe_queue))) { eth = eth_hdr(skb); iph = ip_hdr(skb); - + e = ipoe_lookup2_u(iph->saddr); - + if (!e) { e = kmalloc(sizeof(*e), GFP_KERNEL); e->addr = iph->saddr; @@ -630,7 +630,7 @@ static void ipoe_process_queue(struct work_struct *w) list_add_tail_rcu(&e->entry1, &ipoe_list1_u[hash_addr(iph->saddr)]); list_add_tail(&e->entry2, &ipoe_list2_u); - + //pr_info("create %08x\n", e->addr); } else if (jiffies_to_msecs(jiffies - e->tstamp) < IPOE_RATE_U) { //pr_info("skip %08x\n", e->addr); @@ -656,7 +656,7 @@ static void ipoe_process_queue(struct work_struct *w) ns = nla_nest_start(report_skb, id++); if (!ns) goto nl_err; - + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) if (nla_put_u32(report_skb, IPOE_ATTR_IFINDEX, skb->dev ? skb->dev->ifindex : skb->skb_iif)) #else @@ -688,10 +688,10 @@ nl_err: nlmsg_free(report_skb); report_skb = NULL; } - + kfree_skb(skb); } - + while (!list_empty(&ipoe_list2_u)) { e = list_entry(ipoe_list2_u.next, typeof(*e), entry2); if (jiffies_to_msecs(jiffies - e->tstamp) < IPOE_TIMEOUT_U * 1000) @@ -731,7 +731,7 @@ static struct ipoe_session *ipoe_lookup(__be32 addr) struct list_head *head; head = &ipoe_list[hash_addr(addr)]; - + rcu_read_lock(); list_for_each_entry_rcu(ses, head, entry) { @@ -769,28 +769,28 @@ static unsigned int ipt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *s if (*(__u16 *)cb_ptr == IPOE_MAGIC) return NF_ACCEPT; - + noff = skb_network_offset(skb); if (!pskb_may_pull(skb, sizeof(*iph) + noff)) return NF_ACCEPT; - + iph = ip_hdr(skb); if (!iph->saddr) return NF_ACCEPT; //pr_info("ipoe: recv %08x %08x\n", iph->saddr, iph->daddr); - + ses = ipoe_lookup(iph->saddr); - + if (!ses) { if (ipoe_check_exclude(iph->saddr)) return NF_ACCEPT; if (!ipoe_check_network(iph->saddr)) return NF_ACCEPT; - + if (!ipoe_check_interface(in->ifindex)) return NF_ACCEPT; @@ -799,7 +799,7 @@ static unsigned int ipt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *s } stats = &ses->dev->stats; - + if (ses->link_dev) { eth = eth_hdr(skb); if (memcmp(eth->h_source, ses->hwaddr, ETH_ALEN)) { @@ -807,7 +807,7 @@ static unsigned int ipt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *s goto out; } } - + if (skb->dev == ses->dev) { ret = NF_ACCEPT; goto out; @@ -817,7 +817,7 @@ static unsigned int ipt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *s ret = NF_ACCEPT; goto out; } - + skb1 = skb_clone(skb, GFP_ATOMIC); if (!skb1) { stats->rx_dropped++; @@ -842,7 +842,7 @@ static unsigned int ipt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *s //skb1->tc_verd = SET_TC_NCLS(0); netif_rx(skb1); - + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) ipoe_update_stats(skb, this_cpu_ptr(ses->rx_stats), 0); #else @@ -868,7 +868,7 @@ static unsigned int ipt_out_hook(const struct nf_hook_ops *ops, struct sk_buff * if (skb->protocol != htons(ETH_P_IP)) return NF_ACCEPT; - + cb_ptr = skb->cb + sizeof(skb->cb) - 2; if (*(__u16 *)cb_ptr == IPOE_MAGIC) return NF_ACCEPT; @@ -877,15 +877,15 @@ static unsigned int ipt_out_hook(const struct nf_hook_ops *ops, struct sk_buff * if (!pskb_may_pull(skb, sizeof(*iph) + noff)) return NF_ACCEPT; - + iph = ip_hdr(skb); - + if (ipoe_check_exclude(iph->daddr)) return NF_ACCEPT; - + if (!ipoe_check_network(iph->daddr)) return NF_ACCEPT; - + if (ipoe_check_network(iph->saddr)) return NF_ACCEPT; @@ -898,15 +898,15 @@ static unsigned int ipt_out_hook(const struct nf_hook_ops *ops, struct sk_buff * #else iif = skb->iif; #endif - + if (iif == ses->dev->ifindex) { atomic_dec(&ses->refs); return NF_ACCEPT; } - + skb->dev = ses->dev; atomic_dec(&ses->refs); - + return NF_ACCEPT; } @@ -944,20 +944,20 @@ static int vlan_pt_recv(struct sk_buff *skb, struct net_device *dev, struct pack if (vid == -1) goto out; - + //pr_info("queue %i %i\n", dev->ifindex, vid); - + n = kmalloc(sizeof(*n), GFP_ATOMIC); if (!n) goto out; - + n->ifindex = dev->ifindex; n->vid = vid; spin_lock(&vlan_lock); list_add_tail(&n->entry, &vlan_notifies); spin_unlock(&vlan_lock); - + schedule_work(&vlan_notify_work); out: @@ -988,7 +988,7 @@ static void vlan_do_notify(struct work_struct *w) if (!n) break; - + if (!report_skb) { report_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) @@ -999,7 +999,7 @@ static void vlan_do_notify(struct work_struct *w) } //pr_info("notify %i vlan %i\n", id, n->vid); - + ns = nla_nest_start(report_skb, id++); if (!ns) goto nl_err; @@ -1017,7 +1017,7 @@ static void vlan_do_notify(struct work_struct *w) if (nla_put_u32(report_skb, IPOE_ATTR_ADDR, n->vid)) #endif goto nl_err; - + if (nla_nest_end(report_skb, ns) >= IPOE_NLMSG_SIZE) { genlmsg_end(report_skb, header); #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) @@ -1066,7 +1066,7 @@ static struct rtnl_link_stats64 *ipoe_stats64(struct net_device *dev, packets = st->packets; bytes = st->bytes; } while (u64_stats_fetch_retry_bh(&st->sync, start)); - + rx_packets += packets; rx_bytes += bytes; @@ -1077,7 +1077,7 @@ static struct rtnl_link_stats64 *ipoe_stats64(struct net_device *dev, packets = st->packets; bytes = st->bytes; } while (u64_stats_fetch_retry_bh(&st->sync, start)); - + tx_packets += packets; tx_bytes += bytes; } @@ -1104,7 +1104,7 @@ static void ipoe_free_netdev(struct net_device *dev) if (ses->tx_stats) free_percpu(ses->tx_stats); #endif - + free_netdev(dev); } @@ -1181,7 +1181,7 @@ static int ipoe_create(__be32 peer_addr, __be32 addr, const char *link_ifname, c r = -ENOMEM; goto failed_free; } - + ses = netdev_priv(dev); atomic_set(&ses->refs, 0); ses->dev = dev; @@ -1197,7 +1197,7 @@ static int ipoe_create(__be32 peer_addr, __be32 addr, const char *link_ifname, c goto failed_free; } #endif - + if (link_dev) { dev->features = link_dev->features; memcpy(dev->dev_addr, link_dev->dev_addr, ETH_ALEN); @@ -1208,7 +1208,7 @@ static int ipoe_create(__be32 peer_addr, __be32 addr, const char *link_ifname, c dev->flags |= IFF_NOARP; else dev->flags &= ~IFF_NOARP; - + in_dev = __in_dev_get_rtnl(dev); if (in_dev) { if (addr == 1) @@ -1333,7 +1333,7 @@ static int ipoe_nl_cmd_create(struct sk_buff *skb, struct genl_info *info) } //pr_info("ipoe: create %08x %08x %s\n", peer_addr, addr, info->attrs[IPOE_ATTR_IFNAME] ? ifname : "-"); - + ret = ipoe_create(peer_addr, addr, info->attrs[IPOE_ATTR_IFNAME] ? ifname : NULL, hwaddr); if (ret < 0) { @@ -1369,7 +1369,7 @@ static int ipoe_nl_cmd_delete(struct sk_buff *skb, struct genl_info *info) if (!info->attrs[IPOE_ATTR_IFINDEX]) return -EINVAL; - + ifindex = nla_get_u32(info->attrs[IPOE_ATTR_IFINDEX]); down(&ipoe_wlock); @@ -1391,11 +1391,11 @@ static int ipoe_nl_cmd_delete(struct sk_buff *skb, struct genl_info *info) if (r) goto out_unlock; - + ses = netdev_priv(dev); //pr_info("ipoe: delete %08x\n", ses->peer_addr); - + if (ses->peer_addr) list_del_rcu(&ses->entry); list_del(&ses->entry2); @@ -1453,7 +1453,7 @@ static int ipoe_nl_cmd_modify(struct sk_buff *skb, struct genl_info *info) if (r) goto out_unlock; - + ses = netdev_priv(dev); if (info->attrs[IPOE_ATTR_PEER_ADDR]) { @@ -1473,7 +1473,7 @@ static int ipoe_nl_cmd_modify(struct sk_buff *skb, struct genl_info *info) list_del_rcu(&ses->entry); synchronize_rcu(); } - + ses->peer_addr = peer_addr; if (peer_addr) @@ -1482,7 +1482,7 @@ static int ipoe_nl_cmd_modify(struct sk_buff *skb, struct genl_info *info) if (info->attrs[IPOE_ATTR_IFNAME]) { nla_strlcpy(ifname, info->attrs[IPOE_ATTR_IFNAME], IFNAMSIZ - 1); - + if (*ifname) { link_dev = dev_get_by_name(&init_net, ifname); @@ -1490,7 +1490,7 @@ static int ipoe_nl_cmd_modify(struct sk_buff *skb, struct genl_info *info) goto out_unlock; } else link_dev = NULL; - + old_dev = ses->link_dev; ses->link_dev = link_dev; @@ -1539,7 +1539,7 @@ static int fill_info(struct sk_buff *skb, struct ipoe_session *ses, u32 pid, u32 hdr = genlmsg_put(skb, pid, seq, &ipoe_nl_family, NLM_F_MULTI, IPOE_CMD_GET); if (!hdr) return -EMSGSIZE; - + if (nla_put_u32(skb, IPOE_ATTR_IFINDEX, ses->dev->ifindex) || nla_put_u32(skb, IPOE_ATTR_PEER_ADDR, ses->peer_addr) || nla_put_u32(skb, IPOE_ATTR_ADDR, ses->addr)) @@ -1587,7 +1587,7 @@ static int ipoe_nl_cmd_add_net(struct sk_buff *skb, struct genl_info *info) if (!info->attrs[IPOE_ATTR_ADDR] || !info->attrs[IPOE_ATTR_MASK]) return -EINVAL; - + n = kmalloc(sizeof(*n), GFP_KERNEL); if (!n) return -ENOMEM; @@ -1640,7 +1640,7 @@ static int ipoe_nl_cmd_add_exclude(struct sk_buff *skb, struct genl_info *info) if (!info->attrs[IPOE_ATTR_ADDR]) return -EINVAL; - + n = kmalloc(sizeof(*n), GFP_KERNEL); if (!n) return -ENOMEM; @@ -1687,7 +1687,7 @@ static int ipoe_nl_cmd_del_exclude(struct sk_buff *skb, struct genl_info *info) if (!info->attrs[IPOE_ATTR_ADDR]) return -EINVAL; - + addr = nla_get_u32(info->attrs[IPOE_ATTR_ADDR]); if (!addr) { clean_excl_list(); @@ -1710,7 +1710,7 @@ static int ipoe_nl_cmd_del_exclude(struct sk_buff *skb, struct genl_info *info) } rcu_read_unlock(); up(&ipoe_wlock); - + synchronize_rcu(); return 0; @@ -1722,7 +1722,7 @@ static int ipoe_nl_cmd_add_interface(struct sk_buff *skb, struct genl_info *info if (!info->attrs[IPOE_ATTR_IFINDEX]) return -EINVAL; - + i = kmalloc(sizeof(*i), GFP_KERNEL); if (!i) return -ENOMEM; @@ -1773,9 +1773,9 @@ static int ipoe_nl_cmd_add_vlan_mon(struct sk_buff *skb, struct genl_info *info) if (!info->attrs[IPOE_ATTR_IFINDEX]) return -EINVAL; - + ifindex = nla_get_u32(info->attrs[IPOE_ATTR_IFINDEX]); - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) rtnl_lock(); dev = __dev_get_by_index(&init_net, ifindex); @@ -2122,10 +2122,10 @@ static int __init ipoe_init(void) INIT_LIST_HEAD(&ipoe_list1_u[i]); INIT_LIST_HEAD(&ipoe_excl_list[i]); } - + skb_queue_head_init(&ipoe_queue); INIT_WORK(&ipoe_queue_work, ipoe_process_queue); - + INIT_WORK(&vlan_notify_work, vlan_do_notify); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) @@ -2170,7 +2170,7 @@ static int __init ipoe_init(void) printk(KERN_INFO "ipoe: can't register nf hooks\n"); goto out_unreg; } - + dev_add_pack(&vlan_pt); return 0; @@ -2190,7 +2190,7 @@ static void __exit ipoe_fini(void) struct vlan_notify *vn; struct net_device *dev; int i; - + dev_remove_pack(&vlan_pt); nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops)); @@ -2209,16 +2209,16 @@ static void __exit ipoe_fini(void) for (i = 0; i <= HASH_BITS; i++) rcu_assign_pointer(ipoe_list[i].next, &ipoe_list[i]); - + rcu_barrier(); while (!list_empty(&ipoe_list2)) { ses = list_entry(ipoe_list2.next, typeof(*ses), entry2); list_del(&ses->entry2); - + if (ses->link_dev) dev_put(ses->link_dev); - + unregister_netdev(ses->dev); } @@ -2252,7 +2252,7 @@ static void __exit ipoe_fini(void) call_rcu(&d->rcu_head, ipoe_kfree_rcu); #endif } - + while (!list_empty(&vlan_notifies)) { vn = list_first_entry(&vlan_notifies, typeof(*vn), entry); list_del(&vn->entry); diff --git a/drivers/pptp/gre.c b/drivers/pptp/gre.c index 77886d5d..a3c9625a 100644 --- a/drivers/pptp/gre.c +++ b/drivers/pptp/gre.c @@ -23,7 +23,7 @@ int gre_add_protocol(struct gre_protocol *proto, u8 version) if (version >= GREPROTO_MAX) return -EINVAL; - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) write_lock_bh(&gre_proto_lock); #else @@ -96,7 +96,7 @@ static int gre_rcv(struct sk_buff *skb) ver = skb->data[1]&0x7f; if (ver >= GREPROTO_MAX) goto drop_nolock; - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) read_lock(&gre_proto_lock); proto = gre_proto[ver]; @@ -139,7 +139,7 @@ static void gre_err(struct sk_buff *skb, u32 info) ver=skb->data[1]&0x7f; if (ver>=GREPROTO_MAX) goto drop_nolock; - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) read_lock(&gre_proto_lock); proto = gre_proto[ver]; diff --git a/drivers/pptp/pptp.c b/drivers/pptp/pptp.c index 78853fcb..3226bdf1 100644 --- a/drivers/pptp/pptp.c +++ b/drivers/pptp/pptp.c @@ -253,7 +253,7 @@ static struct pppox_sock * lookup_chan(u16 call_id, __be32 s_addr) #else read_unlock(&chan_lock); #endif - + return sock; } @@ -266,13 +266,13 @@ static int lookup_chan_dst(u16 call_id, __be32 d_addr) struct pppox_sock *sock; struct pptp_opt *opt; int i; - + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) rcu_read_lock(); #else down(&chan_lock); #endif - for(i = find_next_bit(callid_bitmap,MAX_CALLID,1); i < MAX_CALLID; + for(i = find_next_bit(callid_bitmap,MAX_CALLID,1); i < MAX_CALLID; i = find_next_bit(callid_bitmap, MAX_CALLID, i + 1)){ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) sock = rcu_dereference(callid_sock[i]); @@ -289,7 +289,7 @@ static int lookup_chan_dst(u16 call_id, __be32 d_addr) #else up(&chan_lock); #endif - + return i<MAX_CALLID; } @@ -303,7 +303,7 @@ static int add_chan(struct pppox_sock *sock) #else write_lock_bh(&chan_lock); #endif - + if (!sock->proto.pptp.src_addr.call_id) { call_id=find_next_zero_bit(callid_bitmap,MAX_CALLID,call_id+1); @@ -313,7 +313,7 @@ static int add_chan(struct pppox_sock *sock) } else if (test_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap)) goto exit; - + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) rcu_assign_pointer(callid_sock[sock->proto.pptp.src_addr.call_id],sock); #else @@ -322,7 +322,7 @@ static int add_chan(struct pppox_sock *sock) set_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap); res=0; -exit: +exit: #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) spin_unlock(&chan_lock); #else @@ -362,8 +362,8 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) int len; unsigned char *data; u32 seq_recv; - - + + struct rtable *rt; /* Route to the other host */ struct net_device *tdev; /* Device to other host */ struct iphdr *iph; /* Our new IP header */ @@ -444,11 +444,11 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) data[0]=PPP_ALLSTATIONS; data[1]=PPP_UI; } - + len=skb->len; - + seq_recv = opt->seq_recv; - + if (opt->ack_sent == seq_recv) header_len-=sizeof(hdr->ack); // Push down and install GRE header @@ -581,7 +581,7 @@ static int pptp_rcv_core(struct sock *sk,struct sk_buff *skb) goto drop; return NET_RX_SUCCESS; } - + header = (struct pptp_gre_header *)(skb->data); /* test if acknowledgement present */ @@ -745,15 +745,15 @@ static int pptp_rcv(struct sk_buff *skb) bh_unlock_sock(sk); sock_put(sk); return ret; - + #else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */ - + #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,19) return sk_receive_skb(sk_pppox(po), skb); #else return sk_receive_skb(sk_pppox(po), skb, 0); #endif - + #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */ }else { #ifdef DEBUG @@ -775,7 +775,7 @@ static int pptp_bind(struct socket *sock,struct sockaddr *uservaddr,int sockaddr struct pptp_opt *opt=&po->proto.pptp; int error=0; -#ifdef DEBUG +#ifdef DEBUG if (log_level>=1) printk(KERN_INFO"PPTP: bind: addr=%X call_id=%i\n",sp->sa_addr.pptp.sin_addr.s_addr, sp->sa_addr.pptp.call_id); @@ -809,13 +809,13 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, if (sp->sa_protocol != PX_PROTO_PPTP) return -EINVAL; - + #ifdef DEBUG if (log_level>=1) printk(KERN_INFO"PPTP[%i]: connect: addr=%X call_id=%i\n",opt->src_addr.call_id, sp->sa_addr.pptp.sin_addr.s_addr,sp->sa_addr.pptp.call_id); #endif - + if (lookup_chan_dst(sp->sa_addr.pptp.call_id,sp->sa_addr.pptp.sin_addr.s_addr)) return -EALREADY; @@ -948,7 +948,7 @@ static int pptp_release(struct socket *sock) release_sock(sk); return -EBADF; } - + po = pppox_sk(sk); opt=&po->proto.pptp; del_chan(po); @@ -1213,7 +1213,7 @@ static int __init pptp_init_module(void) printk(KERN_INFO "PPTP: can't register pppox_proto\n"); goto out_unregister_sk_proto; } - + return 0; out_unregister_sk_proto: #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) @@ -1233,7 +1233,7 @@ out_inet_del_protocol: #endif out_free_mem: vfree(callid_sock); - + return err; } |