X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=5a0939fc8e1bb265e3cddb5266c256d1241447bf;hp=a4dd301d7689cc257ea50ce2327d888ee3bd381b;hb=ad4cb1299f009eb3885b2feb7a26851b5e57dac6;hpb=19a47f603bbdb622e8bcfddcef7b08fc5ad7f146 diff --git a/prometheus.c b/prometheus.c index a4dd301..5a0939f 100644 --- a/prometheus.c +++ b/prometheus.c @@ -7,7 +7,7 @@ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Modified by: xChaos, 20110221 +/* Modified by: xChaos, 20110428 ludva, 20080415 Prometheus QoS is free software; you can redistribute it and/or @@ -40,7 +40,7 @@ const char *version = "0.8.3"; /* C source code development versions ("beta"): 0.7.9-a, 0.8.1-b, etc. */ /* C source code release versions: 0.8.0, 0.8.2, 0.8.4, etc. */ -const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2008 Michael Polak, Arachne Labs
\n"; +const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2011 Michael Polak, Arachne Labs
\n"; /* ======= All path names are defined here (for RPM patch) ======= */ @@ -85,6 +85,7 @@ void help(void) -s start shaping! (keep data transfer statistics - but apply shaping)\n\ */ } + /* === Configuraration file values defaults - stored in global variables ==== */ int filter_type = 1; /*1 mark, 2 classify*/ @@ -104,6 +105,7 @@ char *wan_medium = "100Mbit"; /* 10Mbit/100Mbit ethernet */ char *qos_leaf = "sfq perturb 5"; /* leaf discipline */ char *qos_free_zone = NULL; /* QoS free zone */ int qos_proxy = 1; /* include proxy port to QoS */ +int found_lmsid = 0; /* show links to users in LMS information system */ int include_upload = 1; /* upload+download=total traffic */ char *proxy_ip = "192.168.1.1/32"; /* our IP with proxy port */ int proxy_port = 3128; /* proxy port number */ @@ -134,7 +136,7 @@ const int idxtable_treshold2 = 12; /* this is no longer configurable */ const int idxtable_bitmask1 = 3; /* this is no longer configurable */ const int idxtable_bitmask2 = 3; /* this is no longer configurable */ -/* ==== This is C<<1 stuff - learn C<<1 first! http://cll1.arachne.cz ==== */ +/* ==== This is C<<1 stuff - learn C<<1 first! https://dev.arachne.cz/svn/cll1h ==== */ struct IP { @@ -148,6 +150,7 @@ struct IP int prio; int fixedprio; int group; + int lmsid; unsigned long long direct; unsigned long long proxy; unsigned long long upload; @@ -209,7 +212,8 @@ void TheIP(void) ip->addr = ""; ip->sharing = NULL; ip->prio = highest_priority+1; - ip->fixedprio = 0; + ip->lmsid = -1; + ip->fixedprio = \ ip->mark = \ ip->min = \ ip->max = \ @@ -237,10 +241,14 @@ char *very_ugly_ipv4_code(char *inip,int bitmask,int format_as_chainname) /* debug printf("(%s,%d) -> ",ip,bitmask); */ if(ip && *ip && bitmask>=0 && bitmask<=32) + { string(outip,strlen(ip)+10); /*fuck unicode? assertion: 10>strlen("_%d_%d") */ + } else + { /* should never exit here */ return "undefined"; + } outptr=outip; while(ip && *ip) { @@ -249,9 +257,13 @@ char *very_ugly_ipv4_code(char *inip,int bitmask,int format_as_chainname) if(dot<(bitmask/8-1)) { if(format_as_chainname) + { *outptr='_'; + } else + { *outptr='.'; + } outptr++; dot++; } @@ -292,10 +304,14 @@ char *very_ugly_ipv4_code(char *inip,int bitmask,int format_as_chainname) } char *hash_id(char *ip,int bitmask) -{ return very_ugly_ipv4_code(ip,bitmask,1); } +{ + return very_ugly_ipv4_code(ip,bitmask,1); +} char *subnet_id(char *ip,int bitmask) -{ return very_ugly_ipv4_code(ip,bitmask,0); } +{ + return very_ugly_ipv4_code(ip,bitmask,0); +} /* ================= Let's parse configuration file here =================== */ @@ -327,9 +343,6 @@ void get_config(char *config_filename) keyword->fixed_prio=0; /* fixed data limit for setting lower HTB prio */ keyword->reserve_min=8; /* bonus for nominal HTB rate bandwidth (in kbps) */ keyword->reserve_max=0; /* malus for nominal HTB ceil (in kbps) */ -/* obsolete: - keyword->divide_max=0; relative malus: new_ceil=rate+(old_ceil-rate)/divide_max - keyword->htb_ceil_bonus_divide=0; relative bonus: new_ceil=old_ceil+old_ceil/htb_ceil_bonus_divide */ keyword->default_prio=highest_priority+1; keyword->html_color="000000"; keyword->ip_count=0; @@ -347,7 +360,6 @@ void get_config(char *config_filename) { int l=strlen(keyword->key); - if(!strncmp(keyword->key,_,l) && strlen(_)>l+2) { char *tmptr=_; /* <---- l+1 ----> */ @@ -361,17 +373,15 @@ void get_config(char *config_filename) ioption("htb-default-prio",keyword->default_prio); ioption("htb-rate-bonus",keyword->reserve_min); ioption("htb-ceil-malus",keyword->reserve_max); - /* obsolete: - ioption("htb-ceil-divide",keyword->divide_max); - ioption("htb-ceil-bonus-divide",keyword->htb_ceil_bonus_divide); - */ option("leaf-discipline",keyword->leaf_discipline); option("html-color",keyword->html_color); _=tmptr; if(keyword->data_limit || keyword->fixed_limit || keyword->data_prio || keyword->fixed_prio) - use_credit=1; + { + use_credit=1; + } } } } @@ -437,14 +447,17 @@ void get_config(char *config_filename) } } - if (strcmpi(cnf, "mark")){ - filter_type = 2; - mark = "CLASSIFY"; - mark_iptables = "CLASSIFY --set-class 1:"; - }else{ - filter_type = 1; - mark = "MARK"; - mark_iptables = "MARK --set-mark "; + if (strcmpi(cnf, "mark")) + { + filter_type = 2; + mark = "CLASSIFY"; + mark_iptables = "CLASSIFY --set-class 1:"; + } + else + { + filter_type = 1; + mark = "MARK"; + mark_iptables = "MARK --set-mark "; } /* are supplied values meaningful ?*/ @@ -524,8 +537,14 @@ void get_traffic_statistics(void) if(accept && traffic>0 && ipaddr) { - if(proxyflag)printf("(proxy) "); - else if(!downloadflag) printf("(upload) "); + if(proxyflag) + { + printf("(proxy) "); + } + else if(!downloadflag) + { + printf("(upload) "); + } printf("IP %s: %Lu M (%ld pkts)\n", ipaddr, traffic, pkts); if_exists(ip,ips,eq(ip->addr,ipaddr)); @@ -544,9 +563,13 @@ void get_traffic_statistics(void) if(downloadflag) { if(proxyflag) + { ip->proxy=traffic; + } else + { ip->traffic+=traffic; + } ip->direct=ip->traffic-ip->upload-ip->proxy; ip->pktsdown=pkts; } @@ -555,10 +578,16 @@ void get_traffic_statistics(void) ip->upload=traffic; ip->pktsup=pkts; if(include_upload) + { ip->traffic+=traffic; + } else + { if(traffic>ip->traffic) + { ip->traffic=traffic; + } + } } } } @@ -570,8 +599,18 @@ void get_traffic_statistics(void) void safe_run(char *cmd) { - if(dry_run) printf("\n=>%s\n",cmd); else system(cmd); - if(log_file) fprintf(log_file,"%s\n",cmd); + if(dry_run) + { + printf("\n=>%s\n",cmd); + } + else + { + system(cmd); + } + if(log_file) + { + fprintf(log_file,"%s\n",cmd); + } } void save_line(char *line) @@ -592,11 +631,11 @@ void run_restore(void) fclose(iptables_file); if(dry_run) { - parse(iptablesfile) - { - str=_; - printf("%s\n", str); - }done; + parse(iptablesfile) + { + printf("%s\n",_); + } + done; } sprintf(restor,"%s <%s",iptablesrestore, iptablesfile); @@ -607,21 +646,39 @@ void run_restore(void) /* == This function strips extra characters after IP address and stores it = */ -void parse_ip(char *str) +void parse_ip(struct IP *ip, char *str) { - char *ptr=str,*ipaddr=NULL,*ipname=NULL;; + char *ptr,*ipaddr=NULL,*ipname=NULL,*lmsid=NULL; + + ptr=strchr(str,'{'); + if(ptr) + { + lmsid=++ptr; + while(*ptr && *ptr!='}') + { + ptr++; + } + *ptr=0; + } + ptr=str; while(*ptr && *ptr!=' ' && *ptr!=9) + { ptr++; + } *ptr=0; ipaddr=str; ptr++; while(*ptr && (*ptr==' ' || *ptr==9)) + { ptr++; + } ipname=ptr; while(*ptr && *ptr!=' ' && *ptr!=9) + { ptr++; + } *ptr=0; if_exists(ip,ips,eq(ip->addr,ipaddr)); @@ -631,6 +688,11 @@ void parse_ip(char *str) } ip->addr=ipaddr; ip->name=ipname; + if(lmsid) + { + ip->lmsid=atoi(lmsid); + found_lmsid=1; + } } char *parse_datafile_line(char *str) @@ -644,7 +706,9 @@ char *parse_datafile_line(char *str) return ptr; } else + { return NULL; + } } struct IpLog @@ -653,6 +717,7 @@ struct IpLog long traffic; long guaranted; int i; + int lmsid; long l; list(IpLog); } *iplog,*iplogs; @@ -661,7 +726,7 @@ void parse_ip_log(int argc, char **argv) { char *month, *year, *str, *name="(undefined)", *ptr, *ptr2, *filename; long traffic=0l, traffic_month, total=0, guaranted; - int col, col2, y_ok, m_ok, accept_month, i=1, any_month=0; + int col, col2, y_ok, m_ok, accept_month, i=1, any_month=0, lmsid; char mstr[4], ystr[5]; FILE *f; string(str,STRLEN); @@ -716,7 +781,8 @@ void parse_ip_log(int argc, char **argv) printf("Parsing %s ...",filename); accept_month=0; traffic_month=0; - guaranted = 0; + guaranted=0; + lmsid=-1; parse(filename) { y_ok=m_ok=0; @@ -724,11 +790,12 @@ void parse_ip_log(int argc, char **argv) { case 2: name = ptr;break; case 3: traffic = atol(ptr);break; - /* column number - was 7, now 10...*/ + /* column number - was 7, now 11...*/ case 7: case 8: case 9: - case 10: if (isalpha(*ptr)) /* character, not numeric string = date, just one*/ + case 10: + case 11: if (isalpha(*ptr)) /* character, not numeric string = date, just one*/ { valid_columns(ptr2,ptr,' ',col2) switch(col2) { @@ -739,6 +806,7 @@ void parse_ip_log(int argc, char **argv) else { if(col == 7) guaranted = atol(ptr); + if(col == 10) lmsid = atoi(ptr); } } @@ -756,6 +824,7 @@ void parse_ip_log(int argc, char **argv) iplog->name = name; iplog->guaranted = guaranted; iplog->traffic = traffic_month; + iplog->lmsid = lmsid; insert(iplog,iplogs,desc_order_by,traffic); printf(" %ld MB\n",iplog->traffic); } @@ -770,20 +839,30 @@ void parse_ip_log(int argc, char **argv) f=fopen(str,"w"); if(f) { - fprintf(f,"\n ",month,year); + fprintf(f,"
%s %sData transfersMin.speed
\n ",month,year); for_each(iplog,iplogs) { if(iplog->traffic) { - fprintf(f,"\n", - i++, iplog->name, iplog->traffic, iplog->traffic>>10, iplog->guaranted); + fprintf(f,"\n", + iplog->traffic, iplog->traffic>>10, iplog->guaranted); total+=iplog->traffic>>10; iplog->i=i; iplog->l=total; } } - fprintf(f,"\n", total, line); + fprintf(f,"\n", total, line); fputs("
%s %slmsData transfersMin.speed
%d%s%ld M%ld G%ld kbps
%d%s", i++, iplog->name); + if(iplog->lmsid > 0) + { + /*base URL will be configurable soon ... */ + fprintf(f,"%04d\n", iplog->lmsid, iplog->lmsid); + } + else if(iplog->lmsid == 0) + { + fputs("-------",f); + } + fprintf(f,"%ld M%ld G%ld kbps
Total:%ld GB%Ld kbps
Total:%ld GB%Ld kbps
\n", f); if(i>10) @@ -874,7 +953,7 @@ program printf("\n\ Prometheus QoS - \"fair-per-IP\" Quality of Service setup utility.\n\ -Version %s - Copyright (C)2005-2008 Michael Polak (xChaos)\n\ +Version %s - Copyright (C)2005-2011 Michael Polak (xChaos)\n\ iptables-restore & burst tunning & classify modification by Ludva\n\ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); @@ -944,19 +1023,24 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); str=_; if(*str<'0' || *str>'9') + { + /* any line starting with non-number is comment ...*/ continue; + } //Does this IP share QoS class with some other ? substring=strstr(str,"sharing-"); if(substring) { substring+=8; //"sharing-" - parse_ip(str); + parse_ip(ip, str); ip_count++; ip->sharing=substring; ip->keyword=defaultkeyword; /* settings for default keyword */ while(*substring && *substring!='\n') + { substring++; + } *substring=0; } else @@ -965,7 +1049,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if_exists(keyword,keywords,(substring=strstr(str,keyword->key))) { - parse_ip(str); + parse_ip(ip, str); ip_count++; ip->keyword=keyword; keyword->ip_count++; @@ -973,7 +1057,9 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); substring+=strlen(keyword->key)+1; ptr=substring; while(*ptr && *ptr!='-') + { ptr++; + } if(*ptr=='-') { *ptr=0; @@ -993,15 +1079,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); else { ip->max-=ip->keyword->reserve_max; - -/* - if(ip->keyword->divide_max>1) - ip->max=ip->min+(ip->max-ip->min)/ip->keyword->divide_max; - if(ip->keyword->htb_ceil_bonus_divide>0) - ip->max+=ip->max/ip->keyword->htb_ceil_bonus_divide; -*/ if(ip->maxmin) + { ip->max=ip->min; + } } ip->mark=FIRSTIPCLASS+1+class_count++; @@ -1052,10 +1133,13 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); sharedip->traffic+=ip->traffic; ip->traffic=0; ip->mark=sharedip->mark; + ip->lmsid=sharedip->lmsid; break; } if(!sharedip) + { printf("Unresolved shared connection: %s %s sharing-%s\n",ip->addr,ip->name,ip->sharing); + } } if(enable_credit && just_flush<9) @@ -1084,13 +1168,15 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /*-----------------------------------------------------------------*/ iptables_file=fopen(iptablesfile,"w"); - if (iptables_file == NULL) { + if (iptables_file == NULL) + { puts("Cannot open iptablesfile!"); exit(-1); } log_file=fopen(cmdlog,"w"); - if (log_file == NULL) { + if (log_file == NULL) + { puts("Cannot open logfile!"); exit(-1); } @@ -1127,7 +1213,9 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); chain="post_noproxy"; } else + { chain="POSTROUTING"; + } sprintf(str,"-A %s -s %s -o %s -j ACCEPT", chain, qos_free_zone, lan); save_line(str); @@ -1197,7 +1285,6 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); sort(idx,idxs,order_by,bitmask); i=0; - for_each(idx,idxs) { subnet=subnet_id(idx->addr,idx->bitmask); @@ -1215,7 +1302,9 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); sprintf(buf,"post_%s",idx->parent->id); } else + { buf="POSTROUTING"; + } sprintf(str,"-A %s -d %s/%d -o %s -j post_%s", buf, subnet, idx->bitmask, lan, idx->id); save_line(str); @@ -1229,7 +1318,9 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); sprintf(buf,"forw_%s",idx->parent->id); } else + { buf="FORWARD"; + } sprintf(str,"-A %s -s %s/%d -o %s -j forw_%s", buf, subnet, idx->bitmask, wan, idx->id); save_line(str); @@ -1290,8 +1381,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /*-----------------------------------------------------------------*/ puts("Locating heavy downloaders and generating root classes ..."); /*-----------------------------------------------------------------*/ - sort(ip,ips,desc_order_by,traffic); - + sort(ip,ips,desc_order_by,traffic); /*-----------------------------------------------------------------*/ /* sub-scope - local variables */ @@ -1301,7 +1391,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); int group_count=0; FILE *credit_file=NULL; - if(!just_preview && !dry_run && enable_credit) credit_file=fopen(credit,"w"); + if(!just_preview && !dry_run && enable_credit) + { + credit_file=fopen(credit,"w"); + } for_each(group,groups) { @@ -1318,10 +1411,16 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); safe_run(str); } - if(group_count++id; + if(group_count++id; + } rate-=digital_divide*group->min; - if(ratemin)rate=group->min; + if(ratemin) + { + rate=group->min; + } /*shaping of aggresive downloaders, with credit file support */ if(use_credit) @@ -1334,10 +1433,16 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); ip->traffic>ip->credit+ (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)) ) { - if(group_ratemax) ip->max=group_rate; + if(group_ratemax) + { + ip->max=group_rate; + } group_rate+=magic_treshold; ip->prio=lowest_priority; - if(ip->prioprio=highest_priority+2; + if(ip->prioprio=highest_priority+2; + } } else { @@ -1346,15 +1451,20 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); (ip->min*ip->keyword->data_prio+(ip->keyword->fixed_prio<<20)) ) { ip->prio=priority_sequence--; - if(ip->prioprio=highest_priority+1; + if(ip->prioprio=highest_priority+1; + } } if(credit_file) { unsigned long long lcredit=0; - if((ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))>ip->traffic) + if((ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))>ip->traffic) + { lcredit=(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))-ip->traffic; + } fprintf(credit_file,"%s %Lu\n",ip->addr,lcredit); } } @@ -1362,7 +1472,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } } - if(credit_file)fclose(credit_file); + if(credit_file) + { + fclose(credit_file); + } } if(just_preview) @@ -1444,25 +1557,36 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); FILE *iplog; struct Sum {unsigned long long l; int i; list(Sum);} *sum,*sums=NULL; + colspan=11; if(qos_proxy) - colspan=12; - else - colspan=11; + { + colspan++; + } + if(found_lmsid) + { + colspan++; + } fprintf(f,"

