Ip address generation

Hi,
I have problem regarding how to create a list of IP addresses given starting and ending IP address.
E.g. IF I have starting IP address as 172.20.59.58 and ending IP address as 172.22.56.44, I want to find all the possible IP addresses within this range.
I have one solution with lots of for loops which gives me correct list, but I just wanted to know whether there is any scientific/mathematical way of doing this because I have a feeling that my code is not efficient with lots of for loops.

You can convert an IP address to an integer (I'll use "long" so I don't get negative values):
// 172.20.59.58
long start =
    (long) 172 * 256 * 256 * 256 +
    20 * 256 * 256 +
    59 * 256 +
    58;Write a method that does that to a string containing the address. Then you can loop from the starting address to the ending address. You may want to write another method that does the reverse: convert an int to aaa.bbb.ccc.ddd.
Or if you already have a solution with four nested loops that should be fine too. Don't worry about efficiency unless you actually have a measurable problem. Unless you have done something strange your loops should generate millions of addresses in a second.

Similar Messages

  • MAC Address Generation Prevention

    I have been told by Verizon and Activision that their routers do not have the ability to filter MAC addresses that are wired. 
    Verizion's competitor, Comcast, purchased a company for over $50 Million that does.  This company is located in Silicon Valley.
    It is simple for Activision to write code that filters/allows certain pre-determined MAC addresses.  Why they don't have this feature throughout their routers is unfortunate.

    IMO, unless the router was locked into a box with no key, MAC address filtering on wired would be pointless. 10 seconds of physical access is all that is needed to undo the MAC filtering.
    ========
    The first to bring me 1Gbps Fiber for $30/m wins!

  • Counter for bram addressing

    Hello,
    i want to store incoming data  @ 300MHz  in a bram. The address width is 16 bit (65535 elements).
    The address generation consists of address incrementation and address comparison since the bram will be devided into segments with each segment having its own address space within the bram.
    To sum up the timing failed due to the address generation for the bram.
    How to solve this timing violation.
    Best regards 
     

    I do all of the incrementing and comparing using DSP's instead of fabric logic.  You have to do a bit of reading to figure out what all of the configuration options do, but once you do the DSP's are fairly easy to use.
    Here is one implementation of a simple counter: when iCount is high, the DSP counts iClk cycles.  You can see the pattern detect parameters if you are comparing to a constant value or you can use the DSP to subtract two changing values and compare to zero. 
    DSP48E1 #
    .PREG ( 1 ),
    .ACASCREG ( 0 ),
    .ADREG ( 0 ),
    .ALUMODEREG ( 0 ),
    .AREG ( 0 ),
    .AUTORESET_PATDET ( "NO_RESET" ),
    .BCASCREG ( 0 ),
    .BREG ( 0 ),
    .CREG ( 0 ),
    .DREG ( 0 ),
    .MREG ( 0 ),
    .OPMODEREG ( 0 ),
    .USE_MULT ( "NONE" ),
    .MASK ( 48'd0 ),
    .PATTERN ( 48'd0 ),
    .USE_PATTERN_DETECT ( "NO_PATDET" )
    mDSP
    .CLK ( iClk ),
    .P ( oCounts ),
    .A ( 30'd0 ),
    .B ( 18'd1 ),
    .ALUMODE ( 4'b0000 ),
    .OPMODE ( 7'b010_00_11 ), // Z = P reg, Y = 0, X = A:B 48-bits
    .CEP ( iCount ),
    .RSTA ( wReset ),
    .RSTALLCARRYIN ( wReset ),
    .RSTALUMODE ( wReset ),
    .RSTB ( wReset ),
    .RSTC ( wReset ),
    .RSTCTRL ( wReset ),
    .RSTD ( wReset ),
    .RSTINMODE ( wReset ),
    .RSTM ( wReset ),
    .RSTP ( wReset ),
    .ACIN ( 30'd0 ),
    .BCIN ( 18'b0 ),
    .C ( 48'b0 ),
    .CARRYCASCIN ( 1'b0 ),
    .CARRYIN ( 1'b0 ),
    .CARRYINSEL ( 3'd0 ),
    .CEA1 ( 1'b0 ),
    .CEA2 ( 1'b0 ),
    .CEAD ( 1'b0 ),
    .CEALUMODE ( 1'b0 ),
    .CEB1 ( 1'b0 ),
    .CEB2 ( 1'b0 ),
    .CEC ( 1'b0 ),
    .CECTRL ( 1'b0 ),
    .CECARRYIN ( 1'b0 ),
    .CED ( 1'b0 ),
    .CEINMODE ( 1'b0 ),
    .CEM ( 1'b0 ),
    .D ( 25'd0 ),
    .INMODE ( 5'd0 ),
    .MULTSIGNIN ( 1'b0 ),
    .PCIN ( 48'd0 ),
    .ACOUT (),
    .BCOUT (),
    .CARRYCASCOUT (),
    .CARRYOUT (),
    .MULTSIGNOUT (),
    .OVERFLOW (),
    .PATTERNDETECT (),
    .PATTERNBDETECT (),
    .PCOUT (),
    .UNDERFLOW ()
     

  • How to Automate L1 level of work in Windows, Exchange & Hyperv-V environment?

    Hi,
    I would like to know if Microsoft has any tool to automate L1 or L2 level of tasks.
    Purpose of automation would be get rid of Human errors & reduce the time it takes to complete.
    for Example,
    1. There is a New joinee in organization, so automation process would be able to do following things:
       - Create user's AD Account
      - According to his designation, Mailbox Quota would be defined.
      - E-mail address generation.
      - As per the level of user, access in the Domain & respective sub-domains.
    2. Users account got locked out:
      - It should send an SMS to user about account lockout.
      - And also send OTP (one Time Password) to Reset it.
    These two were just examples. There are many more tasks are perform by L1 & L2 Teams.
    Looking forward for the Automation process which will help to design such numerous tasks.
    Regards,
    Prashant Sahane

    Hi,
    Generally, when create a new user in Exchange, the mailbox quota would be set to the default quota in Exchange. The E-mail address would be automatically generated by default Email Address Policy in Exchange. If you want to change every new create user,
    we can change the default value in mailbox database level. Or we can use a identified script to set the limitation for new-mailbox cmdlet. For example:
    New-Mailbox -UserPrincipalName [email protected] -Alias chris -Database "Mailbox Database 1" -Name ChrisAshton
    -Password (ConvertTo-SecureString -String Password01! -AsPlainText -Force)
    | Set-Mailbox -ProhibitSendQuota 2097152 -ProhibitSendReceiveQuota 2411520
    For the second question, please follow Hinte’s suggestion to ask a question in
    Active Directory forum for more help.
    Regards,
    Winnie Liang
    TechNet Community Support

  • Vivado HLS 2015.x config_interface -register_io

    Hello!
    In VHLS 2015.x there is new option: config_interface -register_io. From User guide it is not clear to what types of interface this option can be applied though. Can you confirm that this option can be applied to ap_bus m_axi interface signals? If yes does this mean that AXI Register Slice core is additiobally inserted on this m_axi interface? 
    I am using Virtex-7 2000t device and trying to fight timing issues in my hls core by flourplanning hls core to different SLR. HLS core has AXI master interface to AXI bus with external DDR memory. All AXI bus components including AXI Interconnect IP and DDR3 MIG core are flourplanned to SLR1 and HLS core to SLR2. I know that it is critical to register all nets that cross SLR boundary on both sides of it. I can insert AXI register slice on AXI Interconnect IP  port and I what to do the same on HLS side. 
    If config_interface -register_io can not do what I want my second thought was to add one more AXI Interconnect IP on HLS side inserting AXI register slice on port that is to connect to main AXI Interconnect.
    What can you suggest?  
     

    Thanks for the reply.
    Took a while to test your suggestion.
    axi mmu was not enough to change the behavior of the address editor.
    Still, I failed to have my AXI master interfaces capable of 64 bit addressing.
    The axi master should support 64 bits for the axi_mmu to map 64bit addresses.
    Though, Vivado (address editor) thinks my module has only 32bit aw_addr / ar_addr channels, even though I do have 64bit aw_addr / ar_addr channels.
    Actually,
    My goal was to provide a DMA64 (high memory DMA in other cases)capability to a prototype DRAM based SSD on the VC709 board.
    This function was required in order to eliminate the need of bounce buffers (bouncing high memory buffers into DMA'able addresses via memcpy & stuff) in the host side.
    In this case, the AXI master is my module, accessing to the axi pcie axi slave port, looking at axi2pci apertures.
    I had to access axi2pci apertures which has axi addresses mapped way above 0xFFFF_FFFF (something like 0x0001_0000_0000_0000 ~ 0x0001_FFFF_FFFF_FFFF axi2pci apertures, to access host side DMA addresses such as 0x0000_0003_EC0B_0000)
    During the way, I failed to address axi2pci above 32 bits even though I gave "config_interface -m axi_addr64" with my HLS module.
    Eventually I managed to use the axi datamover IP, or axi cdma IP in order to achieve my goals, since the IPs were capable of addressing 64 bit axi addresses.
    Though I am still wondering about 64 bit address generation in HLS.  Actually what happens when we apply "config_interface -m axi_addr64" directive. 
    If it worked as I intended, I could have made AXI4 mm transactions directly from my HLS code.
    Regards,
    Woong.
     

  • Error Message: Can not generate mask for the LMB peripherals

    I've added a bunch of  perhipherals to my microblaze project and used the Generate Addresses button.  I get the below error messges when I try to generate a net list. ERROR:EDK:3193 - issued from TCL procedure
       "::hw_lmb_bram_if_cntlr_v2_10_b::update_syslevel_mask" line 88
        C_MASK (IPNAME:lmb_bram_if_cntlr, INSTANCE:ilmb_cntlr) - Can not generate
       mask for the LMB peripherals! An address decode mask is assigned to all LMB
       peripherals connected to the MicroBlaze processor. The address decode mask is
       based on a set of decode bits that distinguish the LMB address space from the
       OPB/PLB address space. The error message indicates that a set of decode bits
       can not be found to generate a mask. Please modify the address map of the
       slaves connected to OPB/PLB to use a common address bit.
    ERROR:EDK:1585 - IPNAME:lmb_bram_if_cntlr INSTANCE:ilmb_cntlr -
       E:\Xilinx\11.1\EDK\hw\XilinxProcessorIPLib\pcores\lmb_bram_if_cntlr_v2_10_b\d
       ata\lmb_bram_if_cntlr_v2_1_0.mpd line 77 - error computing override value for
       C_MASK using tcl
    ERROR:EDK:3193 - issued from TCL procedure
       "::hw_lmb_bram_if_cntlr_v2_10_b::update_syslevel_mask" line 88
        C_MASK (IPNAME:lmb_bram_if_cntlr, INSTANCE:dlmb_cntlr) - Can not generate
       mask for the LMB peripherals! An address decode mask is assigned to all LMB
       peripherals connected to the MicroBlaze processor. The address decode mask is
       based on a set of decode bits that distinguish the LMB address space from the
       OPB/PLB address space. The error message indicates that a set of decode bits
       can not be found to generate a mask. Please modify the address map of the
       slaves connected to OPB/PLB to use a common address bit.
    ERROR:EDK:1585 - IPNAME:lmb_bram_if_cntlr INSTANCE:dlmb_cntlr -
       E:\Xilinx\11.1\EDK\hw\XilinxProcessorIPLib\pcores\lmb_bram_if_cntlr_v2_10_b\d
       ata\lmb_bram_if_cntlr_v2_1_0.mpd line 77 - error computing override value for
       C_MASK using tcl I understand its complaining about the mask values, but I'm not exactly sure why.  Here is the address map it shows:Address Map for Processor microblaze_0
      (0000000000-0x00003fff) dlmb_cntlr    dlmb
      (0000000000-0x00003fff) ilmb_cntlr    ilmb
      (0x81800000-0x8180ffff) xps_intc_0    mb_plb
      (0x81c00000-0x81c0ffff) xps_ll_temac_0    mb_plb
      (0x83400000-0x8340ffff) Generic_SPI    mb_plb
      (0x83c00000-0x83c0ffff) xps_timer_0    mb_plb
      (0x84000000-0x8400ffff) RS232    mb_plb
      (0x84400000-0x8440ffff) mdm_0    mb_plb
      (0x8c000000-0x8fffffff) mpmc_0    mb_plb
      (0xfffff000-0xffffffff) xps_gpio_0    mb_plb Any thoughts?  I was unable to find another instance of this error message.

    Version 11.3 I actually figured it out, its rather odd that the generate addresses button doesn't do this automatically. It appears that the mask was set to trigger use of the cache on a single bit.  0x00800000.  I had enough devices added where automatic address generation was using the most significant bit meaning that bit was falling within other address spaces. I changed it to 0xFFFFC000.  (Basically telling it to match addresses if all address signals above 16KB are zero).  I don't know if that is the proper way to do it, but it accepted it.  Now I'm fighting with some stuff regarding an FSL bus I added that apparently isn't quite properly setup, so I haven't found out yet if the processor likes that address mask.   But the tools appear to like it.

  • I have just requested my ipod nano 1st generation to be replaced using the scheme, i have entered the wrong postcode on the shipping of the replacement box, will it still come to my address? or how can i change it?

    I have just requested my ipod nano 1st generation to be replaced using the scheme, i have entered the wrong postcode on the shipping of the replacement box, will it still come to my address? or how can i change it?

    Call up apple care,  (08000480408 if you are in the UK) and ask them to change the postcode and request another replacement packet

  • Have a 1st generation Apple TV, which is not showing as a device in iTunes. Had no problems with Apple TV until I changed from a Windows PC to an iMac. I have changed my IP address, sub mask address and router address in the Apple TV, Can anyone help?

    I have a 1st generation apple TV, which was working perfectly until I changed from a Windows PC to a Imac. The Apple TV will not show in Itunes. I have changed the IP address, sub mask  and Router IP address. Since changing I have switched everything of and on again. Can anyone help?

    I have a new router and computer. I have just remembered that just before my old PC died on me, I transferred my iTunes library to a hard drive. I can't remember exactly just how I got my library back, but there are definately things in my library now that were in my library on my old PC! Hope this makes sense. What do you mean by same location? Do you mean in the same place in the house?
    Another difference I have just thought of was my old router was connected directly to the computer bu I have not been able to do this with Sky as my PC is not near a phone socket! Will this make a difference?

  • I need to change my apple ID because I'm changing my email address. I'm worried that when I do, I'll no longer be able to use my first generation apple tv unless I change the apple ID there as well.  Does anyone know how this works??

    I have to change my apple ID because I'm changing my email address. (I have a Comcast address and am switching to U-verse) I'm worried that when I do, I'll no longer be able to use my first generation apple tv unless I change the apple ID there as well. I'm also trying to find out if changing my apple ID is going to interfere with getting my itunes content on my computer and my iphone.  Does anyone know how this works??

    My iTunes appleID is an old defunct e-mail address - it does not have to be functional.
    Do what Winston says to ensure you keep getting correspondence related to that ID.
    AC

  • HT1351 My fifth generation nano will no longer sync my address book from my Mac. It gives me an error message that "You have no contacts" and asks me if I want to create some.  My address book is full of contacts. Sync works for everything else.

    My 5th generation nano will no longer Sync my address book from my Mac.  It gives me a message that I have no "Contacts", and asks if I want to create some.  My address book is full of contacts, but for some reason it thinks it is empty.  All the other sync operations work fine including iCal.  My Mac is running OS X 10.7.4.

    It sounds like all of your contacts on your Mac running Lion are actually stored up in iCloud. 
    Several users running Mac OS X Lion and now ML (and iCloud) have no longer been able to "sync" contacts over to their older iPods models.
    A work around is to export all of your contacts out of Address Book as vCards and them copy these vCards into your iPod's Contacts folder.  You'll need to have the Enable Disk Use option ticked from under the iPod's Summary tab in order to browse out to the iPod's Contacts folder via the Finder.
    Using your iPod as a storage drive
    That's the only "solution" I have been able to use to get contacts to sync/appear on my 5G iPod Video.
    B-rock

  • Hi! How can I change the shipping address for the program of replacement of the 1 generation ipod nano? I've already received the empty box and now I should send back the old ipod but I'd like to receive the new one to another address. Thank you.

    Hi! How can I change the shipping address for the program of replacement of the 1 generation ipod nano? I've already received the empty box and now I should send back the old ipod but I'd like to receive the new one to another address. Thank you.

    I would contact Apple directly and have them work with to get the iPod shipped to a new/different address.
    http://www.apple.com/contact/
    B-rock

  • HT1911 How do I get my Ipod touch 4th generation to change my email address? I have updated my account on Itunes, but when I go to purchase or update it still shows my old email address.

    I recently chenged my email address on Itunes. When I plugged in my Ipod 4th generation Itouch, it still shows my old email address.
    It syncs everytime, but the old email address is keeping me from making other purchases. How do I fix this?

    In order to change your Apple ID or password for your iTunes account on your iOS device, you need to sign out from your iOS device first, then sign back in using your updated details. (Settings > store, scroll down and tap your ID)

  • Airport extreme 4th generation - self-assigned IP address

    2 Airport extreme 4th generation with latest firmware. extented network in bridge mode.
    After switching providers, I reset both my airports and set them up new accordingto manual.
    Only some devices (less than 50!) at times can't get an IP address.
    Error msg: Airport has a self-assigned IP address .......... and will not be able to connect to the internet.
    My new provider told me it is an internal probem. Quote: This is an internal issue between your devices and your internal routers. we only gives an address to your router and it is your router that gives your devices an address.
    My question is, which part of the manual settings in Airport Utility affect the distribution of internal IP addresses?
    or how to change my set-up to avoid the problem I'm experiencing?
    thanks a lot.

    When in brigde mode your provider has to supply at least one IP address for each devices you want to connect.
    Alt. turn bridge mode off in Airport Utilities and let your Base station distribute IP addresses. For that you have to enter two DNS addresses.
    HTH.

  • My iPod touch 2nd generation does not sync my contacts. I only have iCloud contacts in my address book. How can i sync that?

    My iPod touch 2nd generation does not sync my contacts. I only have iCloud contacts in my address book. How can i sync that?

    I do not fully understand you question.  To use iCloud on an iOS device requires iOS 5 and the 2G only goes to iOS 4.1.2 and thysyu can't access iCloud, including contacts.
    Maybe you could sync the iCloud contacts with anopther program and sync that program with the 2G iPod.
    The following smple states the following for Contacts:
    iCloud: What if my device or computer doesn't meet iCloud system requirements?
    Contacts
    If you want to check your iCloud Contacts, you can do so by visiting icloud.com from a Mac or PC (as long as it meets the browser system requirements for icloud.com).

  • HT204380 I cant set up my facetime in a new iPod touch 5 generation, I enter my apple id and password and select my email address and it get verification but after that it come back to enter my apple id and password again. please help

    I cant set up my facetime in a new iPod touch 5 generation, I enter my apple id and password and select my email address and it get verification but after that it come back to enter my apple id and password again. please help

    This is the iPhone forum

Maybe you are looking for

  • Can't open attachments in other apps from mail

    recently I can't see other apps in mail when I try to do the "open in" functionality. For example if I receive a pdf document and I want to save to Dropbox I used to see the Dropbox app. Now I don't see it anymore.. I don't see any off the microsoft

  • Block the revise item form G/L line item

    Dear All Expert In G/L line item (eg.FBL3n) we do not want to see the revised documents (revised by / revised for). Can it possible to block? Please advice. I need very urgently. Thanks in advance.

  • Tabstop in a text field not displayed...

    Hello, i've got following problem: In an table there's an varchar field. This may contains a tabstop, like this textTextText123Text(now tabstop ) textText In Report the tabstop won't be displayed accurate. Maybe it will be displayed just as on space.

  • SharePoint 2010 Database maintenance for beginners / developers

    Hey, here is a thing which I concern myself with from time to time. As a fulltime developer for SharePoint, I'm not quite familiar with maintaining it's databases. So after I set up my dev environment I usually don't care about maintaining the system

  • How to make fonts larger, darker

    I have poor vision and would like larger and bolder text.