[ previous ] [ next ] [ threads ]
 
 From:  Jesse Guardiani <jesse at wingnet dot net>
 To:  peter at closeconsultants dot com
 Cc:  m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] thoughts on PHP as an rc system?
 Date:  Thu, 24 Feb 2005 12:04:18 -0500
On Thursday 24 February 2005 10:50 am, Peter Curran wrote:
> I ask myself these questions regularly.

Ah! Good! I was hoping I wasn't the only one.


> I think you need to appreciate that the main reason why PHP is used is because 
> of the need to initialise all of the data used by the webGUI.  It also makes 
> sense to reuse the many functions defined for config of the system via the 
> webGUI by the rc system, indeed it makes the whole thing much more 
> consistent.

Sure. As I said in the original post, I understand the motivation for
PHP, especially over something like shell. Indeed, I think it was a
brilliant choice.


> To really appreciate what is going on you need to look at the code and see 
> that m0n0 uses a logical view of the os - this is most obvious in the use of 
> LAN/WAN/OPTn for interface descriptions.  Internally these 'objects' map to 
> real interfaces that are tracked in the various data structures.  It is very 
> important that there is a consistency between these data structures, and 
> using PHP for rc along with the functions/data structures defined for the 
> webGUI ensures this consitency.
> 
> Is there a better way?  Of course :-).  You could do this in perl or python.  
> However, Manuel chose PHP because it is actually an easy scripting language 
> to learn, it creates readable code (not like perl) and is a snip for any 
> programmer with experience of procedural languages such as C or Pascal, to 
> understand (unlike Python).
> 
> I think that there is an argument for an object-based system (possibly based 
> on Python) but I think this would be slower and less accessible.

Python *might* possibly be slower, but also easier to read than PHP, IMO.
I think Perl would probably bring the same speed or better, but with
much ugliness.

OCaml, on the other hand, while certainly having it's fair share of
drawbacks, is quite fast! Interpretted, it would run at least as fast
as PHP, maybe faster. Alternatively, we would have the option of
compiling the webGUI and control script into native machine code.
This would use up considerably more space on a CF card, but at the
same time offer considerably better performance than PHP can ever
dream of offering (think as fast or faster than C++).

Personally, I'm not so interested in the speed aspect of OCaml for
a webGUI. I think the current PHP speed is fine. I'm more interested
in the security aspect and reliability that OCaml offers. OCaml is
an odd language in that any code you write, once compiled, is more
or less guaranteed to behave exactly as you expect. No core dumps
as with C/C++, and static type safety eliminates 99% of the run time
errors you might get with PHP. The trade off is in the learning curve.

Again, it would start as a research project, but like many research
projects I would hope it might end up being genuinely useful.


> My 2p
> 
> Peter
> 
> 
> On Thursday 24 February 2005 05:01, Jesse Guardiani wrote:
> > Hello,
> >
> > As I use m0n0wall I try to identify strengths and
> > weaknesses. The strengths, I file away in my mind.
> > The weaknesses, I tend to mull over on a daily
> > basis. I try to think of ways to fix the weaknesses
> > without introducing regressions in other areas.
> >
> > As a programmer, it is easy for me to identify
> > the strengths associated with a PHP based rc
> > system in an embedded application like m0n0wall.
> > Unified web and config language, relatively small
> > disk footprint, flexibility, familiarity, etc...
> >
> > However, looking at m0n0wall as a finished product
> > from the outside in, and without the experience
> > gained from trial and error, it is much more
> > difficult for me to identify the weaknesses of a
> > PHP based rc system.
> >
> > AFAIK, m0n0wall was the first O/S with a PHP based
> > rc system, so this question definitely belongs on
> > this list.
> >
> > Manuel (and anyone else who may be intimately
> > familiar with m0n0wall's PHP code), could you please
> > briefly describe your thoughts on using PHP as an
> > rc system, or as a general control system for an
> > embedded application? I'm curious to know obvious
> > weaknesses, security implications, annoyances in
> > coding, pitfalls, and overall impressions.
> >
> > Ultimately, I'm just curious: In your opinion, does
> > PHP make an excellent rc system? Or is it found
> > wanting?
> >
> > --
> > Jesse Guardiani, Systems Administrator
> > WingNET Internet Services,
> > P.O. Box 2605 // Cleveland, TN 37320-2605
> > 423-559-LINK (v)  423-559-5145 (f)
> > http://www.wingnet.net
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
> > For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
> 
> -- 
> ----------------------------------------------------------------------------
> Peter Curran      Leveraging Internet Technology
> Close Consultants          for Businesses
> p: +44-1225-463700    
> f: +44-1225-463705     
> e: peter at closeconsultants dot com    
> sip: peter at closeconsultants dot com 
> 
> 

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net