\n\n", d); - fputs("\ - \ - \ - \ - \n",f); + fputs("",f); + if(found_lmsid) + { + fputs("\n",f); + } + fputs("\ +\ +\ +\n",f); if(qos_proxy) + { fputs("\n",f); + } fputs("\ - \ - \ - \ - \n",f); +\ +\ +\ +\n",f); for_each(ip,ips) { @@ -1481,14 +1605,32 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); #ifdef DEBUG printf("%03d. %-22s %10Lu (%d/%d)\n",i ,ip->name, ip->traffic, ip->min, ip->max); #endif - fprintf(f,"\n", - ip->name, i, log_url, ip->name, ip->name, ip->credit); - fprintf(f,"",ip->keyword->html_color,ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))); + fprintf(f,"\n", ip->name, i, log_url, ip->name, ip->name); + if(found_lmsid) + { + fputs("\n",f); + } + fprintf(f,"\n", ip->credit); + fprintf(f,"", + ip->keyword->html_color, ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))); fprintf(f,"\n", f1, ip->traffic, f2, ip->direct); if(qos_proxy) + { fprintf(f,"\n", ip->proxy); + } fprintf(f,"\n", ip->upload); - fprintf(f,"\n",ip->min,ip->desired,f1,ip->max,f2,f1,ip->prio,f2); + fprintf(f,"\n", + ip->min,ip->desired,f1,ip->max,f2,f1,ip->prio,f2); total+=ip->traffic; total_direct+=ip->direct; total_proxy+=ip->proxy; @@ -1511,18 +1653,20 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); iplog=fopen(str,"a"); if(iplog) { - fprintf(iplog,"%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%s", - time(NULL),ip->name,ip->traffic,ip->direct,ip->proxy,ip->upload,ip->min,ip->max,ip->desired,d); /* d = date*/ + fprintf(iplog,"%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s", + time(NULL),ip->name,ip->traffic,ip->direct,ip->proxy,ip->upload,ip->min,ip->max,ip->desired,ip->lmsid,d); /* d = date*/ fclose(iplog); } } } - fprintf(f,"\ \n", total, total_direct); if(qos_proxy) + { fprintf(f,"\n", total_proxy); + } fprintf(f,"", total_upload); fputs("\n
%s",colspan,title); fprintf(f," (%s)
#hostnamecreditlimittotaldirect
#hostnamelmscreditlimittotaldirectproxyuploadminimumdesiredmaximumprio
minimumdesiredmaximumprio
%d%s%Lu M%Lu M
%d%s",f); + if(ip->lmsid > 0) + { + /*base URL will be configurable soon ... */ + fprintf(f,"%04d\n", ip->lmsid, ip->lmsid); + } + else if(ip->lmsid == 0) + { + fputs("-------",f); + } + fputs("%Lu M%Lu M%s%Lu M%s%Lu M%Lu M%Lu M%d k%d k%s%d k%s%s%d%s
%d k%d k%s%d k%s%s%d%s
SUMMARY:"); + fprintf(f,"
SUMMARY:",colspan-7); fprintf(f,"%Lu M%Lu M%Lu M%Lu M
\n",f);