It is currently Mon Nov 18, 2019 10:51 pm


All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Fixed] renaming a connected switch to LAN breaks a topology
PostPosted: Wed May 22, 2013 9:56 am 
Offline

Joined: Wed May 22, 2013 7:48 am
Posts: 93
Location: Portugal
Hi there, by chance I discovered a way to break a topology in GNS3 0.8.3.1:

  1. connect a router and a switch;
  2. change the hostname of the switch to LAN;
    => the console shows the warning "Connecting LAN port 1 to access 1 resulted in: the switchport does not exist"
  3. rename switch to something else or undo the new hostname or save and load the topology;
    => the connection disappears
  4. try to connect the same router port anywhere and you get the Dynamips error "source port is already occupied by a different connection";
    to fix this I have to remove the connection manually from the topology with a text editor (can't remove the connection from within GNS3)


I looked around the source and in Dynagen a connection with a device named LAN has a different meaning:
Code:
class Dynagen:
## (snip)
    def _parse_right_side_of_connection(self, dest):
## (snip)
        if parameters == 2:
            #either the normal "R0 f0/0", or "LAN 1"
            (devname, interface) = dest.split(' ')

            #check if this is not a connection to dynamips emulate bridge
            if devname.lower() == 'lan':
                self.debug('a LAN interface ' + str(dest))
                match_obj = number_re.search(interface)
                if match_obj:
                    return (devname.lower(), 0, 0, int(interface), 'Bridge')
                else:
                    raise DynamipsError, 'the LAN interface must be a number'

            #if this is normal connection to another device
            if devname not in self.devices:
                raise DynamipsError, 'nonexistent device ' + devname
            remote_device = self.devices[devname]

            #use the same function for interface as left side
            (pa2, slot2, port2) =  self._parse_interface_part_of_connection(remote_device, interface)
            return (remote_device, pa2, slot2, port2, 'AutoUDP')


Quick-fix: disallow changing the hostname to LAN (say it's a reserved name?) and warn the user when loading a topology with a device named LAN.



_________________
Dynamips maintainer and sporadic developer
https://github.com/GNS3/dynamips


Last edited by flaviojs on Mon Jul 15, 2013 3:17 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: renaming a connected switch to LAN breaks a topology
PostPosted: Fri May 24, 2013 9:29 pm 
Offline

Joined: Wed May 22, 2013 7:48 am
Posts: 93
Location: Portugal
Patch with the quick-fix as an attachment.

A proper fix, in my opinion, would mean changing Dynagen to either give a warning/error when a device is named like that, or add a way to connect to a device named like that (support quotes around the device name?).
I have no experience using Dynagen directly so I rather not touch it... =~~


Attachments:
File comment: Patch with the quick-fix
patch.diff [1.62 KiB]
Downloaded 243 times

_________________
Dynamips maintainer and sporadic developer
https://github.com/GNS3/dynamips
Top
 Profile  
 
 Post subject: Re: renaming a connected switch to LAN breaks a topology
PostPosted: Sat May 25, 2013 2:38 am 
Offline
Site Admin

Joined: Sat Oct 11, 2008 1:41 pm
Posts: 2668
Location: Canada
Thanks so much for reporting and proposing a patch!

This issue will be fixed for the final release.

Cheers,



_________________
Jeremy, GNS3 Programmer & Benevolent Dictator for Life.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO