Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64562
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Can post a code but afraid of plagiarism |
| Date | 2014-01-22 22:36 -0500 |
| Organization | IISS Elusive Unicorn |
| References | <e646d6f1-ac3c-4d55-9809-b5edee93dbbb@googlegroups.com> <fb92f347-183c-452a-95f0-24cd9370852a@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5865.1390448199.18130.python-list@python.org> (permalink) |
On Wed, 22 Jan 2014 08:33:30 -0800 (PST), indar kumar
<indarkumar59@gmail.com> declaimed the following:
>On Saturday, January 18, 2014 3:21:42 PM UTC-7, indar kumar wrote:
>> Hi,
>>
>>
>>
>> I want to show a code for review but afraid of plagiarism issues. Kindly, suggest how can I post it for review here without masking it visible for public
>
>Description of each of the commands:
The following appears to be only ONE "command"
>• config
>
>? Parameters: <host_id> <mac addr> <ip addr> <cache timeout>
>? <cache timeout> is the host's ARP cache timeout, in seconds
>? Actions:
>? Update simulator's configuration database.
>• If <host_id> already exists, its information should be updated. Otherwise, it should
>be added.
>? Print “<host_id> connected.”
>? Have the host send a gratuitous ARP request .
http://en.wikipedia.org/wiki/Address_Resolution_Protocol#ARP_announcements
>• If any other hosts have an outdated entry for the MAC or IP address, they should
>update their caches.
>• If there are any responses to that request, that means that somebody else has this IP
>address. If that is the case, you should print:
>Error: <host_id> detected IP address conflict. It will be disconnected.
That does not follow ARP protocol... BEFORE claiming the IP address,
the "new host" is supposed to send an ARP Probe
http://en.wikipedia.org/wiki/Address_Resolution_Protocol#ARP_probe
Sending the probe (using a local "IP" address of 0.0.0.0, but with the
correct hardware MAC address) asking if anyone is using the IP address the
local configuration is claiming is supposed to be the test to confirm no
one else has the same IP.
If no one responds with the configuration IP address, THEN the local
host can send an ARP announcement claiming the IP address, which other
nodes then use to update their cache lists. Note that an ARP announcement
is used to provide the local MAC/IP pair to OTHER nodes. It does not answer
how the local node obtains the information of the other nodes. It may be
possible to have the nodes receiving a broadcast ARP announcement respond
with a direct (that is, TO the original sender only) -- but that could
result in an infinite loop if the original then tries to respond back...
Note that "host id" is NOT part of the ARP protocol. I'm going to
presume that no actual network traffic (or even interprocess communication)
is being used here -- just a simple single threaded program. If so, "host
id" would probably be used as a dictionary key to identify the ARP cache
for that simulated host. The data value (nothing currently seems to be
using the cache timeout value so I'm going to ignore it) would be, itself,
a dictionary using IP values as keys, with the corresponding MAC address as
the data value. OTOH: since you do need to keep the IP and MAC of the
host... The structure is probably going to look like:
{ hostid : (hostMAC, hostIP, hostTimeout, { otherIP : otherMAC, ...}), ...}
Pseudo-code (and not even using Python syntax <evil grin> [not validated
REXX either])
do forever
parse pull host MAC IP timeout
simulation.host.cache = {} #create/reset this host's cache
say "sending ARP probe" MAC ff:ff:ff:ff:ff:ff 0.0.0.0 IP
foreach node in simulation
if node.hostid = host
continue #skip ourselves
else
if node.hostIP = IP
#this IP is assigned elsewhere
say "sending ARP response" node.MAC MAC node.hostIP IP
say "error"
simulation.host = "" #delete the config host, invalid
if host in simulation
#it didn't get deleted, so the IP must be available
say "sendign ARP announcement" MAC 0:0:0:0:0:0 IP IP
foreach node in simulation
if node.hostid = host
continue
else
#update cache with new MAC/IP pair
Of course, if the IP changed, but not the MAC, the old IP with the MAC
will be left behind... This is where the timeout would come into play, if
each entry had a time-to-purge entry (clock time when entered + timeout
value); then whenever the cache was checked/updated you'd delete any entry
that had a purge time lower than the current clock time.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-18 14:21 -0800
Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-18 17:27 -0500
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-18 14:32 -0800
Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-18 17:35 -0500
Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-19 09:42 +1100
Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-19 09:59 +1100
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-19 06:31 +0000
Re: Can post a code but afraid of plagiarism Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-01-18 22:45 -0800
Re: Can post a code but afraid of plagiarism Dan Stromberg <drsalists@gmail.com> - 2014-01-19 21:21 -0800
Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-20 17:21 +1100
Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-20 09:08 -0500
Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-20 08:11 -0800
Re: Can post a code but afraid of plagiarism Terry Reedy <tjreedy@udel.edu> - 2014-01-20 16:56 -0500
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-21 00:47 +0000
Re: Can post a code but afraid of plagiarism Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-01-21 10:32 +0000
Re: Can post a code but afraid of plagiarism Dan Sommers <dan@tombstonezero.net> - 2014-01-21 13:49 +0000
Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-20 18:39 +1100
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-19 23:55 -0800
Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-20 19:17 +1100
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-22 00:51 +0000
Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-21 19:01 -0800
Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-21 22:46 -0500
Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-20 19:48 +1100
Re: Can post a code but afraid of plagiarism bryan rasmussen <rasmussen.bryan@gmail.com> - 2014-01-20 10:19 +0100
Re: Can post a code but afraid of plagiarism Alister <alister.ware@ntlworld.com> - 2014-01-20 09:36 +0000
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-22 00:01 +0000
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-22 00:51 +0000
Re: Can post a code but afraid of plagiarism Neil Cerutti <neilc@norwich.edu> - 2014-01-22 13:34 +0000
Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-20 18:59 +1100
Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-20 19:10 +1100
Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-19 09:57 +1100
Re: Can post a code but afraid of plagiarism Grant Edwards <invalid@invalid.invalid> - 2014-01-19 16:22 +0000
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 00:36 -0800
Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-22 08:53 -0500
Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-22 08:48 -0800
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-23 00:01 +0000
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 00:39 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:33 -0800
Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-22 22:36 -0500
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:46 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:50 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:53 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 09:09 -0800
Re: Can post a code but afraid of plagiarism Ned Batchelder <ned@nedbatchelder.com> - 2014-01-22 14:19 -0500
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 23:46 -0800
Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-23 20:26 -0500
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 23:57 -0800
Re: Can post a code but afraid of plagiarism Asaf Las <roegltd@gmail.com> - 2014-01-23 01:46 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 02:10 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 13:15 -0800
Re: Can post a code but afraid of plagiarism Emile van Sebille <emile@fenx.com> - 2014-01-23 13:28 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 13:34 -0800
Re: Can post a code but afraid of plagiarism Emile van Sebille <emile@fenx.com> - 2014-01-23 13:49 -0800
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 13:56 -0800
Re: Can post a code but afraid of plagiarism Piet van Oostrum <piet@vanoostrum.org> - 2014-01-24 15:13 +0100
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 19:15 -0800
Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-23 21:57 -0800
Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-24 08:13 +0000
Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 23:14 -0800
Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-24 09:01 -0500
Re: Can post a code but afraid of plagiarism bob gailer <bgailer@gmail.com> - 2014-01-24 18:42 -0500
Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-24 19:42 -0500
csiph-web