public String getInterface(String inIPAddress)
			throws InvalidIPAddressException {

		String binIP = IPV4Address.toBinaryString(inIPAddress);

		String binMask;

		String destNetwork;

		String curdestNetwork;

		Route_entry r;

		// many vars :)

		Enumeration keys1 = routingTable.keys();

		while (keys1.hasMoreElements()) {

			curdestNetwork = (String) keys1.nextElement();

			r = (Route_entry) routingTable.get(curdestNetwork);

			if (r.gateway.contains("*") && curdestNetwork.contains(inIPAddress))

				return r.iFace;

			binMask = IPV4Address.toBinaryString(r.genMask);

			destNetwork = IPV4Address.toDecimalString(IPV4Address.IPandMask(
					binIP, binMask));

			if (destNetwork.contains(curdestNetwork))
				return r.iFace;

		}

		return null;

	}