Stefan,
I started taking a look at the patch series, but it doesn't look like
the tests run at all. I get an error about trying to use
pupepttest/support/utils
/home/jhelwig/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- puppettest/support/utils (LoadError)
from /home/jhelwig/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/jhelwig/work/puppet/spec/unit/provider/port/parsed_spec.rb:6
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `autorun'
from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/bin/rspec:19
It looks like the new test is the only one attempting to use puppettest
from within the spec test framework. It looks like this will need to
get sorted out before we can merge it in.
I'm assuming that these tests are running fine for you. Anything I
should be aware of to get them running on my end?
As an aside, I started cleaning up some of the grammar, and tweaking
some of the error messages (diff below).
diff --git i/lib/puppet/type/port.rb w/lib/puppet/type/port.rb
index e2a4afa..7e04ed5 100755
--- i/lib/puppet/type/port.rb
+++ w/lib/puppet/type/port.rb
@@ -1,16 +1,16 @@
module Puppet
newtype(:port) do
- @doc = "Installs and manages port entries. For most systems, these
+ @doc = "Install and manage port entries. For most systems, these
entries will just be in /etc/services, but some systems (notably OS X)
will have different solutions."
def self.title_patterns
[
- # we just have one titlepattern "name:protocol"
+ # we just have one title_pattern "name:protocol"
[
/^(.*?)(?::(tcp|udp))?$/, # Regex to parse title
[
- # We don't need a lot of postparsing
+ # We don't need a lot of post-parsing
[ :name, lambda{|x| x} ],
[ :protocol, lambda{ |x| x.intern unless x.nil? } ],
]
@@ -24,20 +24,20 @@ module Puppet
desc "The port name."
validate do |value|
- raise Puppet::Error "Portname cannot have whitespaces in them" if value =~ /\s/
+ raise Puppet::Error "Port name cannot have whitespaces in it" if value =~ /\s/
end
isnamevar
end
newparam(:protocol) do
- desc "The protocols the port uses. Valid values are *udp* and *tcp*.
+ desc "The protocol the port uses. Valid values are *udp* and *tcp*.
Most services have both protocols, but not all. If you want both
protocols you have to define two resources. Remeber that you cannot
specify two resources with the same title but you can use a title
to set both, name and protocol if you use ':' as a seperator. So
- port { 'telnet:tcp': ... } sets both name and protocol and you dont
- have to specify them explicitly then"
+ port { 'telnet:tcp': ... } sets both name and protocol and you don't
+ have to specify them explicitly."
newvalues :tcp, :udp
@@ -46,18 +46,17 @@ module Puppet
isnamevar
end
-
newproperty(:number) do
desc "The port number."
validate do |value|
raise Puppet::Error, "number has to be numeric, not #{value}" unless value =~ /^[0-9]+$/
- raise Puppet::Error, "number #{value} out of range" unless (0...2**16).include?(Integer(value))
+ raise Puppet::Error, "number #{value} out of range (0-65535)" unless 0 <= Integer(value) && 2**16 > Integer(value)
end
end
newproperty(:description) do
- desc "The port description."
+ desc "The description for the port."
end
newproperty(:port_aliases, :parent => Puppet::Property::OrderedList) do
@@ -73,11 +72,10 @@ module Puppet
end
validate do |value|
- raise Puppet::Error, "Aliases cannot have whitespaces in them" if value =~ /\s/
+ raise Puppet::Error, "Aliases must not contain whitespace: #{value}" if value =~ /\s/
end
end
-
newproperty(:target) do
desc "The file in which to store service information. Only used by
those providers that write to disk."
@@ -90,6 +88,5 @@ module Puppet
end
end
end
-
end
end
--
Jacob Helwig
> Â Â Â Â validate do |value|
> Â Â Â Â Â raise Puppet::Error, "number has to be numeric, not #{value}" unless value =~ /^[0-9]+$/
> - Â Â Â Â raise Puppet::Error, "number #{value} out of range" unless (0...2**16).include?(Integer(value))
just out of curiosity: Will (0...2**16) generate just a huge array with
include? beeing extreamly slow or does ruby handle ranges of integers
differently?
[...]
> + The second way is the prefered way if you want to specifiy a port that
> + uses both tcp and udp as a protocol. You need to define two resources
> + for such a port but the resource title still has to be uniq.
Should probably be 'unique', not 'uniq', but this is easily fixed when
applying the patch, if it's not already done in the next patch series.
(Your cover letter made it sound like you'd have another round coming
with a test related to #5605.)
[...]
> + def self.title_patterns
> + [
> + # we have two title_patterns "name" and "name:protocol". We won't use
> + # one pattern (that will eventually set :protocol to nil) because we
> + # want to use a default value for :protocol. And that does only work
> + # if :protocol is not put in the parameter hash while initialising
> + [
> + /^(.*?)\/(tcp|udp)$/, # Set name and protocol
> + [
> + # We don't need a lot of post-parsing
> + [ :name, lambda{|x| x} ],
> + [ :protocol, lambda{ |x| x.intern unless x.nil? } ]
> + ]
> + ],
> + [
> + /^(.*)$/,
> + [
> + [ :name, lambda{|x| x} ]
> + ]
> + ]
> + ]
> + end
The original version also allowed 'ddp' (even though it wasn't
documented). Should this version allow it, too? I just want to make
sure this change is intentional and desired. Looks like it might have
been in there to support AppleTalk networks (Datagram Delivery Protocol)?
[...]
> + newparam(:protocol) do
> + desc "The protocol the port uses. Valid values are *udp* and *tcp*.
> + Most services have both protocols, but not all. If you want both
> + protocols you have to define two resources. Remeber that you cannot
> + specify two resources with the same title but you can use a title
> + to set both, name and protocol if you use ':' as a seperator. So
> + port { \"telnet/tcp\": ... } sets both name and protocol and you don't
> + have to specify them explicitly."
> +
> + newvalues :tcp, :udp
> +
> + defaultto :tcp
> +
> + isnamevar
> + end
Same comment as above about 'ddp'.
[...]
> + it "should have two key_attributes" do
> + @class.key_attributes.size.should == 2
> + end
> +
> + it "should have :name as a key_attribute" do
> + @class.key_attributes.should include :name
> + end
> +
> + it "should have :protocol as a key_attribute" do
> + @class.key_attributes.should include :protocol
> + end
Seems like these three can be condensed down into one test that checks
what key_attributes is, and would be a lot clearer.
Since I haven't actually looked into what key_attributes returns (I
know, shame on me): Does what it return make doing the "this is what it
returns" test prohibitive, instead of the current form of "this is the
shape of what it returns"?
[...]
> + it "should have a list port_aliases" do
> + @class.attrclass(:port_aliases).ancestors.should include Puppet::Property::OrderedList
> + end
So, the test description, and the test contents don't seem to line up in
my mind. Also, I'm not sure why we'd care that it's an ancestor of
Puppet::Property::OrderedList in the unit tests, especially given how
it's setup in the implementation.
This feels like an implementation detail that should be tested via
behavior, not explicitly checking ancestry.
[...]
> + it "should not support other protocols than tcp and udp" do
> + proc { @class.new(:name => "whev", :protocol => :tcpp) }.should raise_error(Puppet::Error)
> + end
I much prefer the two argument form of .should raise_error(...):
...should raise_error(Puppet::Error, /Aliases must not contain whitespace/)
This way, if we still end up getting a Puppet::Error, but for the wrong
reason, we'll still know about it.
[...]
> + it "should not support portnumbers that arent numeric" do
> + proc { @class.new(:name => "whev", :protocol => :tcp, :number => "aa") }.should raise_error(Puppet::Error)
> + proc { @class.new(:name => "whev", :protocol => :tcp, :number => "22a") }.should raise_error(Puppet::Error)
> + proc { @class.new(:name => "whev", :protocol => :tcp, :number => "a22") }.should raise_error(Puppet::Error)
> + end
> +
> + it "should not support portnumbers that are out of range" do
> + proc { @class.new(:name => "whev", :protocol => :tcp, :number => "-1") }.should raise_error(Puppet::Error)
> + proc { @class.new(:name => "whev", :protocol => :tcp, :number => "#{2**16}") }.should raise_error(Puppet::Error)
> + end
Same comment about one vs. two argument form of raise_error tests.
[...]
> + it "should not support whitespaces in any port_alias" do
> + proc { @class.new(:name => "whev", :protocol => :tcp, :port_aliases => ['bar','fo o']) }.should raise_error(Puppet::Error)
> + end
> +
> + it "should not support whitespaces in resourcename" do
> + proc { @class.new(:name => "foo bar", :protocol => :tcp) }.should raise_error(Puppet::Error)
> + end
> +
> + it "should not allow a resource with no name" do
> + proc { @class.new(:protocol => :tcp) }.should raise_error(Puppet::Error)
> + end
> +
> + it "should allow a resource with no protocol when the default is tcp" do
> + proc { @class.new(:name => "foo") }.should_not raise_error(Puppet::Error)
> + end
> +
> + it "should not allow a resource with no protocol when we have no default" do
> + @class.attrclass(:protocol).stubs(:method_defined?).with(:default).returns(false)
> + proc { @class.new(:name => "foo") }.should raise_error(Puppet::Error)
> + end
raise_error, again.
[...]
> + describe "when syncing" do
> +
> + it "should send the first value to the provider for number property" do
> + number = @class.attrclass(:number).new(:resource => @resource, :should => %w{100 200})
> + @provider.expects(:number=).with '100'
> + number.sync
> + end
This is purely my own ignorance, but: Why is this particular
test/behavior important?
It looks like it's testing a manifest that looks like
port { 'foo/tcp':
number => ['100', '200'],
}
and expecting it to only act on '100'?
Am I understanding this? (I'm assuming that I am.)
[...]
> + describe "when adding resource to a catalog" do
> +
> + it "should not allow two resources with the same name and protocol" do
> + res1 = @class.new(:name => "telnet", :protocol => :tcp, :number => '23')
> + res2 = @class.new(:name => "telnet", :protocol => :tcp, :number => '23')
> + proc { @catalog.add_resource(res1) }.should_not raise_error
> + proc { @catalog.add_resource(res2) }.should raise_error(Puppet::Resource::Catalog::DuplicateResourceError)
> + end
> +
> + it "should allow two resources with different name and protocol" do
> + res1 = @class.new(:name => "telnet", :protocol => :tcp, :number => '23')
> + res2 = @class.new(:name => "git", :protocol => :tcp, :number => '9418')
> + proc { @catalog.add_resource(res1) }.should_not raise_error
> + proc { @catalog.add_resource(res2) }.should_not raise_error
> + end
> +
> + it "should allow two resources with same name and different protocol" do
> + # I would like to have a gentitle method that would not automatically set
> + # title to resource[:name] but to uniqueness_key.join('/') or
> + # similar - stschulte
> + res1 = @class.new(:title => 'telnet/tcp', :name => 'telnet', :protocol => :tcp, :number => '23')
> + res2 = @class.new(:title => 'telnet/udp', :name => 'telnet', :protocol => :udp, :number => '23')
> + proc { @catalog.add_resource(res1) }.should_not raise_error
> + proc { @catalog.add_resource(res2) }.should_not raise_error
> + end
> +
> + it "should allow two resources with the same protocol but different names" do
> + res1 = @class.new(:title => 'telnet/tcp', :name => 'telnet', :protocol => :tcp, :number => '23')
> + res2 = @class.new(:title => 'ssh/tcp', :name => 'ssh', :protocol => :tcp, :number => '23')
> + proc { @catalog.add_resource(res1) }.should_not raise_error
> + proc { @catalog.add_resource(res2) }.should_not raise_error
> + end
> +
> + end
Seems like this entire section is covered by the uniqueness_key tests
before it, and that this level of testing is actually testing catalog
behavior, not the type's behavior at all.
[...]
If it seems like I'm nitpicking, it's because I am. ;-) So far this
patch series looks pretty good. I haven't yet gotten to the point of
actually trying to run the tests now that you've rebased the series onto
next. I plan to do that after I've had a chance to read through the
full patch series, but I don't expect it to cause any problems.
Thanks again for putting in the work on this!
--
Jacob Helwig
+ Â Â def self.title_patterns
+ Â Â Â [
+ Â Â Â Â # we have two title_patterns "name" and "name:protocol". We won't use
+ Â Â Â Â # one pattern (that will eventually set :protocol to nil) because we
+ Â Â Â Â # want to use a default value for :protocol. And that does only work
+ Â Â Â Â # if :protocol is not put in the parameter hash while initialising
+ Â Â Â Â [
+ Â Â Â Â Â /^(.*?)\/(tcp|udp)$/, # Set name and protocol
+ Â Â Â Â Â [
+ Â Â Â Â Â Â # We don't need a lot of post-parsing
+ Â Â Â Â Â Â [ :name, lambda{|x| x} ],
+ Â Â Â Â Â Â [ :protocol, lambda{ |x| x.intern unless x.nil? } ]
+ Â Â Â Â Â ]
+ Â Â Â Â ],
[...]
> + # This method is important for prefetching and is called from the parsedfile provider.
> + # We get one record (one line of /etc/services) and a hash of resources (what the user
> + # specified in manifests). This hash is build in transaction.rb and uses uniqueness_key
> + # as a hashkey.
The last sentence should probably s/build/built/, since it's in the past tense.
> + # Normally the parsedfileprovider loops over every record and uses record[:name] to
> + # find a corresponding resources[name]. That works if we only have one namevar
> + # because uniqueness_key of this resource will equal record[:name]. Because we use
> + # a composite key the parsedfile provider would never find a resource that matches
> + # a given record.
> + # Even worse: The parsedfileprovider cannot calculate the uniqueness_key of a
> + # specific record.
> + def self.match(record,resources)
> + # This should never happen but who knows
> + return false unless name = record[:name] and protocol = record[:protocol]
> +
> + # We now calculate the uniqueness_key of the resource we want to find
> + uniq_key = [name, protocol]
> + resources[uniq_key] # will be nil if the user doesnt manage record
> + end
> +end
The early return looks completely redundant, and given the comment above
it seems a bit like voodoo coding. Is there a specific failure mode you
had in mind that this would cover? If not, it seems like the line and
comment should be removed.
[...]
> diff --git a/spec/fixtures/unit/provider/port/parsed/nonuniq b/spec/fixtures/unit/provider/port/parsed/nonuniq
> new file mode 100644
> index 0000000..e4eb25a
> --- /dev/null
> +++ b/spec/fixtures/unit/provider/port/parsed/nonuniq
> @@ -0,0 +1,6 @@
> +# We test a few comments here
> +# and anotherone
> +telnet 23/tcp # Telnet
> +telnets 992/tcp # telnet protocol over TLS/SSL
> +telnets 992/ud
> +telnet 23/udp
Maybe add another comment line here to explain whether 'telnets 992/ud'
is supposed to be a bogus line?
Actually...after reading through the reset of the patch, it doesn't look
like any of the fixtures introduced are actually used. Was this
intentional?
[...]
> + it "should extrace name from the first field" do
> + @provider.parse_line(@example_line)[:name].should == 'telnet'
> + end
[...]
> + it "should extrace protocol tcp from third field" do
> + @provider.parse_line('telnet 23/tcp')[:protocol].should == :tcp
> + end
[...]
> + it "should extrace name from the first field" do
> + @provider.parse_line(@example_line)[:name].should == 'telnet'
> + end
[...]
> + it "should extrace name from the first field" do
> + @provider.parse_line(@example_line)[:name].should == 'telnet'
> + end
[...]
> + it "should extrace name from the first field" do
> + @provider.parse_line(@example_line)[:name].should == @result[0]
> + end
'extrace'? ;)
[...]
> + it "should be able to generate an entry with one alias" do
> + port = mkport(
> + :name => 'pcx-pin',
> + :protocol => :tcp,
> + :number => '4005',
> + :port_aliases => 'pcx-pin',
> + :ensure => :present
> + )
> + genport(port).should == "pcx-pin\t4005/tcp\tpcx-pin\n"
> + end
> +
> + it "should be able to generate an entry with more than one alias" do
> + port = mkport(
> + :name => 'pcx-splr-ft',
> + :protocol => :udp,
> + :number => '4003',
> + :port_aliases => [ 'pcx-splr-ft', 'rquotad' ],
> + :ensure => :present
> + )
> + genport(port).should == "pcx-splr-ft\t4003/udp\tpcx-splr-ft rquotad\n"
> + end
The name and the alias really should be different, so we can make
sure they didn't get mixed up somehow.
[...]
> + it "should be able to generate an entry with more than one alias and a comment" do
> + port = mkport(
> + :name => 'foo',
> + :protocol => :udp,
> + :number => '3000',
> + :port_aliases => [ 'bar', 'baz', 'zap' ],
> + :description => 'Bazinga!',
> + :ensure => :present
> + )
> + genport(port).should == "foo\t3000/udp\tbar baz zap\t# Bazinga!\n"
> + end
I think I'm going to have to start using "Bazinga!" more. ;)
--
Jacob Helwig
After looking through the patch series, it seems like it all should be
squashed down into one commit. Normally, I'd agree about splitting a
patch series apart as much as possible to get down to "logically
consistent units". Given that you're essentially rewriting port from the
ground up, it seems like the entire rewrite is the "logically consistent
unit" for this series. Another reason to squash the entire series is
that the tests don't pass in every commit in the patch series.
Also, it looks like your GitHub branch isn't up to date?
Again, thanks for putting in the work on this. I'm looking forward to
seeing the next iteration of the patch series.
--
Jacob Helwig
I like net_service.
James
--
James Turnbull
Puppet Labs
1-503-734-8571
network_service, or net_service are currently the leading candidates in
my mind, for what it's worth.
--
Jacob Helwig
In Fedora, at least, network materials are grouped into the
'initscripts' package and items such as /etc/hosts and /etc/services
are in the 'setup' package.
You almost would need a LSB category to give these a really broad
header (where applicable).
I'm not sure if that's a good idea though.
Perhaps: etc_services, etc_hosts , etc_networks etc...?
It's based on where they live but that seems to be more consistent
than anything else.
Trevor
> --
> You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
> To post to this group, send email to puppe...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
>
>
--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvau...@onyxpoint.com
-- This account not approved for unencrypted proprietary information --
I can't speak for Fedora's packaging, but my impression is that these
files are all ultimately serving the name service, configured via
/etc/nsswitch.conf and thus part of GNU libc. The absence of any of
these files due to packaging differences should be irrelevant, since
they (AFAIK) are all default choices of the name service switch
config, and hence have the same basic format.
nss:<foo> or nss_foo?
According to nsswitch.conf(5) this would include:
aliases
ethers
group -> Covered by 'group' type
hosts -> Covered by 'host' type
netgroup
networks
passwd -> Covered by 'user' type
protocols
publickey
rpc
services -> The one we want to cover
shadow -> Covered by 'user' type
So, if this logic holds, would we need to rename/alias the 'host' type
to nss_host?
It's not a horrible idea so long as it's a full version deprecation.
It would add consistency and tell you more concretely what you're
actually configuring. For instance, if some crazy person decides to
create a full BIND type then you would have another 'host' scope in
there.
Trevor
Mac OS X uses /etc/{hosts,services,networks} but Name Service Switch
isn't meaningful at all.
I think we're getting too OS-flavor-specific in this thread.
Ah, I hadn't realized that.
Also, what about Windows? Would this cover something there as well?
Trevor
- --
Trevor Vaughan
Vice President, Onyx Point, Inc.
email: tvau...@onyxpoint.com
phone: 410-541-ONYX (6699)
pgp: 0x6C701E94
- -- This account not approved for unencrypted sensitive information --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQEcBAEBAgAGBQJNlRT4AAoJECNCGV1OLcypbPcH/iJRFjGA0qtxyCVmE4G063os
JNNV85Lld0m92ZRpiokWNtfSFvvx6AGdT2qA/gkyv1LJXP6YzYiNBddrMn66a4sC
NLCNsMiPaHgaYuPeqy5xIcQlj0ycsWKzrQCLDHRqvLUEin2SIWqPCtspZbv4vI+D
YAG8Wwb915QiN54/L1IwihclwGyK5A1XVSKta1zSQNwurgPJJzQHztJAh5pYMu0b
qW9zqAFZQeKqimBQzIji7fXt4b3PLsJogbpyHOIOR6m9dtTJRCVhQQJ9gjL6TXTH
hTLr7Dc7SwrBYa/j75Oy36gAjnZlSB5Uv5foXIBsmHAdBPnFSId7/RoJfWn0/30=
=PWNe
-----END PGP SIGNATURE-----
"Well, actually"[1] nss can talk to ldap, nis, files, berkley dbs, and a
bunch of other nasty stuff, and complex combinations of them. So
"nss_user" would have have a very local meaning, depending on the
contents of nsswitch and the user you're looking at. I'm all for having
support for any and all of those mechanisms, I'm just not sure that they
should all be managed via nss_user providers...
Best Regards, David
[1]http://tirania.org/blog/archive/2011/Feb-17.html
--
dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at
Wien UID: ATU64260999
FB-Nr.: FN 309285 g FB-Gericht: Wien
Windows does have hosts, lmhosts, networks, protocol and services files
in C:\Windows\System32\drivers\etc ; on my system they only contain the
most very basics, that is IANA registrations, and localhost.
Best Regards, David
I now also use the two arguments form of raise_error. That was a great
tip because it showed a few bugs in validate methods ;-)
The unit tests all pass on my system (Linux). But because of #5605 the type
is currently now useable. The second commit introduces new integration
tests that will fail because of #5605.
About the name:
I don't like port either, but I dont like nss_*. I think that nss could be
an alternative provider that can also talk to a db or whatever is configured
in nsswitch. And that nss provider can then be used on any system that
supports nss.
Personally I prefer 'net_service' as the resource name.
-Stefan
The added specs will currently result in failing tests.
The port provider assumes that the prefetched hash of resources that is
built in transaction.rb uses uniqueness_key as the hashkey. Because that
is not true (yet) puppet has problems whenever it parses /etc/services
and port name is not unique (e.g. telnet/tcp and telnet/udp should be
managed or do appear in the file).
Signed-off-by: Stefan Schulte <stefan....@taunusstein.net>
---
Local-branch: feature/next/5660
spec/integration/provider/port_spec.rb | 286 ++++++++++++++++++++++++++++++++
1 files changed, 286 insertions(+), 0 deletions(-)
create mode 100644 spec/integration/provider/port_spec.rb
diff --git a/spec/integration/provider/port_spec.rb b/spec/integration/provider/port_spec.rb
new file mode 100644
index 0000000..770210b
--- /dev/null
+++ b/spec/integration/provider/port_spec.rb
@@ -0,0 +1,286 @@
+#!/usr/bin/env ruby
+
+require 'spec_helper'
+require 'puppet/file_bucket/dipper'
+
+describe "port provider (integration)" do
+ include PuppetSpec::Files
+
+ before :each do
+ @fake_services = tmpfile('services')
+ Puppet::Type.type(:port).defaultprovider.stubs(:default_target).returns @fake_services
+ end
+
+ def create_fake_services(content)
+ File.open(@fake_services,'w') do |f|
+ f.puts content
+ end
+ end
+
+ def check_fake_services(expected_content)
+ content = File.read(@fake_services).lines.map(&:chomp).reject{ |x| x =~ /^#|^$/ }.sort.join("\n")
+ sorted_expected_content = expected_content.split("\n").sort.join("\n")
+ content.should == sorted_expected_content
+ end
+
+ def run_in_catalog(resources)
+ Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # Don't backup to the filebucket
+ catalog = Puppet::Resource::Catalog.new
+ catalog.host_config = false
+ resources.each do |resource|
+ resource.expects(:err).never
+ catalog.add_resource(resource)
+ end
+ catalog.apply
+ end
+
+ describe "when managing one resource" do
+
+ describe "with ensure set to absent" do
+
+ before :each do
+ @example = Puppet::Type.type(:port).new(
+ :name => 'telnet',
+ :protocol => :tcp,
+ :number => '23',
+ :description => 'Telnet with tcp',
+ :ensure => :absent
+ )
+ end
+
+ it "should not modify /etc/services if resource is currently not present" do
+ create_fake_services("ssh 22/tcp\nssh 22/udp")
+ run_in_catalog([@example])
+ check_fake_services("ssh 22/tcp\nssh 22/udp")
+ end
+
+ it "should remove the entry if the resource is currently present" do
+ create_fake_services("ssh 22/tcp\ntelnet 99/tcp\nssh 22/udp")
+ run_in_catalog([@example])
+ check_fake_services("ssh\t22/tcp\nssh\t22/udp")
+ end
+
+ it "should not remove an entry if protocol does not match" do
+ create_fake_services("ssh\t22/tcp\ntelnet\t23/udp\nssh\t22/udp")
+ # example describes telnet/tcp not telnet/udp
+ run_in_catalog([@example])
+ check_fake_services("ssh\t22/tcp\ntelnet\t23/udp\nssh\t22/udp")
+ end
+
+ end
+
+ describe "with no port alias" do
+
+ before :each do
+ @example = Puppet::Type.type(:port).new(
+ :name => 'telnet',
+ :protocol => :tcp,
+ :number => '23',
+ :description => 'Telnet with tcp',
+ :ensure => :present
+ )
+ @correct_line = "telnet\t23/tcp\t# Telnet with tcp"
+ end
+
+ it "should not modify /etc/services if resource is in sync" do
+ create_fake_services("telnet 23/tcp # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services("telnet 23/tcp # Telnet with tcp")
+ end
+
+ it "should change port number if out of sync" do
+ create_fake_services("telnet 9/tcp # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ it "should change description if out of sync" do
+ create_fake_services("telnet 23/tcp # unknown")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ it "should add the description if currently not present" do
+ create_fake_services("telnet 23/tcp")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ it "should not change unmanaged attributes" do
+ create_fake_services("telnet 99/tcp alias1 alias2 # Wrong description")
+ run_in_catalog([@example])
+ # keep unmanaged aliases
+ check_fake_services("telnet\t23/tcp\talias1 alias2\t# Telnet with tcp")
+ end
+
+ it "should add an entry to /etc/services if name is not present yet" do
+ create_fake_services("ssh 22/tcp\nssh 22/udp # Test")
+ run_in_catalog([@example])
+ check_fake_services("ssh\t22/tcp\nssh\t22/udp\t# Test\n" + @correct_line)
+ end
+
+ it "should add an entry to /etc/services if protocol is not present yet" do
+ create_fake_services("telnet 23/udp\nssh 22/udp # Test")
+ run_in_catalog([@example])
+ # example describes telnet/tcp an should not modify telnet/udp
+ check_fake_services("telnet\t23/udp\nssh\t22/udp\t# Test\n" + @correct_line)
+ end
+
+ end
+
+ describe "with port aliases" do
+
+ before :each do
+ @example = Puppet::Type.type(:port).new(
+ :name => 'telnet',
+ :protocol => :tcp,
+ :number => '23',
+ :description => 'Telnet with tcp',
+ :port_aliases => [ 'foo', 'bar' ],
+ :ensure => :present
+ )
+ @correct_line = "telnet\t23/tcp\tfoo bar\t# Telnet with tcp"
+ end
+
+ it "should not modify /etc/services if resource is in sync" do
+ create_fake_services("telnet 23/tcp foo bar # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services("telnet 23/tcp foo bar # Telnet with tcp")
+ end
+
+ it "should change port aliases if currently out of sync" do
+ create_fake_services("telnet 23/tcp foo kar # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ # stschulte: I dont know if the order is crucial at all - if its not
+ # one can easily modify this test and substitue Puppet::Property::OrderedList
+ # with Puppet::Property::List
+ it "should also change port aliases if they are in wrong order" do
+ create_fake_services("telnet 23/tcp bar foo # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ it "should add missing port aliases" do
+ create_fake_services("telnet 23/tcp bar # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ it "should remove any port alias that was not defined" do
+ create_fake_services("telnet 23/tcp foo bar n # Telnet with tcp")
+ run_in_catalog([@example])
+ check_fake_services(@correct_line)
+ end
+
+ end
+
+ end
+
+ [true, false].each do |uniq|
+ describe "when managing two resources #{uniq ? 'with unique names' : 'with the same name but different protocols'}" do
+
+ before :each do
+
+ @example1 = {
+ :resource => Puppet::Type.type(:port).new(
+ :title => 'telnet/tcp',
+ :name => 'telnet',
+ :protocol => :tcp,
+ :number => '23',
+ :description => 'Telnet with tcp',
+ :ensure => :present
+ ),
+ :correctline => "telnet\t23/tcp\t# Telnet with tcp",
+ :incorrectline => "telnet\t23/tcp",
+ }
+ @example2 = {
+ :resource => Puppet::Type.type(:port).new(
+ :title => 'telnet/udp',
+ :name => 'telnet',
+ :protocol => :udp,
+ :number => '23',
+ :description => 'Telnet with udp',
+ :ensure => :present
+ ),
+ :correctline => "telnet\t23/udp\t# Telnet with udp",
+ :incorrectline => "telnet\t22/udp\t# Telnet with udp",
+ }
+ @example3 = {
+ :resource => Puppet::Type.type(:port).new(
+ :title => 'mandelspawn/udp',
+ :name => 'mandelspawn',
+ :port_aliases=> 'mandelbrot',
+ :protocol => :udp,
+ :number => '9359',
+ :description => 'network mandelbrot',
+ :ensure => :present
+ ),
+ :correctline => "mandelspawn\t9359/udp\tmandelbrot\t# network mandelbrot",
+ :incorrectline => "mandelspawn\t9359/udp\tmandlbrot\t# network mandelbrot",
+ }
+
+ if uniq
+ @examples = [ @example1, @example3 ]
+ else
+ @examples = [ @example1, @example2 ]
+ end
+
+ @desired_result = @examples.collect{|h| h[:correctline]}.join("\n")
+
+ end
+
+
+ describe "and one resource is absent" do
+
+ it "should add the second resource if only the first one is present" do
+ create_fake_services(@examples[0][:correctline])
+ run_in_catalog(@examples.map { |example| example[:resource] })
+ check_fake_services(@desired_result)
+ end
+
+ it "should add the first resource if only the second one is present" do
+ create_fake_services(@examples[1][:correctline])
+ run_in_catalog(@examples.map { |example| example[:resource] })
+ check_fake_services(@desired_result)
+ end
+
+ end
+
+ describe "and both resources are absent" do
+
+ it "should add both resources" do
+ create_fake_services("ssh 23/tcp # Yeah")
+ run_in_catalog(@examples.map { |example| example[:resource] })
+ check_fake_services("ssh\t23/tcp\t# Yeah\n" + @desired_result)
+ end
+
+ end
+
+ describe "and both resources are in sync" do
+
+ it "should not do anything" do
+ create_fake_services(@examples.map{|example| example[:correctline]})
+ run_in_catalog(@examples.map { |example| example[:resource] })
+ check_fake_services(@desired_result)
+ end
+
+ end
+
+ describe "and both resources are out of sync" do
+
+ it "should change both resources" do
+ create_fake_services(@examples.map{|example| example[:incorrectline]})
+ run_in_catalog(@examples.map { |example| example[:resource] })
+ check_fake_services(@desired_result)
+ end
+
+ end
+
+ end
+
+ end
+
+end
--
1.7.4.1
port { 'telnet':
number => '23',
protocol => 'tcp',
description => 'Telnet'
}
Because the type makes use of the title_patterns function this can also
be written as
port { 'telnet/tcp':
number => '23',
description => 'Telnet'
}
This type only supports tcp and udp and might not work on OS X.
Signed-off-by: Stefan Schulte <stefan....@taunusstein.net>
---
Local-branch: feature/next/5660
lib/puppet/provider/port/parsed.rb | 219 +-
lib/puppet/type/port.rb | 264 +-
spec/fixtures/unit/provider/port/parsed/nonuniq | 6 +
.../unit/provider/port/parsed/realworld_linux | 1179 ++
spec/fixtures/unit/provider/port/parsed/uniq | 7 +
spec/unit/provider/port/parsed_spec.rb | 277 +
spec/unit/type/port_spec.rb | 220 +
test/data/types/port/1 | 533 -
test/data/types/port/darwin |11866 --------------------
test/ral/providers/port/parsed.rb | 232 -
test/ral/type/port.rb | 147 -
11 files changed, 1884 insertions(+), 13066 deletions(-)
create mode 100644 spec/fixtures/unit/provider/port/parsed/nonuniq
create mode 100644 spec/fixtures/unit/provider/port/parsed/realworld_linux
create mode 100644 spec/fixtures/unit/provider/port/parsed/uniq
create mode 100644 spec/unit/provider/port/parsed_spec.rb
create mode 100644 spec/unit/type/port_spec.rb
delete mode 100644 test/data/types/port/1
delete mode 100644 test/data/types/port/darwin
delete mode 100755 test/ral/providers/port/parsed.rb
delete mode 100755 test/ral/type/port.rb
diff --git a/lib/puppet/provider/port/parsed.rb b/lib/puppet/provider/port/parsed.rb
index 5c973b6..dfd0aa8 100755
--- a/lib/puppet/provider/port/parsed.rb
+++ b/lib/puppet/provider/port/parsed.rb
@@ -1,173 +1,52 @@
require 'puppet/provider/parsedfile'
-#services = nil
-#case Facter.value(:operatingsystem)
-#when "Solaris"; services = "/etc/inet/services"
-#else
-# services = "/etc/services"
-#end
-#
-#Puppet::Type.type(:port).provide(:parsed,
-# :parent => Puppet::Provider::ParsedFile,
-# :default_target => services,
-# :filetype => :flat
-#) do
-# text_line :comment, :match => /^\s*#/
-# text_line :blank, :match => /^\s*$/
-#
-# # We're cheating horribly here -- we don't support ddp, because it assigns
-# # the same number to already-used names, and the same name to different
-# # numbers.
-# text_line :ddp, :match => /^\S+\s+\d+\/ddp/
-#
-# # Also, just ignore the lines on OS X that don't have service names.
-# text_line :funky_darwin, :match => /^\s+\d+\//
-#
-# # We have to manually parse the line, since it's so darn complicated.
-# record_line :parsed, :fields => %w{name port protocols alias description},
-# :optional => %w{alias description} do |line|
-# if line =~ /\/ddp/
-# raise "missed ddp in #{line}"
-# end
-# # The record might contain multiple port lines separated by \n.
-# hashes = line.split("\n").collect { |l| parse_port(l) }
-#
-# # It's easy if there's just one hash.
-# if hashes.length == 1
-# return hashes.shift
-# end
-#
-# # Else, merge the two records into one.
-# return port_merge(*hashes)
-# end
-#
-# # Override how we split into lines, so that we always treat both protocol
-# # lines as a single line. This drastically simplifies merging the two lines
-# # into one record.
-# def self.lines(text)
-# names = {}
-# lines = []
-#
-# # We organize by number, because that's apparently how the ports work.
-# # You'll never be able to use Puppet to manage multiple entries
-# # with the same name but different numbers, though.
-# text.split("\n").each do |line|
-# if line =~ /^([-\w]+)\s+(\d+)\/[^d]/ # We want to skip ddp proto stuff
-# names[$1] ||= []
-# names[$1] << line
-# lines << [:special, $1]
-# else
-# lines << line
-# end
-# end
-#
-# # Now, return each line in order, but join the ones with the same name
-# lines.collect do |line|
-# if line.is_a?(Array)
-# name = line[1]
-# if names[name]
-# t = names[name].join("\n")
-# names.delete(name)
-# t
-# end
-# else
-# line
-# end
-# end.reject { |l| l.nil? }
-# end
-#
-# # Parse a single port line, returning a hash.
-# def self.parse_port(line)
-# hash = {}
-# if line.sub!(/^(\S+)\s+(\d+)\/(\w+)\s*/, '')
-# hash[:name] = $1
-# hash[:number] = $2
-# hash[:protocols] = [$3]
-#
-# unless line == ""
-# line.sub!(/^([^#]+)\s*/) do |value|
-# aliases = $1
-#
-# # Remove any trailing whitespace
-# aliases.strip!
-# unless aliases =~ /^\s*$/
-# hash[:alias] = aliases.split(/\s+/)
-# end
-#
-# ""
-# end
-#
-# line.sub!(/^\s*#\s*(.+)$/) do |value|
-# desc = $1
-# unless desc =~ /^\s*$/
-# hash[:description] = desc.sub(/\s*$/, '')
-# end
-#
-# ""
-# end
-# end
-# else
-# if line =~ /^\s+\d+/ and
-# Facter["operatingsystem"].value == "Darwin"
-# #Puppet.notice "Skipping wonky OS X port entry %s" %
-# # line.inspect
-# next
-# end
-# Puppet.notice "Ignoring unparseable line '#{line}' in #{self.target}"
-# end
-#
-# if hash.empty?
-# return nil
-# else
-# return hash
-# end
-# end
-#
-# # Merge two records into one.
-# def self.port_merge(one, two)
-# keys = [one.keys, two.keys].flatten.uniq
-#
-# # We'll be returning the 'one' hash. so make any necessary modifications
-# # to it.
-# keys.each do |key|
-# # The easy case
-# if one[key] == two[key]
-# next
-# elsif one[key] and ! two[key]
-# next
-# elsif ! one[key] and two[key]
-# one[key] = two[key]
-# elsif one[key].is_a?(Array) and two[key].is_a?(Array)
-# one[key] = [one[key], two[key]].flatten.uniq
-# else
-# # Keep the info from the first hash, so don't do anything
-# #Puppet.notice "Cannot merge %s in %s with %s" %
-# # [key, one.inspect, two.inspect]
-# end
-# end
-#
-# return one
-# end
-#
-# # Convert the current object into one or more services entry.
-# def self.to_line(hash)
-# unless hash[:record_type] == :parsed
-# return super
-# end
-#
-# # Strangely, most sites seem to use tabs as separators.
-# hash[:protocols].collect { |proto|
-# str = "#{hash[:name]}\t\t#{hash[:number]}/#{proto}"
-#
-# if value = hash[:alias] and value != :absent
-# str += "\t\t#{value.join(" ")}"
-# end
-#
-# if value = hash[:description] and value != :absent
-# str += "\t# #{value}"
-# end
-# str
-# }.join("\n")
-# end
-#end
+services = nil
+case Facter.value(:operatingsystem)
+when "Solaris"
+ services = "/etc/inet/services"
+else
+ services = "/etc/services"
+end
+Puppet::Type.type(:port).provide(:parsed, :parent => Puppet::Provider::ParsedFile,
+ :default_target => services, :filetype => :flat) do
+
+ text_line :comment, :match => /^\s*#/
+ text_line :blank, :match => /^\s*$/
+
+ record_line :parsed, :fields => %w{name number protocol port_aliases description},
+ :optional => %w{port_aliases description},
+ :match => /^(\S*)\s+(\d*)\/(\S*)\s*(.*?)?\s*(?:#\s*(.*))?$/,
+ :post_parse => proc { |hash|
+ hash[:protocol] = hash[:protocol].intern if hash[:protocol]
+ hash[:description] = '' if hash[:description].nil? or hash[:description] == :absent
+ unless hash[:port_aliases].nil? or hash[:port_aliases] == :absent
+ hash[:port_aliases].gsub!(/\s+/,' ') # Change delimiter
+ end
+ },
+ :to_line => proc { |hash|
+ [:name, :number, :protocol].each do |n|
+ raise Puppet::Error, "#{n} is a required attribute for port but not included in #{hash.inspect}" unless hash[n] and hash[n] != :absent
+ end
+
+ str = "#{hash[:name]}\t#{hash[:number]}/#{hash[:protocol]}"
+ if hash.include? :port_aliases and !hash[:port_aliases].nil? and hash[:port_aliases] != :absent
+ str += "\t#{hash[:port_aliases]}"
+ end
+ if hash.include? :description and !hash[:description].empty?
+ str += "\t# #{hash[:description]}"
+ end
+ str
+ }
+
+ # This method assumes that the resource hash passed to the prefetch
+ # method and to this method is built with uniqueness_key as the hash
+ # key. To find a matching resource for a record in /etc/services we
+ # just have to calculate the uniqueness_key of that record.
+ def self.match(record,resources)
+ # We now calculate the uniqueness_key of the resource we want to find
+ uniq_key = [record[:name], record[:protocol]]
+ resources[uniq_key] # will be nil if the user doesnt manage record
+ end
+
+end
diff --git a/lib/puppet/type/port.rb b/lib/puppet/type/port.rb
index e199885..9a57008 100755
--- a/lib/puppet/type/port.rb
+++ b/lib/puppet/type/port.rb
@@ -1,119 +1,147 @@
-#module Puppet
-# newtype(:port) do
-# @doc = "Installs and manages port entries. For most systems, these
-# entries will just be in /etc/services, but some systems (notably OS X)
-# will have different solutions."
-#
-# ensurable
-#
-# newproperty(:protocols) do
-# desc "The protocols the port uses. Valid values are *udp* and *tcp*.
-# Most services have both protocols, but not all. If you want
-# both protocols, you must specify that; Puppet replaces the
-# current values, it does not merge with them. If you specify
-# multiple protocols they must be as an array."
-#
-# def is=(value)
-# case value
-# when String
-# @is = value.split(/\s+/)
-# else
-# @is = value
-# end
-# end
-#
-# def is
-# @is
-# end
-#
-# # We actually want to return the whole array here, not just the first
-# # value.
-# def should
-# if defined?(@should)
-# if @should[0] == :absent
-# return :absent
-# else
-# return @should
-# end
-# else
-# return nil
-# end
-# end
-#
-# validate do |value|
-# valids = ["udp", "tcp", "ddp", :absent]
-# unless valids.include? value
-# raise Puppet::Error,
-# "Protocols can be either 'udp' or 'tcp', not #{value}"
-# end
-# end
-# end
-#
-# newproperty(:number) do
-# desc "The port number."
-# end
-#
-# newproperty(:description) do
-# desc "The port description."
-# end
-#
-# newproperty(:port_aliases) do
-# desc 'Any aliases the port might have. Multiple values must be
-# specified as an array. Note that this property is not the same as
-# the "alias" metaparam; use this property to add aliases to a port
-# in the services file, and "alias" to aliases for use in your Puppet
-# scripts.'
-#
-# # We actually want to return the whole array here, not just the first
-# # value.
-# def should
-# if defined?(@should)
-# if @should[0] == :absent
-# return :absent
-# else
-# return @should
-# end
-# else
-# return nil
-# end
-# end
-#
-# validate do |value|
-# if value.is_a? String and value =~ /\s/
-# raise Puppet::Error,
-# "Aliases cannot have whitespace in them: %s" %
-# value.inspect
-# end
-# end
-#
-# munge do |value|
-# unless value == "absent" or value == :absent
-# # Add the :alias metaparam in addition to the property
-# @resource.newmetaparam(
-# @resource.class.metaparamclass(:alias), value
-# )
-# end
-# value
-# end
-# end
-#
-# newproperty(:target) do
-# desc "The file in which to store service information. Only used by
-# those providers that write to disk."
-#
-# defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
-# @resource.class.defaultprovider.default_target
-# else
-# nil
-# end
-# }
-# end
-#
-# newparam(:name) do
-# desc "The port name."
-#
-# isnamevar
-# end
-# end
-#end
+require 'puppet/property/ordered_list'
+require 'puppet/provider/parsedfile'
+module Puppet
+ newtype(:port) do
+ @doc = "Installs and manages port entries. For most systems, these
+ entries will just be in `/etc/services`, but some systems (notably OS X)
+ will have different solutions.
+
+ This type uses a composite key of (port) `name` and (port) `number` to
+ identify a resource. You are able to set both keys with the resource
+ title if you seperate them with a slash. So instead of specifying protocol
+ explicitly:
+
+ port { \"telnet\":
+ protocol => tcp,
+ number => 23,
+ }
+
+ you can also specify both name and protocol implicitly through the title:
+
+ port { \"telnet/tcp\":
+ number => 23,
+ }
+
+ The second way is the prefered way if you want to specifiy a port that
+ uses both tcp and udp as a protocol. You need to define two resources
+ for such a port but the resource title still has to be unique.
+
+ Example: To make sure you have the telnet port in your `/etc/services`
+ file you will now write:
+
+ port { \"telnet/tcp\":
+ number => 23,
+ }
+ port { \"telnet/udp\":
+ number => 23,
+ }
+
+ Currently only tcp and udp are supported and recognised when setting
+ the protocol via the title."
+
+ def self.title_patterns
+ [
+ # we have two title_patterns "name" and "name:protocol". We won't use
+ # one pattern (that will eventually set :protocol to nil) because we
+ # want to use a default value for :protocol. And that does only work
+ # when :protocol is not put in the parameter hash while initialising
+ [
+ /^(.*)\/(tcp|udp)$/, # Set name and protocol
+ [
+ # We don't need a lot of post-parsing
+ [ :name, lambda{|x| x} ],
+ [ :protocol, lambda{ |x| x.intern } ]
+ ]
+ ],
+ [
+ /^(.*)$/,
+ [
+ [ :name, lambda{|x| x} ]
+ ]
+ ]
+ ]
+ end
+
+ ensurable
+
+ newparam(:name) do
+ desc "The port name."
+
+ validate do |value|
+ raise Puppet::Error, "Port name must not contain whitespace: #{value}" if value =~ /\s/
+ end
+
+ isnamevar
+ end
+
+ newparam(:protocol) do
+ desc "The protocol the port uses. Valid values are *udp* and *tcp*.
+ Most services have both protocols, but not all. If you want both
+ protocols you have to define two resources. Remeber that you cannot
+ specify two resources with the same title but you can use a title
+ to set name and protocol at the same time (an example can be found
+ in the documentation of the port resource itself)."
+
+ newvalues :tcp, :udp
+
+ defaultto :tcp
+
+ isnamevar
+ end
+
+
+ newproperty(:number) do
+ desc "The port number."
+
+ validate do |value|
+ raise Puppet::Error, "number has to be numeric, not #{value}" unless value =~ /^-?[0-9]+$/
+ raise Puppet::Error, "number #{value} out of range (0-65535)" unless (0...2**16).include?(Integer(value))
+ end
+
+ end
+
+ newproperty(:description) do
+ desc "The description for the port. The description will appear"
+ "as a comment in the `/etc/services` file"
+ end
+
+ newproperty(:port_aliases, :parent => Puppet::Property::OrderedList) do
+ desc "Any aliases the port might have. Multiple values must be
+ specified as an array."
+
+ def inclusive?
+ true
+ end
+
+ def delimiter
+ " "
+ end
+
+ validate do |value|
+ raise Puppet::Error, "Aliases must not contain whitespace: #{value}" if value =~ /\s/
+ end
+ end
+
+
+ newproperty(:target) do
+ desc "The file in which to store service information. Only used by
+ those providers that write to disk."
+
+ defaultto do
+ if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
+ @resource.class.defaultprovider.default_target
+ else
+ nil
+ end
+ end
+ end
+
+ validate do
+ unless @parameters[:name] and @parameters[:protocol]
+ raise Puppet::Error, "Attributes 'name' and 'protocol' are mandatory"
+ end
+ end
+
+ end
+end
diff --git a/spec/fixtures/unit/provider/port/parsed/nonuniq b/spec/fixtures/unit/provider/port/parsed/nonuniq
new file mode 100644
index 0000000..f13023e
--- /dev/null
+++ b/spec/fixtures/unit/provider/port/parsed/nonuniq
@@ -0,0 +1,6 @@
+# We test a few comments here
+# and anotherone
+telnet 23/tcp # Telnet
+telnets 992/tcp # telnet protocol over TLS/SSL
+telnets 992/udp
+telnet 23/udp
diff --git a/spec/fixtures/unit/provider/port/parsed/realworld_linux b/spec/fixtures/unit/provider/port/parsed/realworld_linux
new file mode 100644
index 0000000..f7fd67d
--- /dev/null
+++ b/spec/fixtures/unit/provider/port/parsed/realworld_linux
@@ -0,0 +1,1179 @@
+# /etc/services
+#
+# Network services, Internet style
+#
+# Note that it is presently the policy of IANA to assign a single well-known
+# port number for both TCP and UDP; hence, most entries here have two entries
+# even if the protocol doesn't support UDP operations.
+#
+# Some References:
+# http://www.iana.org/assignments/port-numbers
+# http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services
+#
+# Each line describes one service, and is of the form:
+# service-name port/protocol [aliases ...] [# comment]
+#
+# See services(5) for more info.
+#
+
+#
+# IANA Assignments [Well Known Ports]
+# The Well Known Ports are assigned by the IANA and on most systems can
+# only be used by system (or root) processes or by programs executed by
+# privileged users.
+# The range for assigned ports managed by the IANA is 0-1023.
+#
+tcpmux 1/tcp # TCP port service multiplexer
+tcpmux 1/udp
+compressnet 2/tcp # Management Utility
+compressnet 2/udp
+compressnet 3/tcp # Compression Process
+compressnet 3/udp
+rje 5/tcp # Remote Job Entry
+rje 5/udp
+echo 7/tcp # Echo
+echo 7/udp
+discard 9/tcp sink null # Discard
+discard 9/udp sink null
+systat 11/tcp users # Active Users
+systat 11/udp users
+daytime 13/tcp # Daytime (RFC 867)
+daytime 13/udp
+#netstat 15/tcp # (was once asssigned, no more)
+qotd 17/tcp quote # Quote of the Day
+qotd 17/udp quote
+msp 18/tcp # Message Send Protocol
+msp 18/udp
+chargen 19/tcp ttytst source # Character Generator
+chargen 19/udp ttytst source
+ftp-data 20/tcp # File Transfer [Default Data]
+ftp-data 20/udp
+ftp 21/tcp # File Transfer [Control]
+ftp 21/udp fsp fspd
+ssh 22/tcp # SSH Remote Login Protocol
+ssh 22/udp
+telnet 23/tcp # Telnet
+telnet 23/udp
+# private 24/tcp # any private mail system
+# private 24/udp
+smtp 25/tcp mail # Simple Mail Transfer
+smtp 25/udp
+nsw-fe 27/tcp # NSW User System FE
+nsw-fe 27/udp
+msg-icp 29/tcp # MSG ICP
+msg-icp 29/udp
+msg-auth 31/tcp # MSG Authentication
+msg-auth 31/udp
+dsp 33/tcp # Display Support Protocol
+dsp 33/udp
+# private 35/tcp # any private printer server
+# private 35/udp
+time 37/tcp timserver
+time 37/udp timserver
+rap 38/tcp # Route Access Protocol
+rap 38/udp
+rlp 39/tcp resource # Resource Location Protocol
+rlp 39/udp resource
+graphics 41/tcp # Graphics
+graphics 41/udp
+nameserver 42/tcp name # Host Name Server
+nameserver 42/udp name
+nicname 43/tcp whois # Who Is
+nicname 43/udp whois
+mpm-flags 44/tcp # MPM FLAGS Protocol
+mpm-flags 44/udp
+mpm 45/tcp # Message Processing Module [recv]
+mpm 45/udp
+mpm-snd 46/tcp # MPM [default send]
+mpm-snd 46/udp
+ni-ftp 47/tcp # NI FTP
+ni-ftp 47/udp
+auditd 48/tcp # Digital Audit Daemon
+auditd 48/udp
+tacacs 49/tcp # Login Host Protocol (TACACS)
+tacacs 49/udp
+re-mail-ck 50/tcp # Remote Mail Checking Protocol
+re-mail-ck 50/udp
+domain 53/tcp # Domain Name Server
+domain 53/udp
+xns-ch 54/tcp # XNS Clearinghouse
+xns-ch 54/udp
+isi-gl 55/tcp # ISI Graphics Language
+isi-gl 55/udp
+xns-auth 56/tcp # XNS Authentication
+xns-auth 56/udp
+# private 57/tcp # any private terminal access
+# private 57/udp
+xns-mail 58/tcp # XNS Mail
+xns-mail 58/udp
+# private 59/tcp # any private file service
+# private 59/udp
+ni-mail 61/tcp # NI MAIL
+ni-mail 61/udp
+acas 62/tcp # ACA Services
+acas 62/udp
+whois++ 63/tcp # whois++
+whois++ 63/udp
+covia 64/tcp # Communications Integrator (CI)
+covia 64/udp
+tacacs-ds 65/tcp # TACACS-Database Service
+tacacs-ds 65/udp
+sql*net 66/tcp # Oracle SQL*NET
+sql*net 66/udp
+bootps 67/tcp # Bootstrap Protocol Server (BOOTP)
+bootps 67/udp
+bootpc 68/tcp # Bootstrap Protocol Client (BOOTP)
+bootpc 68/udp
+tftp 69/tcp # Trivial File Transfer
+tftp 69/udp
+gopher 70/tcp # Gopher
+gopher 70/udp
+netrjs-1 71/tcp # Remote Job Service
+netrjs-1 71/udp
+netrjs-2 72/tcp
+netrjs-2 72/udp
+netrjs-3 73/tcp
+netrjs-3 73/udp
+netrjs-4 74/tcp
+netrjs-4 74/udp
+# private 75/tcp # any private dial out service
+# private 75/udp
+deos 76/tcp # Distributed External Object Store
+deos 76/udp
+# private 77/tcp # any private RJE service
+# private 77/udp
+vettcp 78/tcp # vettcp
+vettcp 78/udp
+finger 79/tcp # Finger
+finger 79/udp
+http 80/tcp www www-http # World Wide Web HTTP
+http 80/udp www www-http
+hosts2-ns 81/tcp # HOSTS2 Name Server
+hosts2-ns 81/udp
+xfer 82/tcp # XFER Utility
+xfer 82/udp
+mit-ml-dev 83/tcp # MIT ML Device
+mit-ml-dev 83/udp
+ctf 84/tcp # Common Trace Facility
+ctf 84/udp
+mit-ml-dev 85/tcp # MIT ML Device
+mit-ml-dev 85/udp
+mfcobol 86/tcp # Micro Focus Cobol
+mfcobol 86/udp
+# private 87/tcp # any private terminal link
+# private 87/udp
+kerberos 88/tcp kerberos5 krb5 # Kerberos
+kerberos 88/udp kerberos5 krb5
+su-mit-tg 89/tcp # SU/MIT Telnet Gateway
+su-mit-tg 89/udp
+dnsix 90/tcp # DNSIX Securit Attribute Token Map
+dnsix 90/udp
+mit-dov 91/tcp # MIT Dover Spooler
+mit-dov 91/udp
+npp 92/tcp # Network Printing Protocol
+npp 92/udp
+dcp 93/tcp # Device Control Protocol
+dcp 93/udp
+objcall 94/tcp # Tivoli Object Dispatcher
+objcall 94/udp
+supdup 95/tcp # SUPDUP
+supdup 95/udp
+dixie 96/tcp # DIXIE Protocol Specification
+dixie 96/udp
+swift-rvf 97/tcp # Swift Remote Virtural File Protocol
+swift-rvf 97/udp
+tacnews 98/tcp linuxconf # TAC News
+tacnews 98/udp
+metagram 99/tcp # Metagram Relay
+metagram 99/udp
+#newacct 100/tcp # [unauthorized use]
+hostname 101/tcp hostnames # NIC Host Name Server
+hostname 101/udp hostnames
+iso-tsap 102/tcp tsap # ISO-TSAP Class 0
+iso-tsap 102/udp tsap
+gppitnp 103/tcp # Genesis Point-to-Point Trans Net
+gppitnp 103/udp
+acr-nema 104/tcp # ACR-NEMA Digital Imag. & Comm. 300
+acr-nema 104/udp
+cso 105/tcp csnet-ns cso-ns # CCSO name server protocol
+cso 105/udp csnet-ns cso-ns
+3com-tsmux 106/tcp poppassd # 3COM-TSMUX
+3com-tsmux 106/udp poppassd # Eudora: Unauthorized use by insecure poppassd protocol
+rtelnet 107/tcp # Remote Telnet Service
+rtelnet 107/udp
+snagas 108/tcp # SNA Gateway Access Server
+snagas 108/udp
+pop2 109/tcp pop-2 postoffice # Post Office Protocol - Version 2
+pop2 109/udp pop-2
+pop3 110/tcp pop-3 # Post Office Protocol - Version 3
+pop3 110/udp pop-3
+sunrpc 111/tcp portmapper rpcbind # SUN Remote Procedure Call
+sunrpc 111/udp portmapper rpcbind
+mcidas 112/tcp # McIDAS Data Transmission Protocol
+mcidas 112/udp
+auth 113/tcp authentication tap ident # Authentication Service
+auth 113/udp
+sftp 115/tcp # Simple File Transfer Protocol
+sftp 115/udp
+ansanotify 116/tcp # ANSA REX Notify
+ansanotify 116/udp
+uucp-path 117/tcp # UUCP Path Service
+uucp-path 117/udp
+sqlserv 118/tcp # SQL Services
+sqlserv 118/udp
+nntp 119/tcp readnews untp # Network News Transfer Protocol
+nntp 119/udp readnews untp
+cfdptkt 120/tcp # CFDPTKT
+cfdptkt 120/udp
+erpc 121/tcp # Encore Expedited Remote Pro.Call
+erpc 121/udp
+smakynet 122/tcp # SMAKYNET
+smakynet 122/udp
+ntp 123/tcp # Network Time Protocol
+ntp 123/udp
+ansatrader 124/tcp # ANSA REX Trader
+ansatrader 124/udp
+locus-map 125/tcp # Locus PC-Interface Net Map Ser
+locus-map 125/udp
+nxedit 126/tcp unitary # NXEdit
+nxedit 126/udp unitary # Unisys Unitary Login
+locus-con 127/tcp # Locus PC-Interface Conn Server
+locus-con 127/udp
+gss-xlicen 128/tcp # GSS X License Verification
+gss-xlicen 128/udp
+pwdgen 129/tcp # Password Generator Protocol
+pwdgen 129/udp
+cisco-fna 130/tcp # cisco FNATIVE
+cisco-fna 130/udp
+cisco-tna 131/tcp # cisco TNATIVE
+cisco-tna 131/udp
+cisco-sys 132/tcp # cisco SYSMAINT
+cisco-sys 132/udp
+statsrv 133/tcp # Statistics Service
+statsrv 133/udp
+ingres-net 134/tcp # INGRES-NET Service
+ingres-net 134/udp
+epmap 135/tcp loc-srv # DCE endpoint resolution
+epmap 135/udp loc-srv
+profile 136/tcp # PROFILE Naming System
+profile 136/udp
+netbios-ns 137/tcp # NETBIOS Name Service
+netbios-ns 137/udp
+netbios-dgm 138/tcp # NETBIOS Datagram Service
+netbios-dgm 138/udp
+netbios-ssn 139/tcp # NETBIOS Session Service
+netbios-ssn 139/udp
+emfis-data 140/tcp # EMFIS Data Service
+emfis-data 140/udp
+emfis-cntl 141/tcp # EMFIS Control Service
+emfis-cntl 141/udp
+imap 143/tcp imap2 # Internet Message Access Protocol
+imap 143/udp imap2
+uma 144/tcp # Universal Management Architecture
+uma 144/udp
+uaac 145/tcp # UAAC Protocol
+uaac 145/udp
+iso-tp0 146/tcp # ISO-TP0
+iso-tp0 146/udp
+iso-ip 147/tcp # ISO-IP
+iso-ip 147/udp
+jargon 148/tcp # Jargon
+jargon 148/udp
+aed-512 149/tcp # AED 512 Emulation Service
+aed-512 149/udp
+sql-net 150/tcp # SQL-NET
+sql-net 150/udp
+hems 151/tcp # HEMS
+hems 151/udp
+bftp 152/tcp # Background File Transfer Program
+bftp 152/udp
+sgmp 153/tcp # SGMP
+sgmp 153/udp
+netsc-prod 154/tcp # NETSC
+netsc-prod 154/udp
+netsc-dev 155/tcp
+netsc-dev 155/udp
+sqlsrv 156/tcp # SQL Service
+sqlsrv 156/udp
+knet-cmp 157/tcp # KNET/VM Command/Message Protocol
+knet-cmp 157/udp
+pcmail-srv 158/tcp # PCMail Server
+pcmail-srv 158/udp
+nss-routing 159/tcp # NSS-Routing
+nss-routing 159/udp
+sgmp-traps 160/tcp # SGMP-TRAPS
+sgmp-traps 160/udp
+snmp 161/tcp # Simple Net Mgmt Proto
+snmp 161/udp
+snmptrap 162/tcp snmp-trap # Traps for SNMP
+snmptrap 162/udp snmp-trap
+cmip-man 163/tcp # CMIP/TCP Manager
+cmip-man 163/udp
+cmip-agent 164/tcp # CMIP/TCP Agent
+cmip-agent 164/udp
+xns-courier 165/tcp # Xerox
+xns-courier 165/udp
+s-net 166/tcp # Sirius Systems
+s-net 166/udp
+namp 167/tcp # NAMP
+namp 167/udp
+rsvd 168/tcp # RSVD
+rsvd 168/udp
+send 169/tcp # SEND
+send 169/udp
+print-srv 170/tcp # Network PostScript
+print-srv 170/udp
+multiplex 171/tcp # Network Innovations Multiplex
+multiplex 171/udp
+cl/1 172/tcp # Network Innovations CL/1
+cl/1 172/udp
+xyplex-mux 173/tcp # Xyplex
+xyplex-mux 173/udp
+mailq 174/tcp # Mailer transport queue for Zmailer
+mailq 174/udp
+vmnet 175/tcp # VMNET
+vmnet 175/udp
+genrad-mux 176/tcp # GENRAD-MUX
+genrad-mux 176/udp
+xdmcp 177/tcp # X Display Manager Control Protocol
+xdmcp 177/udp
+nextstep 178/tcp NeXTStep NextStep # NextStep Window Server
+nextstep 178/udp NeXTStep NextStep
+bgp 179/tcp # Border Gateway Protocol
+bgp 179/udp
+ris 180/tcp # Intergraph
+ris 180/udp
+unify 181/tcp # Unify
+unify 181/udp
+audit 182/tcp # Unisys Audit SITP
+audit 182/udp
+ocbinder 183/tcp # OCBinder
+ocbinder 183/udp
+ocserver 184/tcp # OCServer
+ocserver 184/udp
+remote-kis 185/tcp # Remote-KIS
+remote-kis 185/udp
+kis 186/tcp # KIS Protocol
+kis 186/udp
+aci 187/tcp # Application Communication Interface
+aci 187/udp
+mumps 188/tcp # Plus Five's MUMPS
+mumps 188/udp
+qft 189/tcp # Queued File Transport
+qft 189/udp
+gacp 190/tcp # Gateway Access Control Protocol
+gacp 190/udp
+prospero 191/tcp # Prospero Directory Service
+prospero 191/udp
+osu-nms 192/tcp # OSU Network Monitoring System
+osu-nms 192/udp
+srmp 193/tcp # Spider Remote Monitoring Protocol
+srmp 193/udp
+irc 194/tcp # Internet Relay Chat Protocol
+irc 194/udp
+dn6-nlm-aud 195/tcp # DNSIX Network Level Module Audit
+dn6-nlm-aud 195/udp
+dn6-smm-red 196/tcp # DNSIX Session Mgt Module Audit Redir
+dn6-smm-red 196/udp
+dls 197/tcp # Directory Location Service
+dls 197/udp
+dls-mon 198/tcp # Directory Location Service Monitor
+dls-mon 198/udp
+smux 199/tcp # SNMP Unix Multiplexer
+smux 199/udp
+src 200/tcp # IBM System Resource Controller
+src 200/udp
+at-rtmp 201/tcp # AppleTalk Routing Maintenance
+at-rtmp 201/udp
+at-nbp 202/tcp # AppleTalk Name Binding
+at-nbp 202/udp
+at-echo 204/tcp # AppleTalk Echo
+at-echo 204/udp
+at-zis 206/tcp # AppleTalk Zone Information
+at-zis 206/udp
+qmtp 209/tcp # The Quick Mail Transfer Protocol
+qmtp 209/udp
+z39.50 210/tcp wais z3950 # ANSI Z39.50
+z39.50 210/udp wais z3950
+914c/g 211/tcp # Texas Instruments 914C/G Terminal
+914c/g 211/udp
+anet 212/tcp # ATEXSSTR
+anet 212/udp
+ipx 213/tcp # IPX
+ipx 213/udp
+imap3 220/tcp # Interactive Mail Access
+imap3 220/udp
+link 245/tcp # ttylink
+link 245/udp
+pawserv 345/tcp # Perf Analysis Workbench
+pawserv 345/udp
+zserv 346/tcp # Zebra server
+zserv 346/udp
+fatserv 347/tcp # Fatmen Server
+fatserv 347/udp
+scoi2odialog 360/tcp # scoi2odialog
+scoi2odialog 360/udp
+semantix 361/tcp # Semantix
+semantix 361/udp
+srssend 362/tcp # SRS Send
+srssend 362/udp
+rsvp_tunnel 363/tcp # RSVP Tunnel
+rsvp_tunnel 363/udp
+aurora-cmgr 364/tcp # Aurora CMGR
+aurora-cmgr 364/udp
+dtk 365/tcp # Deception Tool Kit
+dtk 365/udp
+odmr 366/tcp # ODMR
+odmr 366/udp
+rpc2portmap 369/tcp # Coda portmapper
+rpc2portmap 369/udp
+codaauth2 370/tcp # Coda authentication server
+codaauth2 370/udp
+clearcase 371/tcp # Clearcase
+clearcase 371/udp
+ulistproc 372/tcp ulistserv # UNIX Listserv
+ulistproc 372/udp ulistserv
+ldap 389/tcp # Lightweight Directory Access Protocol
+ldap 389/udp
+imsp 406/tcp # Interactive Mail Support Protocol
+imsp 406/udp
+svrloc 427/tcp # Server Location
+svrloc 427/udp
+mobileip-agent 434/tcp # MobileIP-Agent
+mobileip-agent 434/udp
+mobilip-mn 435/tcp # MobilIP-MN
+mobilip-mn 435/udp
+https 443/tcp # MCom
+https 443/udp
+snpp 444/tcp # Simple Network Paging Protocol
+snpp 444/udp
+microsoft-ds 445/tcp Microsoft-DS
+microsoft-ds 445/udp Microsoft-DS
+kpasswd 464/tcp kpwd # Kerberos "passwd"
+kpasswd 464/udp kpwd
+urd 465/tcp smtps ssmtp # URL Rendesvous Directory for SSM / smtp protocol over TLS/SSL
+igmpv3lite 465/udp smtps ssmtp # IGMP over UDP for SSM
+photuris 468/tcp
+photuris 468/udp
+rcp 469/tcp # Radio Control Protocol
+rcp 469/udp
+saft 487/tcp # Simple Asynchronous File Transfer
+saft 487/udp
+gss-http 488/tcp
+gss-http 488/udp
+pim-rp-disc 496/tcp
+pim-rp-disc 496/udp
+isakmp 500/tcp # IPsec - Internet Security Association and Key Management Protocol
+isakmp 500/udp
+exec 512/tcp # remote process execution
+comsat 512/udp biff # notify users of new mail received
+login 513/tcp # remote login a la telnet
+who 513/udp whod # who's logged in to machines
+shell 514/tcp cmd # no passwords used
+syslog 514/udp
+printer 515/tcp spooler # line printer spooler
+printer 515/udp spooler
+videotex 516/tcp
+videotex 516/udp
+talk 517/tcp # like tenex link
+talk 517/udp
+ntalk 518/tcp
+ntalk 518/udp
+utime 519/tcp unixtime
+utime 519/udp unixtime
+efs 520/tcp # extended file name server
+router 520/udp route routed # local routing process
+ripng 521/tcp
+ripng 521/udp
+ulp 522/tcp
+ulp 522/udp
+ibm-db2 523/tcp
+ibm-db2 523/udp
+ncp 524/tcp
+ncp 524/udp
+timed 525/tcp timeserver
+timed 525/udp timeserver
+tempo 526/tcp newdate
+tempo 526/udp newdate
+courier 530/tcp rpc
+courier 530/udp rpc
+conference 531/tcp chat
+conference 531/udp chat
+netnews 532/tcp readnews
+netnews 532/udp readnews
+netwall 533/tcp # -for emergency broadcasts
+netwall 533/udp
+mm-admin 534/tcp # MegaMedia Admin
+mm-admin 534/udp
+iiop 535/tcp
+iiop 535/udp
+opalis-rdv 536/tcp
+opalis-rdv 536/udp
+nmsp 537/tcp # Networked Media Streaming Protocol
+nmsp 537/udp
+gdomap 538/tcp # GNUstep distributed objects
+gdomap 538/udp
+uucp 540/tcp uucpd # uucp daemon
+uucp 540/udp uucpd
+klogin 543/tcp # Kerberized `rlogin' (v5)
+klogin 543/udp
+kshell 544/tcp krcmd # Kerberized `rsh' (v5)
+kshell 544/udp krcmd
+appleqtcsrvr 545/tcp
+appleqtcsrvr 545/udp
+dhcpv6-client 546/tcp # DHCPv6 Client
+dhcpv6-client 546/udp
+dhcpv6-server 547/tcp # DHCPv6 Server
+dhcpv6-server 547/udp
+afpovertcp 548/tcp # AFP over TCP
+afpovertcp 548/udp
+rtsp 554/tcp # Real Time Stream Control Protocol
+rtsp 554/udp
+dsf 555/tcp
+dsf 555/udp
+remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
+remotefs 556/udp rfs_server rfs
+nntps 563/tcp snntp # NNTP over SSL
+nntps 563/udp snntp
+9pfs 564/tcp # plan 9 file service
+9pfs 564/udp
+whoami 565/tcp
+whoami 565/udp
+submission 587/tcp # mail message submission
+submission 587/udp
+http-alt 591/tcp # FileMaker, Inc. - HTTP Alternate
+http-alt 591/udp
+nqs 607/tcp # Network Queuing system
+nqs 607/udp
+npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS
+npmp-local 610/udp dqs313_qmaster
+npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS
+npmp-gui 611/udp dqs313_execd
+hmmp-ind 612/tcp dqs313_intercell # HMMP Indication / DQS
+hmmp-ind 612/udp dqs313_intercell
+cryptoadmin 624/tcp # Crypto Admin
+cryptoadmin 624/udp
+dec_dlm 625/tcp # DEC DLM
+dec_dlm 625/udp
+asia 626/tcp
+asia 626/udp
+passgo-tivoli 627/tcp # PassGo Tivoli
+passgo-tivoli 627/udp
+qmqp 628/tcp # Qmail QMQP
+qmqp 628/udp
+3com-amp3 629/tcp
+3com-amp3 629/udp
+rda 630/tcp
+rda 630/udp
+ipp 631/tcp # Internet Printing Protocol
+ipp 631/udp
+ldaps 636/tcp # LDAP over SSL
+ldaps 636/udp
+tinc 655/tcp # TINC control port
+tinc 655/udp
+acap 674/tcp # Application Configuration Access Protocol
+acap 674/udp
+asipregistry 687/tcp
+asipregistry 687/udp
+realm-rusd 688/tcp # ApplianceWare managment protocol
+realm-rusd 688/udp
+nmap 689/tcp # Opensource Network Mapper
+nmap 689/udp
+ha-cluster 694/tcp # Heartbeat HA-cluster
+ha-cluster 694/udp
+epp 700/tcp # Extensible Provisioning Protocol
+epp 700/udp
+iris-beep 702/tcp # IRIS over BEEP
+iris-beep 702/udp
+silc 706/tcp # SILC
+silc 706/udp
+kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
+kerberos-adm 749/udp
+kerberos-iv 750/tcp kerberos4 kdc # Kerberos (server)
+kerberos-iv 750/udp kerberos4 kdc
+pump 751/tcp kerberos_master
+pump 751/udp kerberos_master # Kerberos authentication
+qrh 752/tcp passwd_server
+qrh 752/udp passwd_server # Kerberos passwd server
+rrh 753/tcp
+rrh 753/udp
+tell 754/tcp send krb_prop krb5_prop # Kerberos slave propagation
+tell 754/udp send
+nlogin 758/tcp
+nlogin 758/udp
+con 759/tcp
+con 759/udp
+ns 760/tcp krbupdate kreg # Kerberos registration
+ns 760/udp
+webster 765/tcp # Network dictionary
+webster 765/udp
+phonebook 767/tcp # Network phonebook
+phonebook 767/udp
+rsync 873/tcp # rsync
+rsync 873/udp
+ftps-data 989/tcp # ftp protocol, data, over TLS/SSL
+ftps-data 989/udp
+ftps 990/tcp # ftp protocol, control, over TLS/SSL
+ftps 990/udp
+nas 991/tcp # Netnews Administration System
+nas 991/udp
+telnets 992/tcp # telnet protocol over TLS/SSL
+telnets 992/udp
+imaps 993/tcp # imap4 protocol over TLS/SSL
+imaps 993/udp
+ircs 994/tcp # irc protocol over TLS/SSL
+ircs 994/udp
+pop3s 995/tcp # pop3 protocol over TLS/SSL
+pop3s 995/udp
+
+#
+# IANA Assignments [Registered Ports]
+#
+# The Registered Ports are listed by the IANA and on most systems can be
+# used by ordinary user processes or programs executed by ordinary
+# users.
+# Ports are used in the TCP [RFC793] to name the ends of logical
+# connections which carry long term conversations. For the purpose of
+# providing services to unknown callers, a service contact port is
+# defined. This list specifies the port used by the server process as
+# its contact port.
+# The IANA registers uses of these ports as a convenience to the
+# community.
+# To the extent possible, these same port assignments are used with the
+# UDP [RFC768].
+# The Registered Ports are in the range 1024-49151.
+#
+imgames 1077/tcp
+imgames 1077/udp
+socks 1080/tcp # socks proxy server
+socks 1080/udp
+rmiregistry 1099/tcp # Java RMI Registry
+rmiregistry 1099/udp
+bnetgame 1119/tcp # Battle.net Chat/Game Protocol
+bnetgame 1119/udp
+bnetfile 1120/tcp # Battle.net File Transfer Protocol
+bnetfile 1120/udp
+hpvmmcontrol 1124/tcp # HP VMM Control
+hpvmmcontrol 1124/udp
+hpvmmagent 1125/tcp # HP VMM Agent
+hpvmmagent 1125/udp
+hpvmmdata 1126/tcp # HP VMM Agent
+hpvmmdata 1126/udp
+resacommunity 1154/tcp # Community Service
+resacommunity 1154/udp
+3comnetman 1181/tcp # 3Com Net Management
+3comnetman 1181/udp
+mysql-cluster 1186/tcp # MySQL Cluster Manager
+mysql-cluster 1186/udp
+alias 1187/tcp # Alias Service
+alias 1187/udp
+openvpn 1194/tcp # OpenVPN
+openvpn 1194/udp
+kazaa 1214/tcp # KAZAA
+kazaa 1214/udp
+bvcontrol 1236/tcp rmtcfg # Gracilis Packeten remote config server
+bvcontrol 1236/udp rmtcfg
+nessus 1241/tcp # Nessus vulnerability assessment scanner
+nessus 1241/udp
+h323hostcallsc 1300/tcp # H323 Host Call Secure
+h323hostcallsc 1300/udp
+lotusnote 1352/tcp # Lotus Note
+lotusnote 1352/udp
+ms-sql-s 1433/tcp # Microsoft-SQL-Server
+ms-sql-s 1433/udp
+ms-sql-m 1434/tcp # Microsoft-SQL-Monitor
+ms-sql-m 1434/udp
+ica 1494/tcp # Citrix ICA Client
+ica 1494/udp
+wins 1512/tcp # Microsoft's Windows Internet Name Service
+wins 1512/udp
+ingreslock 1524/tcp
+ingreslock 1524/udp
+prospero-np 1525/tcp # Prospero non-privileged
+prospero-np 1525/udp
+datametrics 1645/tcp old-radius # datametrics / old radius entry
+datametrics 1645/udp old-radius
+sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry
+sa-msg-port 1646/udp old-radacct
+rsap 1647/tcp
+rsap 1647/udp
+concurrent-lm 1648/tcp
+concurrent-lm 1648/udp
+kermit 1649/tcp
+kermit 1649/udp
+l2tp 1701/tcp
+l2tp 1701/udp
+h323gatedisc 1718/tcp
+h323gatedisc 1718/udp
+h323gatestat 1719/tcp
+h323gatestat 1719/udp
+h323hostcall 1720/tcp
+h323hostcall 1720/udp
+iberiagames 1726/tcp
+iberiagames 1726/udp
+gamegen1 1738/tcp
+gamegen1 1738/udp
+tftp-mcast 1758/tcp
+tftp-mcast 1758/udp
+hello 1789/tcp
+hello 1789/udp
+radius 1812/tcp # Radius
+radius 1812/udp
+radius-acct 1813/tcp radacct # Radius Accounting
+radius-acct 1813/udp radacct
+mtp 1911/tcp # Starlight Networks Multimedia Transport Protocol
+mtp 1911/udp
+egs 1926/tcp # Evolution Game Server
+egs 1926/udp
+unix-status 1957/tcp # remstats unix-status server
+unix-status 1957/udp
+hsrp 1985/tcp # Hot Standby Router Protocol
+hsrp 1985/udp
+licensedaemon 1986/tcp # cisco license management
+licensedaemon 1986/udp
+tr-rsrb-p1 1987/tcp # cisco RSRB Priority 1 port
+tr-rsrb-p1 1987/udp
+tr-rsrb-p2 1988/tcp # cisco RSRB Priority 2 port
+tr-rsrb-p2 1988/udp
+tr-rsrb-p3 1989/tcp # cisco RSRB Priority 3 port
+tr-rsrb-p3 1989/udp
+stun-p1 1990/tcp # cisco STUN Priority 1 port
+stun-p1 1990/udp
+stun-p2 1991/tcp # cisco STUN Priority 2 port
+stun-p2 1991/udp
+stun-p3 1992/tcp # cisco STUN Priority 3 port
+stun-p3 1992/udp
+snmp-tcp-port 1994/tcp # cisco SNMP TCP port
+snmp-tcp-port 1994/udp
+stun-port 1995/tcp # cisco serial tunnel port
+stun-port 1995/udp
+perf-port 1996/tcp # cisco Remote SRB port
+perf-port 1996/udp
+gdp-port 1997/tcp # cisco Gateway Discovery Protocol
+gdp-port 1997/udp
+x25-svc-port 1998/tcp # cisco X.25 service (XOT)
+x25-svc-port 1998/udp
+tcp-id-port 1999/tcp # cisco identification port
+tcp-id-port 1999/udp
+cisco-sccp 2000/tcp sieve # Cisco SCCP
+cisco-sccp 2000/udp sieve
+nfs 2049/tcp # Network File System
+nfs 2049/udp
+radsec 2083/tcp # Secure Radius Service
+radsec 2083/udp
+gnunet 2086/tcp # GNUnet
+gnunet 2086/udp
+rtcm-sc104 2101/tcp # RTCM SC-104
+rtcm-sc104 2101/udp
+zephyr-srv 2102/tcp # Zephyr server
+zephyr-srv 2102/udp
+zephyr-clt 2103/tcp # Zephyr serv-hm connection
+zephyr-clt 2103/udp
+zephyr-hm 2104/tcp # Zephyr hostmanager
+zephyr-hm 2104/udp
+eyetv 2170/tcp # EyeTV Server Port
+eyetv 2170/udp
+msfw-storage 2171/tcp # MS Firewall Storage
+msfw-storage 2171/udp
+msfw-s-storage 2172/tcp # MS Firewall SecureStorage
+msfw-s-storage 2172/udp
+msfw-replica 2173/tcp # MS Firewall Replication
+msfw-replica 2173/udp
+msfw-array 2174/tcp # MS Firewall Intra Array
+msfw-array 2174/udp
+airsync 2175/tcp # Microsoft Desktop AirSync Protocol
+airsync 2175/udp
+rapi 2176/tcp # Microsoft ActiveSync Remote API
+rapi 2176/udp
+qwave 2177/tcp # qWAVE Bandwidth Estimate
+qwave 2177/udp
+tivoconnect 2190/tcp # TiVoConnect Beacon
+tivoconnect 2190/udp
+tvbus 2191/tcp # TvBus Messaging
+tvbus 2191/udp
+mysql-im 2273/tcp # MySQL Instance Manager
+mysql-im 2273/udp
+dict-lookup 2289/tcp # Lookup dict server
+dict-lookup 2289/udp
+redstorm_join 2346/tcp # Game Connection Port
+redstorm_join 2346/udp
+redstorm_find 2347/tcp # Game Announcement and Location
+redstorm_find 2347/udp
+redstorm_info 2348/tcp # Information to query for game status
+redstorm_info 2348/udp
+cvspserver 2401/tcp # CVS client/server operations
+cvspserver 2401/udp
+venus 2430/tcp # codacon port
+venus 2430/udp
+venus-se 2431/tcp # tcp side effects
+venus-se 2431/udp
+codasrv 2432/tcp # not used
+codasrv 2432/udp
+codasrv-se 2433/tcp # tcp side effects
+codasrv-se 2433/udp
+netadmin 2450/tcp
+netadmin 2450/udp
+netchat 2451/tcp
+netchat 2451/udp
+snifferclient 2452/tcp
+snifferclient 2452/udp
+ppcontrol 2505/tcp # PowerPlay Control
+ppcontrol 2505/udp
+lstp 2559/tcp
+lstp 2559/udp
+mon 2583/tcp
+mon 2583/udp
+hpstgmgr 2600/tcp zebrasrv
+hpstgmgr 2600/udp zebrasrv
+discp-client 2601/tcp zebra # discp client
+discp-client 2601/udp zebra
+discp-server 2602/tcp ripd # discp server
+discp-server 2602/udp ripd
+servicemeter 2603/tcp ripngd # Service Meter
+servicemeter 2603/udp ripngd
+nsc-ccs 2604/tcp ospfd # NSC CCS
+nsc-ccs 2604/udp ospfd
+nsc-posa 2605/tcp bgpd # NSC POSA
+nsc-posa 2605/udp bgpd
+netmon 2606/tcp ospf6d # Dell Netmon
+netmon 2606/udp ospf6d
+connection 2607/tcp # Dell Connection
+connection 2607/udp
+wag-service 2608/tcp # Wag Service
+wag-service 2608/udp
+dict 2628/tcp # Dictionary server
+dict 2628/udp
+exce 2769/tcp # eXcE
+exce 2769/udp
+dvr-esm 2804/tcp # March Networks Digital Video Recorders and Enterprise Service Manager products
+dvr-esm 2804/udp
+corbaloc 2809/tcp # CORBA LOC
+corbaloc 2809/udp
+ndtp 2882/tcp # Network Dictionary Transfer Protocol
+ndtp 2882/udp
+gamelobby 2914/tcp # Game Lobby
+gamelobby 2914/udp
+gds_db 3050/tcp # InterBase server
+gds_db 3050/udp
+xbox 3074/tcp # Xbox game port
+xbox 3074/udp
+icpv2 3130/tcp icp # Internet Cache Protocol (Squid)
+icpv2 3130/udp icp
+nm-game-admin 3148/tcp # NetMike Game Administrator
+nm-game-admin 3148/udp
+nm-game-server 3149/tcp # NetMike Game Server
+nm-game-server 3149/udp
+mysql 3306/tcp # MySQL
+mysql 3306/udp
+sftu 3326/tcp
+sftu 3326/udp
+trnsprntproxy 3346/tcp # Transparent Proxy
+trnsprntproxy 3346/udp
+ms-wbt-server 3389/tcp rdp # MS WBT Server
+ms-wbt-server 3389/udp rdp # Microsoft Remote Desktop Protocol
+prsvp 3455/tcp # RSVP Port
+prsvp 3455/udp
+nut 3493/tcp # Network UPS Tools
+nut 3493/udp
+ironstorm 3504/tcp # IronStorm game server
+ironstorm 3504/udp
+cctv-port 3559/tcp # CCTV control port
+cctv-port 3559/udp
+iw-mmogame 3596/tcp # Illusion Wireless MMOG
+iw-mmogame 3596/udp
+distcc 3632/tcp # Distributed Compiler
+distcc 3632/udp
+daap 3689/tcp # Digital Audio Access Protocol
+daap 3689/udp
+svn 3690/tcp # Subversion
+svn 3690/udp
+blizwow 3724/tcp # World of Warcraft
+blizwow 3724/udp
+netboot-pxe 3928/tcp pxe # PXE NetBoot Manager
+netboot-pxe 3928/udp pxe
+smauth-port 3929/tcp # AMS Port
+smauth-port 3929/udp
+treehopper 3959/tcp # Tree Hopper Networking
+treehopper 3959/udp
+cobraclient 3970/tcp # Cobra Client
+cobraclient 3970/udp
+cobraserver 3971/tcp # Cobra Server
+cobraserver 3971/udp
+pxc-spvr-ft 4002/tcp pxc-spvr-ft
+pxc-spvr-ft 4002/udp pxc-spvr-ft
+pxc-splr-ft 4003/tcp pxc-splr-ft rquotad
+pxc-splr-ft 4003/udp pxc-splr-ft rquotad
+pxc-roid 4004/tcp pxc-roid
+pxc-roid 4004/udp pxc-roid
+pxc-pin 4005/tcp pxc-pin
+pxc-pin 4005/udp pxc-pin
+pxc-spvr 4006/tcp pxc-spvr
+pxc-spvr 4006/udp pxc-spvr
+pxc-splr 4007/tcp pxc-splr
+pxc-splr 4007/udp pxc-splr
+xgrid 4111/tcp # Mac OS X Server Xgrid
+xgrid 4111/udp
+bzr 4155/tcp # Bazaar Version Control System
+bzr 4155/udp # Bazaar version control system
+rwhois 4321/tcp # Remote Who Is
+rwhois 4321/udp
+epmd 4369/tcp # Erlang Port Mapper Daemon
+epmd 4369/udp
+krb524 4444/tcp
+krb524 4444/udp
+ipsec-nat-t 4500/tcp # IPsec NAT-Traversal
+ipsec-nat-t 4500/udp
+hylafax 4559/tcp # HylaFAX client-server protocol (new)
+hylafax 4559/udp
+piranha1 4600/tcp
+piranha1 4600/udp
+playsta2-app 4658/tcp # PlayStation2 App Port
+playsta2-app 4658/udp
+playsta2-lob 4659/tcp # PlayStation2 Lobby Port
+playsta2-lob 4659/udp
+snap 4752/tcp # Simple Network Audio Protocol
+snap 4752/udp
+radmin-port 4899/tcp # RAdmin Port
+radmin-port 4899/udp
+rfe 5002/tcp # Radio Free Ethernet
+rfe 5002/udp
+ita-agent 5051/tcp # ITA Agent
+ita-agent 5051/udp
+sdl-ets 5081/tcp # SDL - Ent Trans Server
+sdl-ets 5081/udp
+bzflag 5154/tcp # BZFlag game server
+bzflag 5154/udp
+aol 5190/tcp # America-Online
+aol 5190/udp
+xmpp-client 5222/tcp # XMPP Client Connection
+xmpp-client 5222/udp
+caevms 5251/tcp # CA eTrust VM Service
+caevms 5251/udp
+xmpp-server 5269/tcp # XMPP Server Connection
+xmpp-server 5269/udp
+cfengine 5308/tcp # CFengine
+cfengine 5308/udp
+nat-pmp 5351/tcp # NAT Port Mapping Protocol
+nat-pmp 5351/udp
+dns-llq 5352/tcp # DNS Long-Lived Queries
+dns-llq 5352/udp
+mdns 5353/tcp # Multicast DNS
+mdns 5353/udp
+mdnsresponder 5354/tcp noclog # Multicast DNS Responder IPC
+mdnsresponder 5354/udp noclog # noclogd with TCP (nocol)
+llmnr 5355/tcp hostmon # Link-Local Multicast Name Resolution
+llmnr 5355/udp hostmon # hostmon uses TCP (nocol)
+dj-ice 5419/tcp
+dj-ice 5419/udp
+beyond-remote 5424/tcp # Beyond Remote
+beyond-remote 5424/udp
+br-channel 5425/tcp # Beyond Remote Command Channel
+br-channel 5425/udp
+postgresql 5432/tcp # POSTGRES
+postgresql 5432/udp
+sgi-eventmond 5553/tcp # SGI Eventmond Port
+sgi-eventmond 5553/udp
+sgi-esphttp 5554/tcp # SGI ESP HTTP
+sgi-esphttp 5554/udp
+cvsup 5999/tcp # CVSup
+cvsup 5999/udp
+x11 6000/tcp # X Window System
+x11 6000/udp
+kftp-data 6620/tcp # Kerberos V5 FTP Data
+kftp-data 6620/udp
+kftp 6621/tcp # Kerberos V5 FTP Control
+kftp 6621/udp
+ktelnet 6623/tcp # Kerberos V5 Telnet
+ktelnet 6623/udp
+gnutella-svc 6346/tcp
+gnutella-svc 6346/udp
+gnutella-rtr 6347/tcp
+gnutella-rtr 6347/udp
+sane-port 6566/tcp # SANE Network Scanner Control Port
+sane-port 6566/udp
+parsec-game 6582/tcp # Parsec Gameserver
+parsec-game 6582/udp
+afs3-fileserver 7000/tcp bbs # file server itself
+afs3-fileserver 7000/udp bbs
+afs3-callback 7001/tcp # callbacks to cache managers
+afs3-callback 7001/udp
+afs3-prserver 7002/tcp # users & groups database
+afs3-prserver 7002/udp
+afs3-vlserver 7003/tcp # volume location database
+afs3-vlserver 7003/udp
+afs3-kaserver 7004/tcp # AFS/Kerberos authentication
+afs3-kaserver 7004/udp
+afs3-volser 7005/tcp # volume managment server
+afs3-volser 7005/udp
+afs3-errors 7006/tcp # error interpretation service
+afs3-errors 7006/udp
+afs3-bos 7007/tcp # basic overseer process
+afs3-bos 7007/udp
+afs3-update 7008/tcp # server-to-server updater
+afs3-update 7008/udp
+afs3-rmtsys 7009/tcp # remote cache manager service
+afs3-rmtsys 7009/udp
+font-service 7100/tcp xfs # X Font Service
+font-service 7100/udp xfs
+sncp 7560/tcp # Sniffer Command Protocol
+sncp 7560/udp
+soap-http 7627/tcp # SOAP Service Port
+soap-http 7627/udp
+http-alt 8008/tcp # HTTP Alternate
+http-alt 8008/udp
+http-alt 8080/tcp webcache # HTTP Alternate
+http-alt 8080/udp webcache # WWW caching service
+sunproxyadmin 8081/tcp tproxy # Sun Proxy Admin Service
+sunproxyadmin 8081/udp tproxy # Transparent Proxy
+pichat 9009/tcp # Pichat Server
+pichat 9009/udp
+bacula-dir 9101/tcp # Bacula Director
+bacula-dir 9101/udp
+bacula-fd 9102/tcp # Bacula File Daemon
+bacula-fd 9102/udp
+bacula-sd 9103/tcp # Bacula Storage Daemon
+bacula-sd 9103/udp
+dddp 9131/tcp # Dynamic Device Discovery
+dddp 9131/udp
+wap-wsp 9200/tcp # WAP connectionless session service
+wap-wsp 9200/udp
+wap-wsp-wtp 9201/tcp # WAP session service
+wap-wsp-wtp 9201/udp
+wap-wsp-s 9202/tcp # WAP secure connectionless session service
+wap-wsp-s 9202/udp
+wap-wsp-wtp-s 9203/tcp # WAP secure session service
+wap-wsp-wtp-s 9203/udp
+wap-vcard 9204/tcp # WAP vCard
+wap-vcard 9204/udp
+wap-vcal 9205/tcp # WAP vCal
+wap-vcal 9205/udp
+wap-vcard-s 9206/tcp # WAP vCard Secure
+wap-vcard-s 9206/udp
+wap-vcal-s 9207/tcp # WAP vCal Secure
+wap-vcal-s 9207/udp
+git 9418/tcp # git pack transfer service
+git 9418/udp
+cba8 9593/tcp # LANDesk Management Agent
+cba8 9593/udp
+davsrc 9800/tcp # WebDav Source Port
+davsrc 9800/udp
+sd 9876/tcp # Session Director
+sd 9876/udp
+cyborg-systems 9888/tcp # CYBORG Systems
+cyborg-systems 9888/udp
+monkeycom 9898/tcp # MonkeyCom
+monkeycom 9898/udp
+sctp-tunneling 9899/tcp # SCTP TUNNELING
+sctp-tunneling 9899/udp
+domaintime 9909/tcp # domaintime
+domaintime 9909/udp
+amanda 10080/tcp # amanda backup services
+amanda 10080/udp
+vce 11111/tcp # Viral Computing Environment (VCE)
+vce 11111/udp
+smsqp 11201/tcp # Alamin SMS gateway
+smsqp 11201/udp
+hkp 11371/tcp # OpenPGP HTTP Keyserver
+hkp 11371/udp
+h323callsigalt 11720/tcp # h323 Call Signal Alternate
+h323callsigalt 11720/udp
+rets-ssl 12109/tcp # RETS over SSL
+rets-ssl 12109/udp
+cawas 12168/tcp # CA Web Access Service
+cawas 12168/udp
+bprd 13720/tcp # BPRD Protocol (VERITAS NetBackup)
+bprd 13720/udp
+bpdbm 13721/tcp # BPDBM Protocol (VERITAS NetBackup)
+bpdbm 13721/udp
+bpjava-msvc 13722/tcp # BP Java MSVC Protocol
+bpjava-msvc 13722/udp
+vnetd 13724/tcp # Veritas Network Utility
+vnetd 13724/udp
+bpcd 13782/tcp # VERITAS NetBackup
+bpcd 13782/udp
+vopied 13783/tcp # VOPIED Protocol
+vopied 13783/udp
+xpilot 15345/tcp # XPilot Contact Port
+xpilot 15345/udp
+wnn6 22273/tcp # wnn6
+wnn6 22273/udp
+binkp 24554/tcp # Bink fidonet protocol
+binkp 24554/udp
+quake 26000/tcp # Quake @!#
+quake 26000/udp
+wnn6-ds 26208/tcp
+wnn6-ds 26208/udp
+tetrinet 31457/tcp # TetriNET Protocol
+tetrinet 31457/udp
+gamesmith-port 31765/tcp # GameSmith Port
+gamesmith-port 31765/udp
+traceroute 33434/tcp # traceroute use
+traceroute 33434/udp
+candp 42508/tcp # Computer Associates network discovery protocol
+candp 42508/udp
+candrp 42509/tcp # CA discovery response
+candrp 42509/udp
+caerpc 42510/tcp # CA eTrust RPC
+caerpc 42510/udp
+
+#=========================================================================
+# The remaining port numbers are not as allocated by IANA.
+
+# Kerberos (Project Athena/MIT) services
+# Note that these are for Kerberos v4, and are unofficial
+kpop 1109/tcp # Pop with Kerberos
+knetd 2053/tcp # Kerberos de-multiplexor
+eklogin 2105/tcp # Kerberos encrypted rlogin
+
+# CVSup support http://www.cvsup.org/
+supfilesrv 871/tcp # SUP server
+supfiledbg 1127/tcp # SUP debugging
+
+# Datagram Delivery Protocol services
+rtmp 1/ddp # Routing Table Maintenance Protocol
+nbp 2/ddp # Name Binding Protocol
+echo 4/ddp # AppleTalk Echo Protocol
+zip 6/ddp # Zone Information Protocol
+
+# Many services now accepted as 'standard'
+swat 901/tcp # Samba configuration tool
+rndc 953/tcp # rndc control sockets (BIND 9)
+rndc 953/udp
+skkserv 1178/tcp # SKK Japanese input method
+xtel 1313/tcp # french minitel
+support 1529/tcp # GNATS
+cfinger 2003/tcp lmtp # GNU Finger
+ninstall 2150/tcp # ninstall service
+ninstall 2150/udp
+afbackup 2988/tcp # Afbackup system
+afbackup 2988/udp
+fax 4557/tcp # FAX transmission service (old)
+rplay 5555/tcp # RPlay audio service
+rplay 5555/udp
+canna 5680/tcp # Canna (Japanese Input)
+x11-ssh 6010/tcp x11-ssh-offset
+x11-ssh 6010/udp x11-ssh-offset
+ircd 6667/tcp # Internet Relay Chat
+ircd 6667/udp
+jetdirect 9100/tcp # HP JetDirect card
+jetdirect 9100/udp
+mandelspawn 9359/udp mandelbrot # network mandelbrot
+kamanda 10081/tcp # amanda backup services (Kerberos)
+kamanda 10081/udp
+amandaidx 10082/tcp # amanda backup services
+amidxtape 10083/tcp # amanda backup services
+isdnlog 20011/tcp # isdn logging system
+isdnlog 20011/udp
+vboxd 20012/tcp # voice box system
+vboxd 20012/udp
+wnn4_Cn 22289/tcp wnn6_Cn # Wnn (Chinese input)
+wnn4_Kr 22305/tcp wnn6_Kr # Wnn (Korean input)
+wnn4_Tw 22321/tcp wnn6_Tw # Wnn (Taiwanse input)
+asp 27374/tcp # Address Search Protocol
+asp 27374/udp
+tfido 60177/tcp # Ifmail
+tfido 60177/udp
+fido 60179/tcp # Ifmail
+fido 60179/udp
+
+# Local services
diff --git a/spec/fixtures/unit/provider/port/parsed/uniq b/spec/fixtures/unit/provider/port/parsed/uniq
new file mode 100644
index 0000000..8ed670f
--- /dev/null
+++ b/spec/fixtures/unit/provider/port/parsed/uniq
@@ -0,0 +1,7 @@
+# We test a few comments here
+# and anotherone
+ftp-data 20/tcp # File Transfer [Default Data]
+ftp 21/tcp # File Transfer [Control]
+# One comment in the middle
+x11-ssh 6010/tcp x11-ssh-offset # alias test
+baz 100/tcp alias1 alias # Multiple test
diff --git a/spec/unit/provider/port/parsed_spec.rb b/spec/unit/provider/port/parsed_spec.rb
new file mode 100644
index 0000000..c8167e1
--- /dev/null
+++ b/spec/unit/provider/port/parsed_spec.rb
@@ -0,0 +1,277 @@
+#!/usr/bin/env ruby
+
+require 'spec_helper'
+require 'shared_behaviours/all_parsedfile_providers'
+require 'puppet_spec/files'
+
+provider_class = Puppet::Type.type(:port).provider(:parsed)
+
+describe provider_class do
+ include PuppetSpec::Files
+
+ before do
+ @host_class = Puppet::Type.type(:port)
+ @provider = @host_class.provider(:parsed)
+ @servicesfile = tmpfile('services')
+ @provider.stubs(:default_target).returns @servicesfile
+ @provider.any_instance.stubs(:target).returns @servicesfile
+ end
+
+ after :each do
+ @provider.initvars
+ end
+
+ def mkport(args)
+ portresource = Puppet::Type::Port.new(:name => args[:name], :protocol => args[:protocol])
+ portresource.stubs(:should).with(:target).returns @servicesfile
+
+ # Using setters of provider
+ port = @provider.new(portresource)
+ args.each do |property,value|
+ value = value.join(' ') if property == :port_aliases and value.is_a?(Array)
+ port.send("#{property}=", value)
+ end
+ port
+ end
+
+ def genport(port)
+ @provider.stubs(:filetype).returns(Puppet::Util::FileType::FileTypeRam)
+ File.stubs(:chown)
+ File.stubs(:chmod)
+ Puppet::Util::SUIDManager.stubs(:asuser).yields
+ port.flush
+ @provider.target_object(@servicesfile).read
+ end
+
+ describe "when parsing a line with name port and protocol" do
+
+ before do
+ @example_line = "telnet \t 23/udp"
+ end
+
+ it "should extract name from the first field" do
+ @provider.parse_line(@example_line)[:name].should == 'telnet'
+ end
+
+ it "should extract number from second field" do
+ @provider.parse_line(@example_line)[:number].should == '23'
+ end
+
+ it "should extract protocol udp from third field" do
+ @provider.parse_line(@example_line)[:protocol].should == :udp
+ end
+
+ it "should extract protocol tcp from third field" do
+ @provider.parse_line('telnet 23/tcp')[:protocol].should == :tcp
+ end
+
+ it "should drop trailing spaces" do
+ @provider.parse_line('telnet 23/tcp ')[:protocol].should == :tcp
+ end
+
+ it "should handle different delimiters" do
+ @result = ['telnet','23',:tcp ]
+ [
+ "telnet 23/tcp",
+ "telnet\t23/tcp",
+ "telnet \t23/tcp",
+ "telnet\t 23/tcp",
+ "telnet \t 23/tcp\t\t"
+ ].each do |sample|
+ hash = @provider.parse_line(sample)
+ hash[:name].should == @result[0]
+ hash[:number].should == @result[1]
+ hash[:protocol].should == @result[2]
+ hash[:description].should == ''
+ end
+ end
+
+ end
+
+ describe "when parsing a line with name, port, protocol, description" do
+
+ before do
+ @example_line = "telnet \t 23/udp # Telnet"
+ end
+
+ it "should extract name from the first field" do
+ @provider.parse_line(@example_line)[:name].should == 'telnet'
+ end
+
+ it "should extract number from second field" do
+ @provider.parse_line(@example_line)[:number].should == '23'
+ end
+
+ it "should extract protocol from third field" do
+ @provider.parse_line(@example_line)[:protocol].should == :udp
+ end
+
+ it "should extract description after the first #" do
+ @provider.parse_line(@example_line)[:description].should == 'Telnet'
+ end
+
+ it "should correctly set description with multiple #" do
+ @provider.parse_line('telnet 23/udp # My # desc')[:description].should == 'My # desc'
+ end
+
+ it "should handle different delimiters" do
+ @result = ['telnet', '23', :udp, 'My # desc' ]
+ [
+ "telnet 23/udp # My # desc",
+ "telnet\t 23/udp\t# My # desc",
+ "telnet \t23/udp #\tMy # desc",
+ "telnet \t \t 23/udp \t \t# \tMy # desc"
+ ].each do |sample|
+ hash = @provider.parse_line(sample)
+ hash[:name].should == @result[0]
+ hash[:number].should == @result[1]
+ hash[:protocol].should == @result[2]
+ hash[:description].should == @result[3]
+ end
+
+ end
+
+ end
+
+ describe "when parsing a line with name, number, procotol and aliases" do
+
+ before do
+ @example_line = "telnet \t 23/udp alias1 alias2"
+ end
+
+ it "should extract name from the first field" do
+ @provider.parse_line(@example_line)[:name].should == 'telnet'
+ end
+
+ it "should extract number from second field" do
+ @provider.parse_line(@example_line)[:number].should == '23'
+ end
+
+ it "should extract protocol from third field" do
+ @provider.parse_line(@example_line)[:protocol].should == :udp
+ end
+
+ it "should extract single alias" do
+ @example_line = "telnet \t 23/udp alias1"
+ @provider.parse_line(@example_line)[:port_aliases].should == 'alias1'
+ end
+
+ it "should extract multiple aliases" do
+ @provider.parse_line(@example_line)[:port_aliases].should == 'alias1 alias2'
+ end
+
+ it "should convert delimiter to single space" do
+ @provider.parse_line("telnet 23/udp alias1\t\t alias2\talias3 alias4")[:port_aliases].should == 'alias1 alias2 alias3 alias4'
+ end
+
+ it "should set port_aliases to :absent if there is none" do
+ @provider.parse_line("telnet 23/udp")[:port_aliases].should == :absent
+ @provider.parse_line("telnet 23/udp ")[:port_aliases].should == :absent
+ @provider.parse_line("telnet 23/udp # Bazinga!")[:port_aliases].should == :absent
+ end
+
+ end
+
+ describe "when parsing a line with name, number, protocol, aliases and description" do
+
+ before do
+ @example_line = "telnet \t 23/udp alias1 alias2 # Tel#net"
+ @result = ['telnet','23',:udp,'alias1 alias2','Tel#net']
+ end
+
+ it "should extract name from the first field" do
+ @provider.parse_line(@example_line)[:name].should == @result[0]
+ end
+
+ it "should extract number from second field" do
+ @provider.parse_line(@example_line)[:number].should == @result[1]
+ end
+
+ it "should extract protocol from third field" do
+ @provider.parse_line(@example_line)[:protocol].should == @result[2]
+ end
+
+ it "should extract aliases from forth field" do
+ @provider.parse_line(@example_line)[:port_aliases].should == @result[3]
+ end
+
+ it "should extract description from the fifth field" do
+ @provider.parse_line(@example_line)[:description].should == @result[4]
+ end
+
+ end
+
+ describe "when operating on /etc/services like files" do
+
+ it_should_behave_like "all parsedfile providers", provider_class
+
+ end
+
+ it "should be able to generate a simple services entry" do
+ port = mkport(
+ :name => 'telnet',
+ :protocol => :tcp,
+ :number => '23',
+ :ensure => :present
+ )
+ genport(port).should == "telnet\t23/tcp\n"
+ end
+
+ it "should be able to generate an entry with one alias" do
+ port = mkport(
+ :name => 'pcx-pin',
+ :protocol => :tcp,
+ :number => '4005',
+ :port_aliases => 'single_alias',
+ :ensure => :present
+ )
+ genport(port).should == "pcx-pin\t4005/tcp\tsingle_alias\n"
+ end
+
+ it "should be able to generate an entry with more than one alias" do
+ port = mkport(
+ :name => 'pcx-splr-ft',
+ :protocol => :udp,
+ :number => '4003',
+ :port_aliases => [ 'mult_alias', 'rquotad' ],
+ :ensure => :present
+ )
+ genport(port).should == "pcx-splr-ft\t4003/udp\tmult_alias rquotad\n"
+ end
+
+ it "should be able to generate a simple hostfile entry with comments" do
+ port = mkport(
+ :name => 'telnet',
+ :protocol => :tcp,
+ :number => '23',
+ :description => 'Fancy # comment',
+ :ensure => :present
+ )
+ genport(port).should == "telnet\t23/tcp\t# Fancy # comment\n"
+ end
+
+ it "should be able to generate an entry with one alias and a comment" do
+ port = mkport(
+ :name => 'foo',
+ :protocol => :tcp,
+ :number => '1',
+ :port_aliases => 'bar',
+ :description => 'Bazinga!',
+ :ensure => :present
+ )
+ genport(port).should == "foo\t1/tcp\tbar\t# Bazinga!\n"
+ end
+
+ it "should be able to generate an entry with more than one alias and a comment" do
+ port = mkport(
+ :name => 'foo',
+ :protocol => :udp,
+ :number => '3000',
+ :port_aliases => [ 'bar', 'baz', 'zap' ],
+ :description => 'Bazinga!',
+ :ensure => :present
+ )
+ genport(port).should == "foo\t3000/udp\tbar baz zap\t# Bazinga!\n"
+ end
+
+end
diff --git a/spec/unit/type/port_spec.rb b/spec/unit/type/port_spec.rb
new file mode 100644
index 0000000..915b1c2
--- /dev/null
+++ b/spec/unit/type/port_spec.rb
@@ -0,0 +1,220 @@
+#!/usr/bin/env ruby
+
+require 'spec_helper'
+require 'puppet/property/ordered_list'
+
+port = Puppet::Type.type(:port)
+
+describe port do
+ before do
+ @class = port
+ @provider_class = stub 'provider_class', :name => 'fake', :ancestors => [], :suitable? => true, :supports_parameter? => true
+ @class.stubs(:defaultprovider).returns @provider_class
+ @class.stubs(:provider).returns @provider_class
+
+ @provider = stub 'provider', :class => @provider_class, :clean => nil, :exists? => false
+ @resource = stub 'resource', :resource => nil, :provider => @provider
+
+ @provider.stubs(:port_aliases).returns :absent
+
+ @provider_class.stubs(:new).returns(@provider)
+ @catalog = Puppet::Resource::Catalog.new
+ end
+
+ it "should have a title pattern that splits name and protocol" do
+ regex = @class.title_patterns[0][0]
+ regex.match("telnet/tcp").captures.should == ['telnet','tcp' ]
+ regex.match("telnet/udp").captures.should == ['telnet','udp' ]
+ regex.match("telnet/baz").should == nil
+ end
+
+ it "should have a second title pattern that will set only name" do
+ regex = @class.title_patterns[1][0]
+ regex.match("telnet/tcp").captures.should == ['telnet/tcp' ]
+ regex.match("telnet/udp").captures.should == ['telnet/udp' ]
+ regex.match("telnet/baz").captures.should == ['telnet/baz' ]
+ end
+
+ it "should have :name as a key_attribute" do
+ @class.key_attributes.should == [:name, :protocol]
+ end
+
+ describe "when validating attributes" do
+
+ [:name, :provider, :protocol].each do |param|
+ it "should have a #{param} parameter" do
+ @class.attrtype(param).should == :param
+ end
+ end
+
+ [:ensure, :port_aliases, :description, :number].each do |property|
+ it "should have #{property} property" do
+ @class.attrtype(property).should == :property
+ end
+ end
+
+ end
+
+ describe "when validating values" do
+
+ it "should support present as a value for ensure" do
+ lambda { @class.new(:name => "whev", :protocol => :tcp, :ensure => :present) }.should_not raise_error
+ end
+
+ it "should support absent as a value for ensure" do
+ proc { @class.new(:name => "whev", :protocol => :tcp, :ensure => :absent) }.should_not raise_error
+ end
+
+ it "should support :tcp as a value for protocol" do
+ proc { @class.new(:name => "whev", :protocol => :tcp) }.should_not raise_error
+ end
+
+ it "should support :udp as a value for protocol" do
+ proc { @class.new(:name => "whev", :protocol => :udp) }.should_not raise_error
+ end
+
+ it "should not support other protocols than tcp and udp" do
+ proc { @class.new(:name => "whev", :protocol => :tcpp) }.should raise_error(Puppet::Error, /Invalid value/)
+ end
+
+ it "should use tcp as default protocol" do
+ port_test = @class.new(:name => "whev")
+ port_test[:protocol].should == :tcp
+ end
+
+ it "should support valid portnumbers" do
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => '0') }.should_not raise_error
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => '1') }.should_not raise_error
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => "#{2**16-1}") }.should_not raise_error
+ end
+
+ it "should not support portnumbers that arent numeric" do
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => "aa") }.should raise_error(Puppet::Error, /has to be numeric/)
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => "22a") }.should raise_error(Puppet::Error, /has to be numeric/)
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => "a22") }.should raise_error(Puppet::Error, /has to be numeric/)
+ end
+
+ it "should not support portnumbers that are out of range" do
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => "-1") }.should raise_error(Puppet::Error, /number .* out of range/)
+ proc { @class.new(:name => "whev", :protocol => :tcp, :number => "#{2**16}") }.should raise_error(Puppet::Error, /number .* out of range/)
+ end
+
+ it "should support single port_alias" do
+ proc { @class.new(:name => "foo", :protocol => :tcp, :port_aliases => 'bar') }.should_not raise_error
+ end
+
+ it "should support multiple port_aliases" do
+ proc { @class.new(:name => "foo", :protocol => :tcp, :port_aliases => ['bar','bar2']) }.should_not raise_error
+ end
+
+ it "should not support whitespaces in any port_alias" do
+ proc { @class.new(:name => "whev", :protocol => :tcp, :port_aliases => ['bar','fo o']) }.should raise_error(Puppet::Error, /must not contain whitespace/)
+ end
+
+ it "should not support whitespaces in resourcename" do
+ proc { @class.new(:name => "foo bar", :protocol => :tcp) }.should raise_error(Puppet::Error, /must not contain whitespace/)
+ end
+
+ it "should not allow a resource with no name" do
+ # puppet catches a missing name before our validate method can complain about it
+ # proc { @class.new(:protocol => :tcp) }.should raise_error(Puppet::Error, /Attribute.*name.*mandatory/)
+
+ proc { @class.new(:protocol => :tcp) }.should raise_error(Puppet::Error, /Title or name must be provided/)
+ end
+
+ it "should allow a resource with no protocol when the default is tcp" do
+ proc { @class.new(:name => "foo") }.should_not raise_error(Puppet::Error)
+ end
+
+ it "should not allow a resource with no protocol when we have no default" do
+ @class.attrclass(:protocol).stubs(:method_defined?).with(:default).returns(false)
+ proc { @class.new(:name => "foo") }.should raise_error(Puppet::Error, /Attribute.*protocol.*mandatory/)
+ end
+
+ it "should extract name and protocol from title if not explicitly set" do
+ res = @class.new(:title => 'telnet/tcp', :number => '23')
+ res[:number].should == '23'
+ res[:name].should == 'telnet'
+ res[:protocol].should == :tcp
+ end
+
+ it "should not extract name from title if explicitly set" do
+ res = @class.new(:title => 'telnet/tcp', :name => 'ssh', :number => '23')
+ res[:number].should == '23'
+ res[:name].should == 'ssh'
+ res[:protocol].should == :tcp
+ end
+
+ it "should not extract protocol from title if explicitly set" do
+ res = @class.new(:title => 'telnet/tcp', :protocol => :udp, :number => '23')
+ res[:number].should == '23'
+ res[:name].should == 'telnet'
+ res[:protocol].should == :udp
+ end
+
+ it "should not extract name and protocol from title when they are explicitly set" do
+ res = @class.new(:title => 'foo/udp', :name => 'bar', :protocol => :tcp, :number => '23')
+ res[:number].should == '23'
+ res[:name].should == 'bar'
+ res[:protocol].should == :tcp
+ end
+
+ end
+
+ describe "when syncing" do
+
+ it "should send the joined array to the provider for port_aliases property" do
+ port_aliases = @class.attrclass(:port_aliases).new(:resource => @resource, :should => %w{foo bar})
+ @provider.expects(:port_aliases=).with 'foo bar'
+ port_aliases.sync
+ end
+
+ it "should care about the order of port_aliases" do
+ port_aliases = @class.attrclass(:port_aliases).new(:resource => @resource, :should => %w{a z b})
+ port_aliases.insync?(%w{a z b}).should == true
+ port_aliases.insync?(%w{a b z}).should == false
+ port_aliases.insync?(%w{b a z}).should == false
+ port_aliases.insync?(%w{z a b}).should == false
+ port_aliases.insync?(%w{z b a}).should == false
+ port_aliases.insync?(%w{b z a}).should == false
+ end
+
+ end
+
+ describe "when comparing uniqueness_key of two ports" do
+
+ it "should be equal if name and protocol are the same" do
+ foo_tcp1 = @class.new(:name => "foo", :protocol => :tcp, :number => '23')
+ foo_tcp2 = @class.new(:name => "foo", :protocol => :tcp, :number => '23')
+ foo_tcp1.uniqueness_key.should == ['foo', :tcp ]
+ foo_tcp2.uniqueness_key.should == ['foo', :tcp ]
+ foo_tcp1.uniqueness_key.should == foo_tcp2.uniqueness_key
+ end
+
+ it "should not be equal if protocol differs" do
+ foo_tcp = @class.new(:name => "foo", :protocol => :tcp, :number => '23')
+ foo_udp = @class.new(:name => "foo", :protocol => :udp, :number => '23')
+ foo_tcp.uniqueness_key.should == [ 'foo', :tcp ]
+ foo_udp.uniqueness_key.should == [ 'foo', :udp ]
+ foo_tcp.uniqueness_key.should_not == foo_udp.uniqueness_key
+ end
+
+ it "should not be equal if name differs" do
+ foo_tcp = @class.new(:name => "foo", :protocol => :tcp, :number => '23')
+ bar_tcp = @class.new(:name => "bar", :protocol => :tcp, :number => '23')
+ foo_tcp.uniqueness_key.should == [ 'foo', :tcp ]
+ bar_tcp.uniqueness_key.should == [ 'bar', :tcp ]
+ foo_tcp.uniqueness_key.should_not == bar_tcp.uniqueness_key
+ end
+
+ it "should not be equal if both name and protocol differ" do
+ foo_tcp = @class.new(:name => "foo", :protocol => :tcp, :number => '23')
+ bar_udp = @class.new(:name => "bar", :protocol => :udp, :number => '23')
+ foo_tcp.uniqueness_key.should == [ 'foo', :tcp ]
+ bar_udp.uniqueness_key.should == [ 'bar', :udp ]
+ foo_tcp.uniqueness_key.should_not == bar_udp.uniqueness_key
+ end
+
+ end
+
+end
diff --git a/test/data/types/port/1 b/test/data/types/port/1
deleted file mode 100644
index 47da837..0000000
--- a/test/data/types/port/1
+++ /dev/null
@@ -1,533 +0,0 @@
-# Network services, Internet style
-#
-# Note that it is presently the policy of IANA to assign a single well-known
-# port number for both TCP and UDP; hence, officially ports have two entries
-# even if the protocol doesn't support UDP operations.
-#
-# Updated from http://www.iana.org/assignments/port-numbers and other
-# sources like http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services .
-# New ports will be added on request if they have been officially assigned
-# by IANA and used in the real-world or are needed by a debian package.
-# If you need a huge list of used numbers please install the nmap package.
-
-tcpmux 1/tcp # TCP port service multiplexer
-echo 7/tcp
-echo 7/udp
-discard 9/tcp sink null
-discard 9/udp sink null
-systat 11/tcp users
-daytime 13/tcp
-daytime 13/udp
-netstat 15/tcp
-qotd 17/tcp quote
-msp 18/tcp # message send protocol
-msp 18/udp
-chargen 19/tcp ttytst source
-chargen 19/udp ttytst source
-ftp-data 20/tcp
-ftp 21/tcp
-fsp 21/udp fspd
-ssh 22/tcp # SSH Remote Login Protocol
-ssh 22/udp
-telnet 23/tcp
-smtp 25/tcp mail
-time 37/tcp timserver
-time 37/udp timserver
-rlp 39/udp resource # resource location
-nameserver 42/tcp name # IEN 116
-whois 43/tcp nicname
-tacacs 49/tcp # Login Host Protocol (TACACS)
-tacacs 49/udp
-re-mail-ck 50/tcp # Remote Mail Checking Protocol
-re-mail-ck 50/udp
-domain 53/tcp nameserver # name-domain server
-domain 53/udp nameserver
-mtp 57/tcp # deprecated
-tacacs-ds 65/tcp # TACACS-Database Service
-tacacs-ds 65/udp
-bootps 67/tcp # BOOTP server
-bootps 67/udp
-bootpc 68/tcp # BOOTP client
-bootpc 68/udp
-tftp 69/udp
-gopher 70/tcp # Internet Gopher
-gopher 70/udp
-rje 77/tcp netrjs
-finger 79/tcp
-www 80/tcp http # WorldWideWeb HTTP
-www 80/udp # HyperText Transfer Protocol
-link 87/tcp ttylink
-kerberos 88/tcp kerberos5 krb5 kerberos-sec # Kerberos v5
-kerberos 88/udp kerberos5 krb5 kerberos-sec # Kerberos v5
-supdup 95/tcp
-hostnames 101/tcp hostname # usually from sri-nic
-iso-tsap 102/tcp tsap # part of ISODE
-acr-nema 104/tcp dicom # Digital Imag. & Comm. 300
-acr-nema 104/udp dicom # Digital Imag. & Comm. 300
-csnet-ns 105/tcp cso-ns # also used by CSO name server
-csnet-ns 105/udp cso-ns
-rtelnet 107/tcp # Remote Telnet
-rtelnet 107/udp
-pop2 109/tcp postoffice pop-2 # POP version 2
-pop2 109/udp pop-2
-pop3 110/tcp pop-3 # POP version 3
-pop3 110/udp pop-3
-sunrpc 111/tcp portmapper # RPC 4.0 portmapper
-sunrpc 111/udp portmapper
-auth 113/tcp authentication tap ident
-sftp 115/tcp
-uucp-path 117/tcp
-nntp 119/tcp readnews untp # USENET News Transfer Protocol
-ntp 123/tcp
-ntp 123/udp # Network Time Protocol
-pwdgen 129/tcp # PWDGEN service
-pwdgen 129/udp # PWDGEN service
-loc-srv 135/tcp epmap # Location Service
-loc-srv 135/udp epmap
-netbios-ns 137/tcp # NETBIOS Name Service
-netbios-ns 137/udp
-netbios-dgm 138/tcp # NETBIOS Datagram Service
-netbios-dgm 138/udp
-netbios-ssn 139/tcp # NETBIOS session service
-netbios-ssn 139/udp
-imap2 143/tcp imap # Interim Mail Access P 2 and 4
-imap2 143/udp imap
-snmp 161/tcp # Simple Net Mgmt Protocol
-snmp 161/udp # Simple Net Mgmt Protocol
-snmp-trap 162/tcp snmptrap # Traps for SNMP
-snmp-trap 162/udp snmptrap # Traps for SNMP
-cmip-man 163/tcp # ISO mgmt over IP (CMOT)
-cmip-man 163/udp
-cmip-agent 164/tcp
-cmip-agent 164/udp
-mailq 174/tcp # Mailer transport queue for Zmailer
-mailq 174/udp # Mailer transport queue for Zmailer
-xdmcp 177/tcp # X Display Mgr. Control Proto
-xdmcp 177/udp
-nextstep 178/tcp NeXTStep NextStep # NeXTStep window
-nextstep 178/udp NeXTStep NextStep # server
-bgp 179/tcp # Border Gateway Protocol
-bgp 179/udp
-prospero 191/tcp # Cliff Neuman's Prospero
-prospero 191/udp
-irc 194/tcp # Internet Relay Chat
-irc 194/udp
-smux 199/tcp # SNMP Unix Multiplexer
-smux 199/udp
-at-rtmp 201/tcp # AppleTalk routing
-at-rtmp 201/udp
-at-nbp 202/tcp # AppleTalk name binding
-at-nbp 202/udp
-at-echo 204/tcp # AppleTalk echo
-at-echo 204/udp
-at-zis 206/tcp # AppleTalk zone information
-at-zis 206/udp
-qmtp 209/tcp # Quick Mail Transfer Protocol
-qmtp 209/udp # Quick Mail Transfer Protocol
-z3950 210/tcp wais # NISO Z39.50 database
-z3950 210/udp wais
-ipx 213/tcp # IPX
-ipx 213/udp
-imap3 220/tcp # Interactive Mail Access
-imap3 220/udp # Protocol v3
-pawserv 345/tcp # Perf Analysis Workbench
-pawserv 345/udp
-zserv 346/tcp # Zebra server
-zserv 346/udp
-fatserv 347/tcp # Fatmen Server
-fatserv 347/udp
-rpc2portmap 369/tcp
-rpc2portmap 369/udp # Coda portmapper
-codaauth2 370/tcp
-codaauth2 370/udp # Coda authentication server
-clearcase 371/tcp Clearcase
-clearcase 371/udp Clearcase
-ulistserv 372/tcp # UNIX Listserv
-ulistserv 372/udp
-ldap 389/tcp # Lightweight Directory Access Protocol
-ldap 389/udp
-imsp 406/tcp # Interactive Mail Support Protocol
-imsp 406/udp
-https 443/tcp # http protocol over TLS/SSL
-https 443/udp
-snpp 444/tcp # Simple Network Paging Protocol
-snpp 444/udp
-microsoft-ds 445/tcp # Microsoft Naked CIFS
-microsoft-ds 445/udp
-saft 487/tcp # Simple Asynchronous File Transfer
-saft 487/udp
-isakmp 500/tcp # IPsec - Internet Security Association
-isakmp 500/udp # and Key Management Protocol
-rtsp 554/tcp # Real Time Stream Control Protocol
-rtsp 554/udp # Real Time Stream Control Protocol
-nqs 607/tcp # Network Queuing system
-nqs 607/udp
-npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS
-npmp-local 610/udp dqs313_qmaster
-npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS
-npmp-gui 611/udp dqs313_execd
-hmmp-ind 612/tcp dqs313_intercell # HMMP Indication / DQS
-hmmp-ind 612/udp dqs313_intercell
-ipp 631/tcp # Internet Printing Protocol
-ipp 631/udp
-#
-# UNIX specific services
-#
-exec 512/tcp
-biff 512/udp comsat
-login 513/tcp
-who 513/udp whod
-shell 514/tcp cmd # no passwords used
-syslog 514/udp
-printer 515/tcp spooler # line printer spooler
-talk 517/udp
-ntalk 518/udp
-route 520/udp router routed # RIP
-timed 525/udp timeserver
-tempo 526/tcp newdate
-courier 530/tcp rpc
-conference 531/tcp chat
-netnews 532/tcp readnews
-netwall 533/udp # for emergency broadcasts
-gdomap 538/tcp # GNUstep distributed objects
-gdomap 538/udp
-uucp 540/tcp uucpd # uucp daemon
-klogin 543/tcp # Kerberized `rlogin' (v5)
-kshell 544/tcp krcmd # Kerberized `rsh' (v5)
-afpovertcp 548/tcp # AFP over TCP
-afpovertcp 548/udp
-remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
-nntps 563/tcp snntp # NNTP over SSL
-nntps 563/udp snntp
-submission 587/tcp # Submission [RFC2476]
-submission 587/udp
-ldaps 636/tcp # LDAP over SSL
-ldaps 636/udp
-tinc 655/tcp # tinc control port
-tinc 655/udp
-silc 706/tcp
-silc 706/udp
-kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
-#
-webster 765/tcp # Network dictionary
-webster 765/udp
-rsync 873/tcp
-rsync 873/udp
-ftps-data 989/tcp # FTP over SSL (data)
-ftps 990/tcp
-telnets 992/tcp # Telnet over SSL
-telnets 992/udp
-imaps 993/tcp # IMAP over SSL
-imaps 993/udp
-ircs 994/tcp # IRC over SSL
-ircs 994/udp
-pop3s 995/tcp # POP-3 over SSL
-pop3s 995/udp
-#
-# From ``Assigned Numbers'':
-#
-#> The Registered Ports are not controlled by the IANA and on most systems
-#> can be used by ordinary user processes or programs executed by ordinary
-#> users.
-#
-#> Ports are used in the TCP [45,106] to name the ends of logical
-#> connections which carry long term conversations. For the purpose of
-#> providing services to unknown callers, a service contact port is
-#> defined. This list specifies the port used by the server process as its
-#> contact port. While the IANA can not control uses of these ports it
-#> does register or list uses of these ports as a convienence to the
-#> community.
-#
-socks 1080/tcp # socks proxy server
-socks 1080/udp
-proofd 1093/tcp
-proofd 1093/udp
-rootd 1094/tcp
-rootd 1094/udp
-openvpn 1194/tcp
-openvpn 1194/udp
-rmiregistry 1099/tcp # Java RMI Registry
-rmiregistry 1099/udp
-kazaa 1214/tcp
-kazaa 1214/udp
-nessus 1241/tcp # Nessus vulnerability
-nessus 1241/udp # assessment scanner
-lotusnote 1352/tcp lotusnotes # Lotus Note
-lotusnote 1352/udp lotusnotes
-ms-sql-s 1433/tcp # Microsoft SQL Server
-ms-sql-s 1433/udp
-ms-sql-m 1434/tcp # Microsoft SQL Monitor
-ms-sql-m 1434/udp
-ingreslock 1524/tcp
-ingreslock 1524/udp
-prospero-np 1525/tcp # Prospero non-privileged
-prospero-np 1525/udp
-datametrics 1645/tcp old-radius
-datametrics 1645/udp old-radius
-sa-msg-port 1646/tcp old-radacct
-sa-msg-port 1646/udp old-radacct
-kermit 1649/tcp
-kermit 1649/udp
-l2f 1701/tcp l2tp
-l2f 1701/udp l2tp
-radius 1812/tcp
-radius 1812/udp
-radius-acct 1813/tcp radacct # Radius Accounting
-radius-acct 1813/udp radacct
-unix-status 1957/tcp # remstats unix-status server
-log-server 1958/tcp # remstats log server
-remoteping 1959/tcp # remstats remoteping server
-rtcm-sc104 2101/tcp # RTCM SC-104 IANA 1/29/99
-rtcm-sc104 2101/udp
-cvspserver 2401/tcp # CVS client/server operations
-cvspserver 2401/udp
-venus 2430/tcp # codacon port
-venus 2430/udp # Venus callback/wbc interface
-venus-se 2431/tcp # tcp side effects
-venus-se 2431/udp # udp sftp side effect
-codasrv 2432/tcp # not used
-codasrv 2432/udp # server port
-codasrv-se 2433/tcp # tcp side effects
-codasrv-se 2433/udp # udp sftp side effect
-mon 2583/tcp # MON
-mon 2583/udp
-dict 2628/tcp # Dictionary server
-dict 2628/udp
-gpsd 2947/tcp
-gpsd 2947/udp
-gds_db 3050/tcp # InterBase server
-gds_db 3050/udp
-icpv2 3130/tcp icp # Internet Cache Protocol
-icpv2 3130/udp icp
-mysql 3306/tcp
-mysql 3306/udp
-nut 3493/tcp # Network UPS Tools
-nut 3493/udp
-distcc 3632/tcp # distributed compiler
-distcc 3632/udp
-daap 3689/tcp # Digital Audio Access Protocol
-daap 3689/udp
-svn 3690/tcp subversion # Subversion protocol
-svn 3690/udp subversion
-iax 4569/tcp # Inter-Asterisk eXchange
-iax 4569/udp
-radmin-port 4899/tcp # RAdmin Port
-radmin-port 4899/udp
-rfe 5002/udp # Radio Free Ethernet
-rfe 5002/tcp
-sip 5060/tcp # Session Initiation Protocol
-sip 5060/udp
-sip-tls 5061/tcp
-sip-tls 5061/udp
-xmpp-client 5222/tcp jabber-client # Jabber Client Connection
-xmpp-client 5222/udp jabber-client
-xmpp-server 5269/tcp jabber-server # Jabber Server Connection
-xmpp-server 5269/udp jabber-server
-cfengine 5308/tcp
-cfengine 5308/udp
-postgresql 5432/tcp postgres # PostgreSQL Database
-postgresql 5432/udp postgres
-x11 6000/tcp x11-0 # X Window System
-x11 6000/udp x11-0
-x11-1 6001/tcp
-x11-1 6001/udp
-x11-2 6002/tcp
-x11-2 6002/udp
-x11-3 6003/tcp
-x11-3 6003/udp
-x11-4 6004/tcp
-x11-4 6004/udp
-x11-5 6005/tcp
-x11-5 6005/udp
-x11-6 6006/tcp
-x11-6 6006/udp
-x11-7 6007/tcp
-x11-7 6007/udp
-gnutella-svc 6346/tcp # gnutella
-gnutella-svc 6346/udp
-gnutella-rtr 6347/tcp # gnutella
-gnutella-rtr 6347/udp
-afs3-fileserver 7000/tcp bbs # file server itself
-afs3-fileserver 7000/udp bbs
-afs3-callback 7001/tcp # callbacks to cache managers
-afs3-callback 7001/udp
-afs3-prserver 7002/tcp # users & groups database
-afs3-prserver 7002/udp
-afs3-vlserver 7003/tcp # volume location database
-afs3-vlserver 7003/udp
-afs3-kaserver 7004/tcp # AFS/Kerberos authentication
-afs3-kaserver 7004/udp
-afs3-volser 7005/tcp # volume managment server
-afs3-volser 7005/udp
-afs3-errors 7006/tcp # error interpretation service
-afs3-errors 7006/udp
-afs3-bos 7007/tcp # basic overseer process
-afs3-bos 7007/udp
-afs3-update 7008/tcp # server-to-server updater
-afs3-update 7008/udp
-afs3-rmtsys 7009/tcp # remote cache manager service
-afs3-rmtsys 7009/udp
-font-service 7100/tcp xfs # X Font Service
-font-service 7100/udp xfs
-bacula-dir 9101/tcp # Bacula Director
-bacula-dir 9101/udp
-bacula-fd 9102/tcp # Bacula File Daemon
-bacula-fd 9102/udp
-bacula-sd 9103/tcp # Bacula Storage Daemon
-bacula-sd 9103/udp
-amanda 10080/tcp # amanda backup services
-amanda 10080/udp
-hkp 11371/tcp # OpenPGP HTTP Keyserver
-hkp 11371/udp # OpenPGP HTTP Keyserver
-bprd 13720/tcp # VERITAS NetBackup
-bprd 13720/udp
-bpdbm 13721/tcp # VERITAS NetBackup
-bpdbm 13721/udp
-bpjava-msvc 13722/tcp # BP Java MSVC Protocol
-bpjava-msvc 13722/udp
-vnetd 13724/tcp # Veritas Network Utility
-vnetd 13724/udp
-bpcd 13782/tcp # VERITAS NetBackup
-bpcd 13782/udp
-vopied 13783/tcp # VERITAS NetBackup
-vopied 13783/udp
-wnn6 22273/tcp # wnn6
-wnn6 22273/udp
-
-#
-# Datagram Delivery Protocol services
-#
-rtmp 1/ddp # Routing Table Maintenance Protocol
-nbp 2/ddp # Name Binding Protocol
-echo 4/ddp # AppleTalk Echo Protocol
-zip 6/ddp # Zone Information Protocol
-
-#=========================================================================
-# The remaining port numbers are not as allocated by IANA.
-#=========================================================================
-
-# Kerberos (Project Athena/MIT) services
-# Note that these are for Kerberos v4, and are unofficial. Sites running
-# v4 should uncomment these and comment out the v5 entries above.
-#
-kerberos4 750/udp kerberos-iv kdc # Kerberos (server)
-kerberos4 750/tcp kerberos-iv kdc
-kerberos_master 751/udp # Kerberos authentication
-kerberos_master 751/tcp
-passwd_server 752/udp # Kerberos passwd server
-krb_prop 754/tcp krb5_prop hprop # Kerberos slave propagation
-krbupdate 760/tcp kreg # Kerberos registration
-kpasswd 761/tcp kpwd # Kerberos "passwd"
-swat 901/tcp # swat
-kpop 1109/tcp # Pop with Kerberos
-knetd 2053/tcp # Kerberos de-multiplexor
-zephyr-srv 2102/udp # Zephyr server
-zephyr-clt 2103/udp # Zephyr serv-hm connection
-zephyr-hm 2104/udp # Zephyr hostmanager
-eklogin 2105/tcp # Kerberos encrypted rlogin
-# Hmmm. Are we using Kv4 or Kv5 now? Worrying.
-# The following is probably Kerberos v5 --- a...@debian.org (11/02/2000)
-kx 2111/tcp # X over Kerberos
-iprop 2121/tcp # incremental propagation
-#
-# Unofficial but necessary (for NetBSD) services
-#
-supfilesrv 871/tcp # SUP server
-supfiledbg 1127/tcp # SUP debugging
-
-#
-# Services added for the Debian GNU/Linux distribution
-#
-linuxconf 98/tcp # LinuxConf
-poppassd 106/tcp # Eudora
-poppassd 106/udp
-ssmtp 465/tcp smtps # SMTP over SSL
-moira_db 775/tcp # Moira database
-moira_update 777/tcp # Moira update protocol
-moira_ureg 779/udp # Moira user registration
-spamd 783/tcp # spamassassin daemon
-omirr 808/tcp omirrd # online mirror
-omirr 808/udp omirrd
-customs 1001/tcp # pmake customs server
-customs 1001/udp
-skkserv 1178/tcp # skk jisho server port
-predict 1210/udp # predict -- satellite tracking
-rmtcfg 1236/tcp # Gracilis Packeten remote config server
-wipld 1300/tcp # Wipl network monitor
-xtel 1313/tcp # french minitel
-xtelw 1314/tcp # french minitel
-support 1529/tcp # GNATS
-sieve 2000/tcp # Sieve mail filter daemon
-cfinger 2003/tcp # GNU Finger
-ndtp 2010/tcp # Network dictionary transfer protocol
-frox 2121/tcp # frox: caching ftp proxy
-ninstall 2150/tcp # ninstall service
-ninstall 2150/udp
-zebrasrv 2600/tcp # zebra service
-zebra 2601/tcp # zebra vty
-ripd 2602/tcp # ripd vty (zebra)
-ripngd 2603/tcp # ripngd vty (zebra)
-ospfd 2604/tcp # ospfd vty (zebra)
-bgpd 2605/tcp # bgpd vty (zebra)
-ospf6d 2606/tcp # ospf6d vty (zebra)
-ospfapi 2607/tcp # OSPF-API
-isisd 2608/tcp # ISISd vty (zebra)
-afbackup 2988/tcp # Afbackup system
-afbackup 2988/udp
-afmbackup 2989/tcp # Afmbackup system
-afmbackup 2989/udp
-xtell 4224/tcp # xtell server
-fax 4557/tcp # FAX transmission service (old)
-hylafax 4559/tcp # HylaFAX client-server protocol (new)
-distmp3 4600/tcp # distmp3host daemon
-munin 4949/tcp lrrd # Munin
-enbd-cstatd 5051/tcp # ENBD client statd
-enbd-sstatd 5052/tcp # ENBD server statd
-pcrd 5151/tcp # PCR-1000 Daemon
-noclog 5354/tcp # noclogd with TCP (nocol)
-noclog 5354/udp # noclogd with UDP (nocol)
-hostmon 5355/tcp # hostmon uses TCP (nocol)
-hostmon 5355/udp # hostmon uses UDP (nocol)
-rplay 5555/udp # RPlay audio service
-rplay 5555/tcp
-rptp 5556/udp # Remote Play Transfer Protocol
-rptp 5556/tcp
-nsca 5667/tcp # Nagios Agent - NSCA
-mrtd 5674/tcp # MRT Routing Daemon
-bgpsim 5675/tcp # MRT Routing Simulator
-canna 5680/tcp # cannaserver
-sane-port 6566/tcp sane saned # SANE network scanner daemon
-ircd 6667/tcp # Internet Relay Chat
-zope-ftp 8021/tcp # zope management by ftp
-webcache 8080/tcp # WWW caching service
-tproxy 8081/tcp # Transparent Proxy
-omniorb 8088/tcp # OmniORB
-omniorb 8088/udp
-clc-build-daemon 8990/tcp # Common lisp build daemon
-xinetd 9098/tcp
-mandelspawn 9359/udp mandelbrot # network mandelbrot
-zope 9673/tcp # zope server
-kamanda 10081/tcp # amanda backup services (Kerberos)
-kamanda 10081/udp
-amandaidx 10082/tcp # amanda backup services
-amidxtape 10083/tcp # amanda backup services
-smsqp 11201/tcp # Alamin SMS gateway
-smsqp 11201/udp
-xpilot 15345/tcp # XPilot Contact Port
-xpilot 15345/udp
-sgi-cmsd 17001/udp # Cluster membership services daemon
-sgi-crsd 17002/udp
-sgi-gcd 17003/udp # SGI Group membership daemon
-sgi-cad 17004/tcp # Cluster Admin daemon
-isdnlog 20011/tcp # isdn logging system
-isdnlog 20011/udp
-vboxd 20012/tcp # voice box system
-vboxd 20012/udp
-binkp 24554/tcp # binkp fidonet protocol
-asp 27374/tcp # Address Search Protocol
-asp 27374/udp
-dircproxy 57000/tcp # Detachable IRC Proxy
-tfido 60177/tcp # fidonet EMSI over telnet
-fido 60179/tcp # fidonet EMSI over TCP
-
-# Local services
diff --git a/test/data/types/port/darwin b/test/data/types/port/darwin
deleted file mode 100644
index 3d27dd5..0000000
--- a/test/data/types/port/darwin
+++ /dev/null
@@ -1,11866 +0,0 @@
-#
-# Network services, Internet style
-#
-# Note that it is presently the policy of IANA to assign a single well-known
-# port number for both TCP and UDP; hence, most entries here have two entries
-# even if the protocol doesn't support UDP operations.
-#
-# The latest IANA port assignments can be gotten from
-#
-# http://www.iana.org/assignments/port-numbers
-#
-# The Well Known Ports are those from 0 through 1023.
-# The Registered Ports are those from 1024 through 49151
-# The Dynamic and/or Private Ports are those from 49152 through 65535
-#
-# $FreeBSD: src/etc/services,v 1.89 2002/12/17 23:59:10 eric Exp $
-# From: @(#)services 5.8 (Berkeley) 5/9/91
-#
-# WELL KNOWN PORT NUMBERS
-#
-rtmp 1/ddp #Routing Table Maintenance Protocol
-tcpmux 1/udp # TCP Port Service Multiplexer
-tcpmux 1/tcp # TCP Port Service Multiplexer
-# Mark Lottor <M...@nisc.sri.com>
-nbp 2/ddp #Name Binding Protocol
-compressnet 2/udp # Management Utility
-compressnet 2/tcp # Management Utility
-compressnet 3/udp # Compression Process
-compressnet 3/tcp # Compression Process
-# Bernie Volz <VO...@PROCESS.COM>
-echo 4/ddp #AppleTalk Echo Protocol
-# 4/tcp Unassigned
-# 4/udp Unassigned
-rje 5/udp # Remote Job Entry
-rje 5/tcp # Remote Job Entry
-# Jon Postel <pos...@isi.edu>
-zip 6/ddp #Zone Information Protocol
-# 6/tcp Unassigned
-# 6/udp Unassigned
-echo 7/udp # Echo
-echo 7/tcp # Echo
-# Jon Postel <pos...@isi.edu>
-# 8/tcp Unassigned
-# 8/udp Unassigned
-discard 9/udp # Discard
-discard 9/tcp # Discard
-# Jon Postel <pos...@isi.edu>
-# 10/tcp Unassigned
-# 10/udp Unassigned
-systat 11/udp # Active Users
-systat 11/tcp # Active Users
-# Jon Postel <pos...@isi.edu>
-# 12/tcp Unassigned
-# 12/udp Unassigned
-daytime 13/udp # Daytime (RFC 867)
-daytime 13/tcp # Daytime (RFC 867)
-# Jon Postel <pos...@isi.edu>
-# 14/tcp Unassigned
-# 14/udp Unassigned
-# 15/tcp Unassigned [was netstat]
-# 15/udp Unassigned
-# 16/tcp Unassigned
-# 16/udp Unassigned
-qotd 17/udp # Quote of the Day
-qotd 17/tcp # Quote of the Day
-# Jon Postel <pos...@isi.edu>
-msp 18/udp # Message Send Protocol
-msp 18/tcp # Message Send Protocol
-# Rina Nethaniel <---none--->
-chargen 19/udp # Character Generator
-chargen 19/tcp # Character Generator
-ftp-data 20/udp # File Transfer [Default Data]
-ftp-data 20/tcp # File Transfer [Default Data]
-ftp 21/udp # File Transfer [Control]
-ftp 21/tcp # File Transfer [Control]
-# Jon Postel <pos...@isi.edu>
-ssh 22/udp # SSH Remote Login Protocol
-ssh 22/tcp # SSH Remote Login Protocol
-# Tatu Ylonen <y...@cs.hut.fi>
-telnet 23/udp # Telnet
-telnet 23/tcp # Telnet
-# Jon Postel <pos...@isi.edu>
- 24/udp # any private mail system
- 24/tcp # any private mail system
-# Rick Adams <ri...@UUNET.UU.NET>
-smtp 25/udp # Simple Mail Transfer
-smtp 25/tcp # Simple Mail Transfer
-# Jon Postel <pos...@isi.edu>
-# 26/tcp Unassigned
-# 26/udp Unassigned
-nsw-fe 27/udp # NSW User System FE
-nsw-fe 27/tcp # NSW User System FE
-# Robert Thomas <BTh...@F.BBN.COM>
-# 28/tcp Unassigned
-# 28/udp Unassigned
-msg-icp 29/udp # MSG ICP
-msg-icp 29/tcp # MSG ICP
-# Robert Thomas <BTh...@F.BBN.COM>
-# 30/tcp Unassigned
-# 30/udp Unassigned
-msg-auth 31/udp # MSG Authentication
-msg-auth 31/tcp # MSG Authentication
-# Robert Thomas <BTh...@F.BBN.COM>
-# 32/tcp Unassigned
-# 32/udp Unassigned
-dsp 33/udp # Display Support Protocol
-dsp 33/tcp # Display Support Protocol
-# Ed Cain <ca...@edn-unix.dca.mil>
-# 34/tcp Unassigned
-# 34/udp Unassigned
- 35/udp # any private printer server
- 35/tcp # any private printer server
-# Jon Postel <pos...@isi.edu>
-# 36/tcp Unassigned
-# 36/udp Unassigned
-time 37/udp # Time
-time 37/tcp # Time
-# Jon Postel <pos...@isi.edu>
-rap 38/udp # Route Access Protocol
-rap 38/tcp # Route Access Protocol
-# Robert Ullmann <ar...@world.std.com>
-rlp 39/udp # Resource Location Protocol
-rlp 39/tcp # Resource Location Protocol
-# Mike Accetta <MIKE.A...@CMU-CS-A.EDU>
-# 40/tcp Unassigned
-# 40/udp Unassigned
-graphics 41/udp # Graphics
-graphics 41/tcp # Graphics
-name 42/udp nameserver # Host Name Server
-name 42/tcp nameserver # Host Name Server
-nicname 43/udp # Who Is
-nicname 43/tcp # Who Is
-mpm-flags 44/udp # MPM FLAGS Protocol
-mpm-flags 44/tcp # MPM FLAGS Protocol
-mpm 45/udp # Message Processing Module [recv]
-mpm 45/tcp # Message Processing Module [recv]
-mpm-snd 46/udp # MPM [default send]
-mpm-snd 46/tcp # MPM [default send]
-# Jon Postel <pos...@isi.edu>
-ni-ftp 47/udp # NI FTP
-ni-ftp 47/tcp # NI FTP
-# Steve Kille <S.K...@isode.com>
-auditd 48/udp # Digital Audit Daemon
-auditd 48/tcp # Digital Audit Daemon
-# Larry Scott <sc...@zk3.dec.com>
-tacacs 49/udp # Login Host Protocol (TACACS)
-tacacs 49/tcp # Login Host Protocol (TACACS)
-# Pieter Ditmars <pdit...@BBN.COM>
-re-mail-ck 50/udp # Remote Mail Checking Protocol
-re-mail-ck 50/tcp # Remote Mail Checking Protocol
-# Steve Dorner <s-do...@UIUC.EDU>
-la-maint 51/udp # IMP Logical Address Maintenance
-la-maint 51/tcp # IMP Logical Address Maintenance
-# Andy Malis <mal...@timeplex.com>
-xns-time 52/udp # XNS Time Protocol
-xns-time 52/tcp # XNS Time Protocol
-# Susie Armstrong <Armstrong.wbst128@XEROX>
-domain 53/udp # Domain Name Server
-domain 53/tcp # Domain Name Server
-# Paul Mockapetris <P...@ISI.EDU>
-xns-ch 54/udp # XNS Clearinghouse
-xns-ch 54/tcp # XNS Clearinghouse
-# Susie Armstrong <Armstrong.wbst128@XEROX>
-isi-gl 55/udp # ISI Graphics Language
-isi-gl 55/tcp # ISI Graphics Language
-xns-auth 56/udp # XNS Authentication
-xns-auth 56/tcp # XNS Authentication
-# Susie Armstrong <Armstrong.wbst128@XEROX>
- 57/udp # any private terminal access
- 57/tcp # any private terminal access
-# Jon Postel <pos...@isi.edu>
-xns-mail 58/udp # XNS Mail
-xns-mail 58/tcp # XNS Mail
-# Susie Armstrong <Armstrong.wbst128@XEROX>
- 59/udp # any private file service
- 59/tcp # any private file service
-# Jon Postel <pos...@isi.edu>
- 60/udp # Unassigned
- 60/tcp # Unassigned
-ni-mail 61/udp # NI MAIL
-ni-mail 61/tcp # NI MAIL
-# Steve Kille <S.K...@isode.com>
-acas 62/udp # ACA Services
-acas 62/tcp # ACA Services
-# E. Wald <ew...@via.enet.dec.com>
-whois++ 63/udp # whois++
-whois++ 63/tcp # whois++
-# Rickard Schoultz <scho...@sunet.se>
-covia 64/udp # Communications Integrator (CI)
-covia 64/tcp # Communications Integrator (CI)
-# Dan Smith <dan....@den.galileo.com>
-tacacs-ds 65/udp # TACACS-Database Service
-tacacs-ds 65/tcp # TACACS-Database Service
-# Kathy Huber <khu...@bbn.com>
-sql*net 66/udp # Oracle SQL*NET
-sql*net 66/tcp # Oracle SQL*NET
-# Jack Haverty <jhav...@ORACLE.COM>
-bootps 67/udp # Bootstrap Protocol Server
-bootps 67/tcp # Bootstrap Protocol Server
-bootpc 68/udp # Bootstrap Protocol Client
-bootpc 68/tcp # Bootstrap Protocol Client
-# Bill Croft <Cr...@SUMEX-AIM.STANFORD.EDU>
-tftp 69/udp # Trivial File Transfer
-tftp 69/tcp # Trivial File Transfer
-# David Clark <d...@LCS.MIT.EDU>
-gopher 70/udp # Gopher
-gopher 70/tcp # Gopher
-# Mark McCahill <m...@boombox.micro.umn.edu>
-netrjs-1 71/udp # Remote Job Service
-netrjs-1 71/tcp # Remote Job Service
-netrjs-2 72/udp # Remote Job Service
-netrjs-2 72/tcp # Remote Job Service
-netrjs-3 73/udp # Remote Job Service
-netrjs-3 73/tcp # Remote Job Service
-netrjs-4 74/udp # Remote Job Service
-netrjs-4 74/tcp # Remote Job Service
-# Bob Braden <Bra...@ISI.EDU>
- 75/udp # any private dial out service
- 75/tcp # any private dial out service
-# Jon Postel <pos...@isi.edu>
-deos 76/udp # Distributed External Object Store
-deos 76/tcp # Distributed External Object Store
-# Robert Ullmann <ar...@world.std.com>
- 77/udp # any private RJE service
- 77/tcp # any private RJE service
-# Jon Postel <pos...@isi.edu>
-vettcp 78/udp # vettcp
-vettcp 78/tcp # vettcp
-# Christopher Leong <le...@kolmod.mlo.dec.com>
-finger 79/udp # Finger
-finger 79/tcp # Finger
-# David Zimmerman <d...@RUTGERS.EDU>
-http 80/udp www www-http # World Wide Web HTTP
-http 80/tcp www www-http # World Wide Web HTTP
-# Tim Berners-Lee <ti...@W3.org>
-hosts2-ns 81/udp # HOSTS2 Name Server
-hosts2-ns 81/tcp # HOSTS2 Name Server
-# Earl Killian <E...@MORDOR.S1.GOV>
-xfer 82/udp # XFER Utility
-xfer 82/tcp # XFER Utility
-# Thomas M. Smith <Thomas....@lmco.com>
-mit-ml-dev 83/udp # MIT ML Device
-mit-ml-dev 83/tcp # MIT ML Device
-# David Reed <--none--->
-ctf 84/udp # Common Trace Facility
-ctf 84/tcp # Common Trace Facility
-# Hugh Thomas <tho...@oils.enet.dec.com>
-mit-ml-dev 85/udp # MIT ML Device
-mit-ml-dev 85/tcp # MIT ML Device
-# David Reed <--none--->
-mfcobol 86/udp # Micro Focus Cobol
-mfcobol 86/tcp # Micro Focus Cobol
-# Simon Edwards <--none--->
- 87/udp # any private terminal link
- 87/tcp # any private terminal link
-# Jon Postel <pos...@isi.edu>
-kerberos 88/udp # Kerberos
-kerberos 88/tcp # Kerberos
-# B. Clifford Neuman <b...@isi.edu>
-su-mit-tg 89/udp # SU/MIT Telnet Gateway
-su-mit-tg 89/tcp # SU/MIT Telnet Gateway
-# Mark Crispin <M...@PANDA.COM>
-########### PORT 90 also being used unofficially by Pointcast #########
-dnsix 90/udp # DNSIX Securit Attribute Token Map
-dnsix 90/tcp # DNSIX Securit Attribute Token Map
-# Charles Watt <wa...@sware.com>
-mit-dov 91/udp # MIT Dover Spooler
-mit-dov 91/tcp # MIT Dover Spooler
-# Eliot Moss <E...@XX.LCS.MIT.EDU>
-npp 92/udp # Network Printing Protocol
-npp 92/tcp # Network Printing Protocol
-# Louis Mamakos <lo...@sayshell.umd.edu>
-dcp 93/udp # Device Control Protocol
-dcp 93/tcp # Device Control Protocol
-# Daniel Tappan <Tap...@BBN.COM>
-objcall 94/udp # Tivoli Object Dispatcher
-objcall 94/tcp # Tivoli Object Dispatcher
-# Tom Bereiter <--none--->
-supdup 95/udp # SUPDUP
-supdup 95/tcp # SUPDUP
-# Mark Crispin <M...@PANDA.COM>
-dixie 96/udp # DIXIE Protocol Specification
-dixie 96/tcp # DIXIE Protocol Specification
-# Tim Howes <Tim....@terminator.cc.umich.edu>
-swift-rvf 97/udp # Swift Remote Virtural File Protocol
-swift-rvf 97/tcp # Swift Remote Virtural File Protocol
-# Maurice R. Turcotte
-# <mailrus!uflorida!rm1!dnmrt%rm...@uunet.UU.NET>
-tacnews 98/udp # TAC News
-tacnews 98/tcp # TAC News
-# Jon Postel <pos...@isi.edu>
-metagram 99/udp # Metagram Relay
-metagram 99/tcp # Metagram Relay
-# Geoff Goodfellow <Ge...@FERNWOOD.MPK.CA.US>
-newacct 100/tcp # [unauthorized use]
-hostname 101/udp # NIC Host Name Server
-hostname 101/tcp # NIC Host Name Server
-# Jon Postel <pos...@isi.edu>
-iso-tsap 102/udp # ISO-TSAP Class 0
-iso-tsap 102/tcp # ISO-TSAP Class 0
-# Marshall Rose <mr...@dbc.mtview.ca.us>
-gppitnp 103/udp # Genesis Point-to-Point Trans Net
-gppitnp 103/tcp # Genesis Point-to-Point Trans Net
-acr-nema 104/udp # ACR-NEMA Digital Imag. & Comm. 300
-acr-nema 104/tcp # ACR-NEMA Digital Imag. & Comm. 300
-# Patrick McNamee <--none--->
-cso 105/udp # CCSO name server protocol
-cso 105/tcp # CCSO name server protocol
-# Martin Hamilton <mar...@mrrl.lut.as.uk>
-csnet-ns 105/udp # Mailbox Name Nameserver
-csnet-ns 105/tcp # Mailbox Name Nameserver
-# Marvin Solomon <sol...@CS.WISC.EDU>
-3com-tsmux 106/udp # 3COM-TSMUX
-3com-tsmux 106/tcp # 3COM-TSMUX
-# Jeremy Siegel <j...@NSD.3Com.COM>
-########## 106 Unauthorized use by insecure poppassd protocol
-rtelnet 107/udp # Remote Telnet Service
-rtelnet 107/tcp # Remote Telnet Service
-# Jon Postel <pos...@isi.edu>
-snagas 108/udp # SNA Gateway Access Server
-snagas 108/tcp # SNA Gateway Access Server
-# Kevin Murphy <mur...@sevens.lkg.dec.com>
-pop2 109/udp # Post Office Protocol - Version 2
-pop2 109/tcp # Post Office Protocol - Version 2
-# Joyce K. Reynolds <jk...@isi.edu>
-pop3 110/udp # Post Office Protocol - Version 3
-pop3 110/tcp # Post Office Protocol - Version 3
-# Marshall Rose <mr...@dbc.mtview.ca.us>
-sunrpc 111/udp # SUN Remote Procedure Call
-sunrpc 111/tcp # SUN Remote Procedure Call
-# Chuck McManis <cmcm...@freegate.net>
-mcidas 112/udp # McIDAS Data Transmission Protocol
-mcidas 112/tcp # McIDAS Data Transmission Protocol
-# Glenn Davis <sup...@unidata.ucar.edu>
-auth 113/udp # Authentication Service
-ident 113/tcp auth #
-# Mike St. Johns <stj...@arpa.mil>
-audionews 114/udp # Audio News Multicast
-audionews 114/tcp # Audio News Multicast
-# Martin Forssen <m...@dtek.chalmers.se>
-sftp 115/udp # Simple File Transfer Protocol
-sftp 115/tcp # Simple File Transfer Protocol
-# Mark Lottor <M...@nisc.sri.com>
-ansanotify 116/udp # ANSA REX Notify
-ansanotify 116/tcp # ANSA REX Notify
-# Nicola J. Howarth <n...@ansa.co.uk>
-uucp-path 117/udp # UUCP Path Service
-uucp-path 117/tcp # UUCP Path Service
-sqlserv 118/udp # SQL Services
-sqlserv 118/tcp # SQL Services
-# Larry Barnes <bar...@broke.enet.dec.com>
-nntp 119/udp # Network News Transfer Protocol
-nntp 119/tcp # Network News Transfer Protocol
-# Phil Lapsley <ph...@UCBARPA.BERKELEY.EDU>
-cfdptkt 120/udp # CFDPTKT
-cfdptkt 120/tcp # CFDPTKT
-# John Ioannidis <j...@close.cs.columbia.ed>
-erpc 121/udp # Encore Expedited Remote Pro.Call
-erpc 121/tcp # Encore Expedited Remote Pro.Call
-# Jack O'Neil <---none--->
-smakynet 122/udp # SMAKYNET
-smakynet 122/tcp # SMAKYNET
-# Pierre Arnaud <pierre...@iname.com>
-ntp 123/udp # Network Time Protocol
-ntp 123/tcp # Network Time Protocol
-# Dave Mills <Mi...@HUEY.UDEL.EDU>
-ansatrader 124/udp # ANSA REX Trader
-ansatrader 124/tcp # ANSA REX Trader
-# Nicola J. Howarth <n...@ansa.co.uk>
-locus-map 125/udp # Locus PC-Interface Net Map Ser
-locus-map 125/tcp # Locus PC-Interface Net Map Ser
-# Eric Peterson <lcc....@SEAS.UCLA.EDU>
-nxedit 126/udp # NXEdit
-nxedit 126/tcp # NXEdit
-# Don Payette <Don.P...@unisys.com>
-###########Port 126 Previously assigned to application below#######
-#unitary 126/tcp Unisys Unitary Login
-#unitary 126/udp Unisys Unitary Login
-# <fe...@kronos.nisd.cam.unisys.com>
-###########Port 126 Previously assigned to application above#######
-locus-con 127/udp # Locus PC-Interface Conn Server
-locus-con 127/tcp # Locus PC-Interface Conn Server
-# Eric Peterson <lcc....@SEAS.UCLA.EDU>
-gss-xlicen 128/udp # GSS X License Verification
-gss-xlicen 128/tcp # GSS X License Verification
-# John Light <jo...@gssc.gss.com>
-pwdgen 129/udp # Password Generator Protocol
-pwdgen 129/tcp # Password Generator Protocol
-# Frank J. Wacho <WAN...@WSMR-SIMTEL20.ARMY.MIL>
-cisco-fna 130/udp # cisco FNATIVE
-cisco-fna 130/tcp # cisco FNATIVE
-cisco-tna 131/udp # cisco TNATIVE
-cisco-tna 131/tcp # cisco TNATIVE
-cisco-sys 132/udp # cisco SYSMAINT
-cisco-sys 132/tcp # cisco SYSMAINT
-statsrv 133/udp # Statistics Service
-statsrv 133/tcp # Statistics Service
-# Dave Mills <Mi...@HUEY.UDEL.EDU>
-ingres-net 134/udp # INGRES-NET Service
-ingres-net 134/tcp # INGRES-NET Service
-# Mike Berrow <---none--->
-epmap 135/udp # DCE endpoint resolution
-epmap 135/tcp # DCE endpoint resolution
-# Joe Pato <pa...@apollo.hp.com>
-profile 136/udp # PROFILE Naming System
-profile 136/tcp # PROFILE Naming System
-# Larry Peterson <l...@ARIZONA.EDU>
-netbios-ns 137/udp # NETBIOS Name Service
-netbios-ns 137/tcp # NETBIOS Name Service
-netbios-dgm 138/udp # NETBIOS Datagram Service
-netbios-dgm 138/tcp # NETBIOS Datagram Service
-netbios-ssn 139/udp # NETBIOS Session Service
-netbios-ssn 139/tcp # NETBIOS Session Service
-# Jon Postel <pos...@isi.edu>
-emfis-data 140/udp # EMFIS Data Service
-emfis-data 140/tcp # EMFIS Data Service
-emfis-cntl 141/udp # EMFIS Control Service
-emfis-cntl 141/tcp # EMFIS Control Service
-# Gerd Beling <GBE...@ISI.EDU>
-bl-idm 142/udp # Britton-Lee IDM
-bl-idm 142/tcp # Britton-Lee IDM
-# Susie Snitzer <---none--->
-imap 143/udp # Internet Message Access Protocol
-imap 143/tcp # Internet Message Access Protocol
-# Mark Crispin <M...@CAC.Washington.EDU>
-uma 144/udp # Universal Management Architecture
-uma 144/tcp # Universal Management Architecture
-#