[script] reliable interface stats - Galaxy Ace S5830 General

[script] reliable interface stats
pro: reliable, works on any Linux; low battery consumption; runs only when necessary
contra: no GUI
prerequisites: script manager able to trigger on network changes
root is not needed, because the script uses the readable-for-all /proc/net/dev interface to gather statistics.
My problem was that I could not find any app that would give me the megabytes sent from/to the device. They would either ignore GPRS, WiFi or count from reboot to reboot, display stupid ads or cost even money without delivering. I'm on a data flatrate with throttling from 200MB up, and I only want to know how much I already "spent".
The following script should run on network changes, but it can be run at any time. You get more data entries in the log files for the various active interfaces when running it more often.
EDIT: it turns out the "network change" event works perfectly for interface wlan0, but not for pdp0, which happens to be the GPRS/G2/G3/G4 packet interface. Maybe "Tasker" does better than "Script Manager" with this, try and find out. What will always work is manual mode: after using an interface, run the script. This will enter the numbers from any interface that traffic into the respective log.
The script is run with zero or one argument. If given, it can be the name of an interface or the string "all" to get just a readout of the current counters of all interfaces that had traffic without logging anything.
The output is lines with bytes, data packets, errornous and dropped packets for "rx" (received) and "tx" (transmitted) for all or the selected interfaces. Without arguments all active interfaces are logged to separate files in /sdcard/. If you want to change this directory or the names or the date format, well, it should be easy to adapt.
Note that this first script does only data gathering as to the byte counts and it must run on network events. See below for the script(s) that do evaluation according to date to find out how much to go until throttling.
Code:
#!/system/bin/sh
want_if="${1:-*}"
all=""
case "-${want_if}" in
-all)
want_if="*"; all=all;
;;
esac
log_prefix="/mnt/sdcard/interface-stats"
now="$(date '+%d.%m.%y-%H:%M:%S')"
# rx: bytes packets errs drop fifo frame compressed multicast
# tx: bytes packets errs drop fifo colls carrier compressed
# lo: 4944 74 0 0 0 0 0 0 4944 74 0 0 0 0 0 0
# wlan0: 42447725 41554 302 0 0 0 0 0 3280981 33753 0 0 0 0 0 0
while read intf rb rp re rd x x x x tb tp te td rest
do
case "-${intf}" in
-${want_if:-*}:)
case "${rb}--${tb}" in
0--0) continue;;
esac
stats="rx: $rb $rp $re $rd tx: $tb $tp $te $td"
intf_="${intf%:}"
echo "${intf} ${stats}"
[ -z "${all}" ] &&
echo "${now} ${stats}" >> "${log_prefix}-${intf_}.txt"
;;
esac
done < /proc/net/dev
exit 0
Here's the script to output the megabytes. It gets zero, one or two arguments, the first being a date pattern that needs to match the dates in the log file, the second the name of said logg.
An optional third argument, if given, gives debug output. Use only if the number doesn't look plausible.
It doesn't need any special privileges and can be run anytime.
If less than one megabyte has been hit so far, then the output is the number of bytes. Due to limitations of "awk" there can still be decimals in the output!
Code:
# /home/ino/interface-stats.sh _date: 20120225-2103_
# vim: set filetype=sh ts=4:
# -*- mode: sh; -*-
#
# <url:man:1 awk>
# sample:
#
# 25.02.12-02:28:28 rx: 182909647 374371 462 0 tx: 681742703 542899 0 0
# 25.02.12-12:15:00 rx: 3 374464 494 0 tx: 5 542974 0 0
#
# at around noon the device was rebooted, so the stats start at low
# values.
#
# algorithm:
#
# initialize old-accumulator and offset to zero.
#
# since received and transmitted bytes are accumulated by the kernel,
# the script has to just store the sum of the received and transmitted
# bytes into an accumulator, unless the current value is less than the
# running count. this happens after a reboot. so store this first low
# value into $offset, store the old accumulator and keep the running game
# until either the next reboot or EOF. now
# accumulator = old-accumulator + accumulator - offset.
awk_prog='
BEGIN {
debug = debug > 0
accu=0
accu_old=0
offset=0
accu_sum=0
# megabytes
mb_scaler=1024*1024
# field definitions
rx_bytes=3
rx_packets=4
rx_errors=5
rx_dropped=6
tx_bytes=8
tx_packets=9
tx_errors=10
tx_dropped=11
# date pattern
# 25.02.12-12:15:00 rx: 3 374464 494 0 tx: 5 542974 0 0
pat_date_dflt = "[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]-[0-9][0-9]:[0-9][0-9]:[0-9][0-9]"
pat_date = length(pat_date) == 0 ? pat_date_dflt : pat_date
}
function dbg(x) {
if (debug > 0) print("debug: " x);
}
# no particular validity check: if there are 11 fields and the first one
# matches the date the user is after, we will use the record.
(NF == 11) && ($1 ~ pat_date) {
dbg("select line: " $0)
accu_sum = $rx_bytes + $tx_bytes
if (accu_sum < accu) {
dbg("break: accu_sum=" accu_sum "; accu_old=" accu_old "; accu=" accu "; offset=" offset);
accu = accu_old + accu - offset
accu_old = accu
offset = accu_sum
accu = accu_sum
} else {
accu = accu_sum
}
}
END {
dbg("eof: accu_sum=" accu_sum "; accu_old=" accu_old "; accu=" accu "; offset=" offset);
accu = accu_old + accu - offset
if (accu > mb_scaler) accu = (accu / mb_scaler) "MB"
print(accu)
}
'
debug=0
log_prefix="/mnt/sdcard/interface-stats"
dates="${1:-.}"
want_if="${2:-wlan0}"
debug="${3+1}"
input="${log_prefix}-${want_if}.txt"
awk -v pat_date="${dates}" -v debug="${debug}" "${awk_prog}" "${input}"
And finally this one is for quick inspection of a logg. Gets the name of an interface as argument if needed. Again it needs no privileges and is appropriate for use as a SMwidget.
Code:
#!/system/bin/sh
want_if="${1:-wlan0}"
log_prefix="/mnt/sdcard/interface-stats"
logg="${log_prefix}-${want_if}.txt"
[ -r "${logg}" ] &&
while read tim rx rb rp re rd tx tb tp te td rest
do
case "${rb}--${tb}" in
0--0) continue;;
esac
stats="rx: $rb $rp $re $rd tx: $tb $tp $te $td"
echo "${tim} ${stats}"
done < "${logg}"
exit 0

Does somebody know what tags to brace code with in order to keep formatting intact? To me all my stuff has no indentation and lines seem to break at other points than just and only newlines!
EDIT: just found out that there's no problem in the web view, it's just the "forum runner" that can't render what the "\[ code \]" tag generates.
Well, as an alternative, what's the least-hassle file dump?

Related

"Guide" how to enable N standard and 5ghz band on ics

Hi
I have discovered how to enable N standard and 5ghz band in ics
1. go to /system/etc/firmware
2. find these files names
PHP:
fm_rx_init_1273.2.bts
fm_tx_init_1273.2.bts
fmc_init_1273.2.bts
If they are their u can apply 5ghz band .. But if they aren't .. U won't get 5ghz band
Now for gb users
4.Go to /system/etc/ and find tiwlan.ini
Note: In CM7 based ROMs the path may be /system/etc/wifi
5.Look for the following lines:
PHP:
HT_Enable=0
BurstModeEnable =0
WifiAdhoc=0
Single_Dual_Band_Solution =0
To
PHP:
HT-Enable=1
BurstModeEnable =1
WifiAdhoc=1
Single_Dual_Band_Solution =1
Reboot your phone and have fun
U can see all that in orher threads .. But in ics u cann't find 1st 3 of these lines
So i have discovered a way to enable that in ics
Now for ics users
1-Go to /system/etc/ and find tiwlan.ini
Note: In CM7 based ROMs the path may be /system/etc/wifi
2-open tiwlan.ini with text editor
Select all words and delete
after that past these lines .. It is from gb and it workes on ics
PHP:
# Note: The letters in this file are NOT case sensitive.
IniVersion = 0 # compatibility version between the ini file and the wlan driver
SmeConnectMode = 1 #0 - auto, 1 - manual
ScanResultAging = 0 # in Second - range 0..1000
WME_Enable = 1 #0=diable WME support / 1=Enable
dot11NetworkType = 3 #2 - A only mode, 3 - B/G mode, 4 - A/G Dual mode
SmeScanGChannelList = 1,2,3,4,5,6,7,8,9,10,11,12,13,14
SmeScanAChannelList = 36,40,44,48,52,56,60,64
RecoveryEnable = 1 #0 -Disabled 1- Enabled
BThWlanCoexistEnable = 1 #0 - SG disable, 1 - SG protective
TxCompleteThreshold = 3
RxAggregationPktsLimit = 8
RxInterruptThreshold = 3 #0 - Rx Pacing disable
QOS_txBlksThresholdVO = 2 # Reserved Blks for voice
#
# Power Manager
#
BeaconListenInterval = 1 # the number of N-Beacon or N-DTim
DtimListenInterval = 1 #
dot11PowerMode = 0 #0 - Auto
#1 - Active
#2 - Short Doze
#3 - Long Doze
AutoPowerModeDozeMode = 3 #2 - Short Doze
#3 - Long Doze
AutoPowerModeActiveTh = 0 #packets per second
AutoPowerModeDozeTh = 0 #packets per seconds - threshold for entering ELP in Auto mode
AutoPowerModeInterval = 100
defaultPowerLevel = 0 #0 - ELP
#1 - PD
#2 - AWAKE
PowerSavePowerLevel = 0 #0 - ELP
#1 - PD
#2 - AWAKE
TxPower = 205 #set Default Tx Power Level in DBM * 10
dot11FragmentationThreshold = 4096
dot11RTSThreshold = 4096
WPAMixedMode= 1
RSNPreAuthentication = 1
CalibrationChannel24 = 1
CalibrationChannel5 = 36
# Regulatury Domain tables.
# Each byte correlates to one channel in sequential order. Table 2.4 starts from channel 1, Table 5.0 starts from channel 36.
# Bits 0..4 - Max power allowed in Dbm.
# Bit 6 - Channel is allowed for Active scan
# BIt 7 - Channel is allowed
AllowedChannelsTable24 = FFFFFFFFFFFFFFFFFFFFFFFFFFFF
AllowedChannelsTable5 = FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF000000FF000000000000000000000000000000
SpectrumManagement = 0 # 0 - Disable 802.11h, 1 - Enable
RxBroadcastInPs = 1
#arp ip filter - must be written 8 characters for example 10.2.43.3 -> 0a 02 2b 21 and not a 2 2b 21
ArpIp_Addr = 0a 02 0a b7
ArpIp_Filter_ena = 0
#mac filter
Mac_Filter_Enabled = 0
numGroupAddrs = 4
Group_addr0 = 10 01 02 03 04 05
Group_addr1 = 11 11 12 13 14 15
Group_addr2 = 12 21 22 23 24 25
Group_addr3 = 13 31 32 33 34 35
Group_addr4 = 14 41 42 43 44 45
Group_addr5 = 15 51 52 53 54 55
Group_addr6 = 16 61 62 63 64 65
Group_addr7 = 17 71 72 73 74 75
#beacon filter
Beacon_Filter_Desired_State = 1
Beacon_Filter_Stored = 1
#beacon IE table
#the size is the len of the string - spaces = number of bytes
Beacon_IE_Num_Of_Elem = 16
Beacon_IE_Table_Size = 37
Beacon_IE_Table = 00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 3d 01 85 01 dd 01 00 52 f2 02 00 01
# rate policy - short / long retries
RatePolicyUserShortRetryLimit = 10
RatePolicyUserLongRetryLimit = 10
#rate policies
#rates guide: -->>mcs7,msc6,mcs5,mcs4,mcs3,mcs2,mcs1,mcs0,54,58,36,24,22,18,12,11,9,6,5.5,2,1
OsDbgState = 0x01e9003c # -1 or 0xffffffff -all (opens debug messages in o.s. only - sevirity+modules)
#############################################################
# Configure the severity table (0 = Disable/ 1 = Enable)
#
# Byte #0: Init
# Byte #1: Information
# Byte #2: Warning
# Byte #3: Error
# Byte #4: Fatal Error
# Byte #5: SM
# Byte #6: Console
#############################################################
ReportSeverityTable = 00001101
BeaconReceiveTime = 50
#
# QOS UPSD
#
desiredPsMode = 1 # Global Power save delivery protocol (1 - UPSD, 0 - Legacy)
QOS_wmePsModeBE = 0 # Power save delivery protocol for BE AC (1 - UPSD, 0 - Legacy)
QOS_wmePsModeBK = 0 # Power save delivery protocol for BK AC (1 - UPSD, 0 - Legacy)
QOS_wmePsModeVI = 0 # Power save delivery protocol for VI AC (1 - UPSD, 0 - Legacy)
QOS_wmePsModeVO = 1 # Power save delivery protocol for VO AC (1 - UPSD, 0 - Legacy)
#
# QOS Classifier
#
Clsfr_Type = 1 # 1 - DSCP, 2 - Port, 3 - IP+port
NumOfCodePoints = 4
DSCPClassifier00_CodePoint = 0 #Best Effort
DSCPClassifier00_DTag = 0
DSCPClassifier01_CodePoint = 8 #Background
DSCPClassifier01_DTag = 1
DSCPClassifier02_CodePoint = 40 #Video
DSCPClassifier02_DTag = 5
DSCPClassifier03_CodePoint = 56 #Voice
DSCPClassifier03_DTag = 6
dot11MaxReceiveLifetime=512000
WiFiAdhoc = 1
dot11BeaconPeriod = 100
ConnSelfTimeout = 60000
RRMEnabled = 0
WiFiWmmPS = 0 # Use 1 on WiFi test in order to configure PS to work in WMM mode
TriggeredScanTimeOut = 50000 # Maximum time in Us between 2 channels on triggered scan
# PsPoll delivery failure solution
PsPollDeliveryFailureRecoveryPeriod = 20 # Time in Ms to stay ACTIVE ('0' to disable feature)
ConsecutivePsPollDeliveryFailureThreshold = 4 # Number of failed PsPoll's to start ACTIVE time out
#Auto Rx streaming
PsTrafficPeriod = 20
# Weights in percent for RSSI/SNR Average calculations
RssiBeaconAverageWeight = 20
RssiPacketAverageWeight = 10
SnrBeaconAverageWeight = 20
SnrPacketAverageWeight = 10
HT_Enable=1 # 0 = diable 802.11n support / 1=Enable
IbssProtectionType = 1 # 0 = CTS protaction disable ; 1 = Standard CTS protaction
BurstModeEnable = 1 # 0 - Disabled 1 - Enabled
RoamScanEnable = 1 # 1- roaming and immidate scan enable by deafult 0- allowing roaming ' scannig due to CLI confguration
RoamingOperationalMode = 1 # 0=Manual , 1=Auto
coexDhcpTime = 4000
BaPolicyTid_0 = 3
#============================ Radio parameters - Start ========================
#------- General parameters ------
TXBiPFEMAutoDetect = 0 # Length: 1; Unit: Options (0: Manual Mode, 1: Automatic mode); Format: Unsigned; Source: Customer; Comment: This parameter is used by the FW to decide if the front-end is determined automatically or manually
TXBiPFEMManufacturer = 1 # Length: 1; Unit: Options (0: FEM0, 1: FEM1); Format: Unsigned; Source: Customer; Comment: (bit0) This parameter is used to determine which FEM vendor type is used on the platform
STRFRefClock = 1 # Length: 1; Unit: Bit_Options; Format: Unsigned; Source: Customer; Comment: 5'bXX000 : Bit 0,1,2 - 0: 19.2MHz, 1: 26MHz, 2: 38.4MHz [Default], 3: 52MHz, 4: 38.4MHz XTAL, 5: 26MHz XTAL , 5'bX0XXX : Bit 3 - CLK_REQ type, 0 = wired-OR [Default], 1= push-pull , 5'b0XXXX : Bit 4 - CLK_REQ polarity, 0 = Normal [Default], 1=Inverted
STRFRefClockSettingTime = 5 # Length: 1; Unit: ms (0-15); Format: Unsigned; Source: Customer; Comment: The time from asserting CLK_REQ (low to high) to valid FREF clock on the device inputs
ClockValidOnWakeup = 0 # Length: 1; Unit: Options (0: Reference clock not valid, 1: Reference clock is valid and stable); Format: Unsigned; Source: Customer; Comment: This parameter indicates whether the FREF clock is valid on wakeup
TCXO_Clk = 1 # Length: 1; Unit: Bit_Options; Format: Unsigned; Source: Customer; Comment: 5'bXX000 : Bit 0,1,2 - 0: 19.2MHz, 1: 26MHz, 2: 38.4MHz [Default], 3: 52MHz, 4: 16.368Mhz, 5: 32.736 Mhz
TCXO_SettlingTime = 5 # Length: 1; Unit: ms (0-15); Format: Unsigned; Source: Customer; Comment: The time from asserting CLK_REQ (low to high) to valid TCXO clock on the device inputs
TCXO_ClockValidOnWakeup = 0 # Length: 1; Unit: Options (0: Reference clock not valid, 1: Reference clock is valid and stable); Format: Unsigned; Source: Customer; Comment: This parameter indicates whether the TCXO clock is valid on wakeup
TCXO_LDO_Voltage = 0 # Length: 1; Unit: Options (0:2.5v, 1:2.55v, 2:2.6v); Format: Unsigned; Source: Customer; Comment: TCXO LDO Voltage
Platform_configuration = 2 # Length: 1; Unit: Bit_Options; Format: Unsigned; Source: Customer ; Comment: Bit 0: Levelshifter support (0: No LS, 1: With LS), Bit 1,2:Configure IO's [SDIO/wspi] (00- 8mA, 01- 4mA (default), 10- 6mA, 11 - 2mA), Bit 3:Eeprom (0-No Eeprom), Bit 4: SDIO IB Enable sync, Bit 5: SDIO IB Enable async, Bit 6: SDIO IB Enable BlockMode, Bit 7: SDIO High-Speed support
Single_Dual_Band_Solution = 1 # Length: 1; Unit: Options (0: 2.5v, 1: 2.55v, 2: 2.6v); Format: Unsigned; Source: Customer; Comment: This field notifies the FW whether the solution is a single-band or dual-band
Settings = 00,00,00,00 # Length: 4; Unit: Bit_Options; Format: Unsigned; Source: Customer; Comment: Bit0: NBI (0: Off, 1: On), Bit1: Telec channel 14 (0: Off, 1: On), Bit2: FEM0-LB, Bit3: FEM0-HB, Bit4: FEM1-LB, Bit5: FEM1-HB - TX BiP load (0: Internal, 1: External), Bit6: LPD Low band, Bit7: LPD High band
XTALItrimVal = 4 # Length: 1; Unit: Current trimming for XTAL; Format: Unsigned; Source: TI; Comment: Current trimming for XTAL
SRState = 0 # Length: 1; Unit: Options (0: Disabled, 1: Enabled); Format: Decimal; Source: TI; Comment: Smart Reflax (proprietary mechanism of TI that identify the silicon process specific params) state
SRF1 = 09,04,19,10,08,00,f7,ef,e6,de,00,00,00,00,0f,3f # Length: 16; Unit: SRF1 values; Format: Signed; Source: TI; Comment: The table holds the specific parameters for using the SmartReflex mechanism
SRF2 = 09,04,19,10,08,00,f7,ef,e6,de,00,00,00,00,00,00 # Length: 16; Unit: SRF2 values; Format: Signed; Source: TI; Comment: The table holds the specific parameters for using the SmartReflex mechanism
SRF3 = 09,04,19,10,08,00,f7,ef,e6,de,00,00,00,00,00,00 # Length: 16; Unit: SRF3 values; Format: Signed; Source: TI; Comment: The table holds the specific parameters for using the SmartReflex mechanism
#SR_Debug_Table = 09 04 19 10 01 00 F7 EF E6 DE 00 00 00 00 00 00 # Length: 16; Unit: SR_Debug_Table values; Format: Signed; Source: TI; Comment: SR Debug values - for TI internal use only
#SR_SEN_N_P = 11 # Length: 1; Unit: SR_SEN_N_P values; Format: Unsigned; Source: TI; Comment: SR Debug values - for TI internal use only
#SR_SEN_N_P_Gain = AA # Length: 1; Unit: SR_SEN_N_P_GAIN values; Format: Unsigned; Source: TI; Comment: SR Debug values - for TI internal use only
#SR_SEN_NRN = B6 # Length: 1; Unit: SR_SEN_NRN values; Format: Unsigned; Source: TI ; Comment: SR Debug values - for TI internal use only
#SR_SEN_PRN = F0 # Length: 1; Unit: SR_SEN_PRN values; Format: Unsigned; Source: TI ; Comment: SR Debug values - for TI internal use only
RxTraceInsertionLoss_2_4G = 0 # Length: 1; Unit: 1/8dB; Format: Unsigned; Source: Customer; Comment: This parameter indicates the printed circuit board (PCB) trace insertion loss
TxTraceLoss_2_4G = 00,00,00,00,00,00,00,00,00,00,00,00,00,00 # Length: 14; Unit: 1/8dB; Format: Unsigned; Source: Customer; Comment: This parameter is used to align the output power to a different location on the board
#------------------------------------------------------
#------- Radio parameters for TQS_S_2.6 -------
FemVendorAndOptions = 1 # Length: 1; Unit: Bit_Options; Format: Unsigned; Source: Customer; Comment: Bit 0..1 - 0: RFMD, 1: TQS, 2: SKWS, Bit 4..7 [Version control] - 0: TQS-S1.0, 1: TQS-S2.0, 2: TQS-S2.5, 3: TQS-D1.0, 4: TQS-D1.5, 5: RFMD-S1.5, 6: RFMD-S2.9, 7: RFMD-S3.0, 8: RFMD-D1.5, 9: RFMD-S2.9.5, 10: RFMD-D3.0.1, 11: TQS-S2.6, 12: TQS-D1.7
TxBiPReferencePDvoltage_2_4G = 375 # Length: 1; Unit: 1mV; Format: Unsigned; Source: TI; Comment: This parameter define the reference point of the FEM power detector
TxBiPReferencePower_2_4G = 128 # Length: 1; Unit: 1/8dB; Format: Signed; Source: TI; Comment: Reference output power that produces given reference power detector output voltage . The TX BiP reference power is linked to the TX BiP reference PD voltage
TxBiPOffsetdB_2_4G = 0 # Length: 1; Unit: 1/8dB; Format: Signed; Source: Customer; Comment: This field is used to fine-tune the TX BiP by the customer
TxPerRatePowerLimits_2_4G_Normal = 1d,1f,22,26,27,29,25 # Length: 7; Unit: 1/2dB; Format: Signed; Source: Customer; Comment: The limits are applied to the power control process according to the VBAT and temperature range in which the FEM is operating
TxPerRatePowerLimits_2_4G_Degraded = 1a,1f,22,25,25,27,23 # Length: 7; Unit: 1/2dB; Format: Signed; Source: Customer; Comment: The limits are applied to the power control process according to the VBAT and temperature range in which the FEM is operating
TxPerRatePowerLimits_2_4G_Extreme = 16,1d,1e,20,24,25,22 # Length: 7; Unit: 1/2dB; Format: Signed; Source: Customer; Comment: The limits are applied to the power control process according to the VBAT and temperature range in which the FEM is operating
DegradedLowToNormalThr_2_4G = 30 # Length: 1; Unit: 1/10 volts; Format: Unsigned; Source: TI; Comment: The limits are applied to the power control process according to the VBAT and temperature range in which the FEM is operating
NormalToDegradedHighThr_2_4G = 45 # Length: 1; Unit: 1/10 volts; Format: Unsigned; Source: TI; Comment: The limits are applied to the power control process according to the VBAT and temperature range in which the FEM is operating
TxPerChannelPowerLimits_2_4G_11b = 50,50,50,50,50,50,50,50,50,50,50,50,50,50 # Length: 14; Unit: 1/2dB; Format: Signed; Source: Customer; Comment: The purpose of this table is to allow clipping of the maximum output power on certain channels
TxPerChannelPowerLimits_2_4G_OFDM = 50,50,50,50,50,50,50,50,50,50,50,50,50,50 # Length: 14; Unit: 1/2dB; Format: Signed; Source: Customer; Comment: The purpose of this table is to allow clipping of the maximum output power on certain channels
TxPDVsRateOffsets_2_4G = 01,02,02,02,02,00,02 # Length: 7; Unit: 1/8dB; Format: Signed; Source: TI; Comment: This parameter is a power detector offset value used to correct the power detector curve for each rate group
TxPDVsChannelOffsets_2_4G = 00,00,00,00,00,00,00,00,00,00,00,00,00,00 # Length: 14; Unit: 1/8dB; Format: Signed; Source: TI/Customer; Comment: This parameter is a power detector offset value used to correct the power detector curve for each channel
TxPDVsTemperature_2_4G = 00,00 # Length: 2; Unit: 1/8dB; Format: Signed; Source: TI; Comment: This parameter is a power detector offset value used to correct the power detector curve for each temperture
TxIbiasTable_2_4G = 17,17,17,13,17,17,17,17 # Length: 8; Unit: Codeword ; Format: Unsigned; Source: TI; Comment: This parameter sets the bias current provided by the SoC to the PA in the FEM. Options (MCS7, 54/48, 36/24, 18/12, 9/6, 11b, MCS0, 11bCh14)
RxFemInsertionLoss_2_4G = 14 # Length: 1; Unit: 1/8dB; Format: Unsigned; Source: TI; Comment: This parameter specifies the received insertion loss of the WL128x
#=========================== Radio parameters - End ==========================
#===========================Coexistence Parameters -Start =========================#
# PASSIVE_SCAN_BT_EDR_BT_TIME_MSEC
coexTempParam4 = 30
# PASSIVE_SCAN_BT_EDR_WLAN_TIME_MSEC
coexTempParam5 = 14
#Passive Scan Compensation time for EDR
coexBtPerThreshold = 300
#===========================Coexistence Parameters -End =========================#
If any one wants my tiwlan here
http://www.mediafire.com/?p6553158cnr47wa
U can copy words from it and replace with yours
Have fun
For all ics users that tried this and it worked please reply ..​
care to share your source plz?
iONEx said:
care to share your source plz?
Click to expand...
Click to collapse
I agree with iONEx...too 'dangerous' to delete the file and write it ALL back... can you share the file? Please xD
UchihaDareNial said:
I agree with iONEx...too 'dangerous' to delete the file and write it ALL back... can you share the file? Please xD
Click to expand...
Click to collapse
u have to delete its lines and replace these .. I did that .. U can backup ur tiwlan.ini before ..
Anyway i edit it in the original post
Guys,
My st15i have the N wifi problem (AP not in range even in house) since GB 2.3.4 fw .42, upgrade to fw .62 still got the same problem, now i upgrade to fw .431 ICS, still have the porblem, i allready paste tiwlan.ini from this thread and st15i detect my AP, but when i off wifi and on, again my AP router not in range. Info: my AP is TPlink TP-W8961ND. Need help, thankss
what does this do actually?
I tried it and I don't know how to test wether it's work or not?
XDA Premium sent this message from owner of Sk17i
akulan3 said:
Guys,
My st15i have the N wifi problem (AP not in range even in house) since GB 2.3.4 fw .42, upgrade to fw .62 still got the same problem, now i upgrade to fw .431 ICS, still have the porblem, i allready paste tiwlan.ini from this thread and st15i detect my AP, but when i off wifi and on, again my AP router not in range. Info: my AP is TPlink TP-W8961ND. Need help, thankss
Click to expand...
Click to collapse
I am happy to hear that it worked with u
I have this problem too .. Try changing router channel to 11 and try to not disconnect alot
Izzy Stinson said:
what does this do actually?
Click to expand...
Click to collapse
It increases ur android wifi range
shinishi said:
It increases ur android wifi rage
Click to expand...
Click to collapse
cool. does it work on stock gingerbread?
my wifi always gets disconnected by itself whenever im downloading big files and most of the time, while im browsing the android market and appbrain market.
and sometimes after my wifi disconnected, it doesnt reconnect by itself i need to switch off my phone wifi then switch it on back.
can this fix that?
or maybe its my router problem?
UchihaDareNial said:
I tried it and I don't know how to test wether it's work or not?
XDA Premium sent this message from owner of Sk17i
Click to expand...
Click to collapse
It will increase ur android wifi range .. U can use ur wifi at more distance for me router rage is smaller than my home distance so i need some thing like this to use internet at every corner
Izzy Stinson said:
cool. does it work on stock gingerbread?
my wifi always gets disconnected by itself whenever im downloading big files and most of the time, while im browsing the android market and appbrain market.
and sometimes after my wifi disconnected, it doesnt reconnect by itself i need to switch off my phone wifi then switch it on back.
can this fix that?
or maybe its my router problem?
Click to expand...
Click to collapse
The problem is only the distance .
When u r downloading u r not near the router sure ?
So ur phone connection will be weak and may disconnect any time if u put ur phone in ur hand .
When u do this the rage will be larger and ur problem will be solved
Read the original post .. I have written how to do that for gingerbread(gb)try it and tell me the result
shinishi said:
The problem is only the distance .
When u r downloading u r not near the router sure ?
So ur phone connection will be weak and may disconnect any time if u put ur phone in ur hand .
When u do this the rage will be larger and ur problem will be solved
Read the original post .. I have written how to do that for gingerbread(gb)try it and tell me the result
Click to expand...
Click to collapse
when im in my room, my wifi signal is weak 1 bar. and of course near the where my router located my wifi signal is full bar.
i have done an experiment, both full and weak wifi signals, my wfi still gets disconnected when downloading big files, browsing market etc.
im not sure if its router or my phone wifi problems.
i will test it soon if i have time. but i doubt it will fix my problems though. because i have tried your method it is similar as from this thread
http://forum.xda-developers.com/showthread.php?t=1568792
" 9. Enabling WiFi Dual Band and Burst Mode
As the title already, this is to increase the internet speed for WiFi on your phone.
Personally, I didn't notice any difference in battery usage.
Open Root Explorer, go to \system\etc and open file named tiwlan.ini with Text Editor.
Edit these lines:
Code:
HT_Enable=0
BurstModeEnable = 0
WiFiAdhoc = 0
to
Code:
HT_Enable=1
BurstModeEnable = 1
WiFiAdhoc = 1
and
Code:
Single_Dual_Band_Solution = 0
to
Code:
Single_Dual_Band_Solution = 1
Reboot your phone. "
after changing it not just it still doesnt fix my wifi problems, its a huge battery drainer, so had to change the numbers back to the way it was
Oic,thanks for information,and my phone WiFi doesn't disconnect often
By the way,range,not rage lol
XDA Premium sent this message from owner of Sk17i
It works perfect! i tried it and increase my range now nearly always full wi fi range inside my house before this full only in my room
Thanks hope not so much battery drain
Izzy Stinson said:
when im in my room, my wifi signal is weak 1 bar. and of course near the where my router located my wifi signal is full bar.
i have done an experiment, both full and weak wifi signals, my wfi still gets disconnected when downloading big files, browsing market etc.
im not sure if its router or my phone wifi problems.
i will test it soon if i have time. but i doubt it will fix my problems though. because i have tried your method it is similar as from this thread
http://forum.xda-developers.com/showthread.php?t=1568792
" 9. Enabling WiFi Dual Band and Burst Mode
As the title already, this is to increase the internet speed for WiFi on your phone.
Personally, I didn't notice any difference in battery usage.
Open Root Explorer, go to \system\etc and open file named tiwlan.ini with Text Editor.
Edit these lines:
Code:
HT_Enable=0
BurstModeEnable = 0
WiFiAdhoc = 0
to
Code:
HT_Enable=1
BurstModeEnable = 1
WiFiAdhoc = 1
and
Code:
Single_Dual_Band_Solution = 0
to
Code:
Single_Dual_Band_Solution = 1
Reboot your phone. "
after changing it not just it still doesnt fix my wifi problems, its a huge battery drainer, so had to change the numbers back to the way it was
Click to expand...
Click to collapse
For me i saw that battery drain is the same
That thread is for gb only and mine for both gb and ics
Try connect a laptop or another device to ur router
If the problem still .. It will be router problem
Curtis7990 said:
It works perfect! i tried it and increase my range now nearly always full wi fi range inside my house before this full only in my room
Thanks hope not so much battery drain
Click to expand...
Click to collapse
Same with me :3
XDA Premium sent this message from owner of Sk17i
Curtis7990 said:
It works perfect! i tried it and increase my range now nearly always full wi fi range inside my house before this full only in my room
Thanks hope not so much battery drain
Click to expand...
Click to collapse
Welcome i'm Realy happy to hear that .. I have noticed to more battery drain ..
shinishi said:
For me i saw that battery drain is the same
That thread is for gb only and mine for both gb and ics
Try connect a laptop or another device to ur router
If the problem still .. It will be router problem
Click to expand...
Click to collapse
no wifi problems on my laptop or any laptop. just my phone xperia mini pro sk17i had this wifi problems :S
Izzy Stinson said:
no wifi problems on my laptop or any laptop. just my phone xperia mini pro sk17i had this wifi problems :S
Click to expand...
Click to collapse
do you have custom kernel or rom?

resolve dns as root (uid 0) ?

I have nexus4 and nexus7 (both are 4.3), I noticed all apps resolve dns connection as root (uid 0).
I want to know/ask, why on android, all apps resolve dns connection as root?
I block dns connection as root, then all apps can not resolve dns.
(iptables -I OUTPUT -p udp --dport 53 -m owner --uid-owner 0 -j DROP)
I also noticed, my nexus7 will resolve dns as root, if the connection blocked, then the apps will not resolve dns.
but my nexus4 will resolve dns as root first, if it blocked, then apps will resolve dns as apps-id.
why will that?
anyone have this problem?
both n4/n7 is running stock andorid 4.3 (donwload from google)
thanks.
I can confirm that something very strange is going on in Android 4.3, I'm runing the Slimrom mod and the same thing is true for me, all dns request are done as root. But to make things even stranger the dns props are set but not used, it seems like something is really broken within bioinc that makes it impossible to change dns servers on the fly.
Mine is running android stock rom for both, downloaded from google.
I still not understand, why will that.
Thanks.
Sent from my Nexus 4 using xda app-developers app
Browsing through the AOSP sources, I noticed that Android 4.3 incorporated a somewhat confusing series of commits under the heading of "dns cache per interface," which effectively causes all Bionic DNS requests to be proxied through netd. This commit is the most important element.
Here is the old implementation from Android 4.2.2:
Code:
static struct hostent *
gethostbyname_internal(const char *name, int af, res_state res)
{
const char *cp;
char *bp, *ep;
int size;
struct hostent *hp;
struct resolv_cache* cache;
[b]res_static rs = __res_get_static();[/b]
static const ns_dtab dtab[] = {
NS_FILES_CB(_gethtbyname, NULL)
{ NSSRC_DNS, _dns_gethtbyname, NULL }, /* force -DHESIOD */
{ 0, 0, 0 }
};
assert(name != NULL);
switch (af) {
case AF_INET:
size = INADDRSZ;
break;
case AF_INET6:
size = IN6ADDRSZ;
break;
default:
h_errno = NETDB_INTERNAL;
errno = EAFNOSUPPORT;
return NULL;
}
rs->host.h_addrtype = af;
rs->host.h_length = size;
[...]
h_errno = NETDB_INTERNAL;
if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyname",
default_dns_files, name, strlen(name), af) != NS_SUCCESS) {
return NULL;
}
h_errno = NETDB_SUCCESS;
return hp;
Note the use of the libc resolver. The library is issuing the DNS requests directly.
By contrast, here is the new Android 4.3 implementation:
Code:
// very similar in proxy-ness to android_getaddrinfo_proxy
static struct hostent *
gethostbyname_internal(const char *name, int af, res_state res, const char *iface)
{
[b]const char *cache_mode = getenv("ANDROID_DNS_MODE");[/b]
FILE* proxy = NULL;
struct hostent *result = NULL;
[b]if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {[/b]
res_setiface(res, iface);
return gethostbyname_internal_real(name, af, res);
}
proxy = android_open_proxy();
if (proxy == NULL) goto exit;
/* This is writing to system/netd/DnsProxyListener.cpp and changes
* here need to be matched there */
if (fprintf(proxy, "gethostbyname %s %s %d",
iface == NULL ? "^" : iface,
name == NULL ? "^" : name,
af) < 0) {
goto exit;
}
if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
goto exit;
}
result = android_read_hostent(proxy);
So by default, Android 4.3 will proxy the requests through netd (owned by UID 0). This can be verified by setting DBG to 1 in system/netd/DnsProxyListener.cpp, then watching logcat:
Code:
D/DnsProxyListener( 146): argv[0]=getaddrinfo
D/DnsProxyListener( 146): argv[1]=omg.yahoo.com
D/DnsProxyListener( 146): argv[2]=^
D/DnsProxyListener( 146): argv[3]=1024
D/DnsProxyListener( 146): argv[4]=0
D/DnsProxyListener( 146): argv[5]=1
D/DnsProxyListener( 146): argv[6]=0
D/DnsProxyListener( 146): argv[7]=^
D/DnsProxyListener( 146): GetAddrInfoHandler for omg.yahoo.com / [nullservice] / [nulliface] / 1489
D/DnsProxyListener( 146): GetAddrInfoHandler, now for omg.yahoo.com / (null) / (null)
D/DnsProxyListener( 146): argv[0]=getaddrinfo
D/DnsProxyListener( 146): argv[1]=l1.yimg.com
D/DnsProxyListener( 146): argv[2]=^
D/DnsProxyListener( 146): argv[3]=1024
D/DnsProxyListener( 146): argv[4]=0
D/DnsProxyListener( 146): argv[5]=1
D/DnsProxyListener( 146): argv[6]=0
D/DnsProxyListener( 146): argv[7]=^
D/DnsProxyListener( 146): GetAddrInfoHandler for l1.yimg.com / [nullservice] / [nulliface] / 1489
D/DnsProxyListener( 146): GetAddrInfoHandler, now for l1.yimg.com / (null) / (null)
As seen in the Android 4.3 code snippet, it is possible to temporarily revert to the old behavior by setting ANDROID_DNS_MODE to "local", causing Bionic to send the request through gethostbyname_internal_real(), the old implementation. On this system, the shell user is blocked from sending network traffic via netfilter, but the root user (which owns netd) has full network access:
Code:
[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
[email protected]:/ $ ANDROID_DNS_MODE= telnet google.com 80
telnet: can't connect to remote host (74.125.227.135): Connection refused
1|[email protected]:/ $ ANDROID_DNS_MODE=local telnet google.com 80
telnet: bad address 'google.com'
1|[email protected]:/ $
In the former case (proxied request), the application was able to look up the hostname via netd, but could not send data traffic. In the latter case (direct request), the application was not able to look up the hostname at all.
It is possible to change the systemwide default by making a tweak to system/core/rootdir/init.rc and rebuilding your kernel image:
Code:
diff --git a/rootdir/init.rc b/rootdir/init.rc
index b6d7335..d0efc46 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -47,6 +47,7 @@ loglevel 3
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export ANDROID_STORAGE /storage
+ export ANDROID_DNS_MODE local
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar
Maybe there is a better way to patch existing ROMs in place.
So, any easyway to deny some apps, to resolve dns?
How apps connect to netd to resolve dns? Unix socket? Or inet socket?
Ok, what I want to do is, some apps connect through tor network and prevent dns leaks.
Thanks.
Sent from my Nexus 4 using xda app-developers app
Ok, I found it in android_open_proxy().
It look like use unix socket "/dev/socket/dnsproxyd".
So I can not use iptables to deny some apps connect to dnsproxy? right?
Any idea to prevent some apps/uid (but not all), connect to dnsproxy?
Thank you.
Sent from my Nexus 4 using xda app-developers app
I tried export ANDROID_DNS_MODE=local
but it make no different on my nexus 4
(my nexus 4 use android stock room 4.3, download from google)
[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
1|[email protected]:/ $ set |grep -i dns
1|[email protected]:/ $ export ANDROID_DNS_MODE=local
[email protected]:/ $ set |grep -i dns
ANDROID_DNS_MODE=local
_='ANDROID_DNS_MODE=local'
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
any idea why will that?
thank you.
johnw.xda said:
I tried export ANDROID_DNS_MODE=local
but it make no different on my nexus 4
(my nexus 4 use android stock room 4.3, download from google)
[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
1|[email protected]:/ $ set |grep -i dns
1|[email protected]:/ $ export ANDROID_DNS_MODE=local
[email protected]:/ $ set |grep -i dns
ANDROID_DNS_MODE=local
_='ANDROID_DNS_MODE=local'
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
any idea why will that?
thank you.
Click to expand...
Click to collapse
Hmm, it looks like this change removed the logic that populates the nameserver list from the system properties. So with ANDROID_DNS_MODE=local, libc will search /system/etc/hosts but it won't actually be able to contact any nameservers:
Code:
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 localhost
;; res_setoptions("debug", "env")..
;; debug
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=1.85 ms
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.852/1.852/1.852/0.000 ms
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 google.com;; res_setoptions("debug", "env")..
;; debug
;; res_nquerydomain(google.com, <Nil>, 1, 1)
;; res_query(google.com, 1, 1)
;; res_nmkquery(QUERY, google.com, IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28372
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
;; res_nquerydomain(google.com, , 1, 1)
;; res_query(google.com., 1, 1)
;; res_nmkquery(QUERY, google.com., IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41613
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
ping: unknown host google.com
[email protected] / $
There's some code in _resolv_set_nameservers_for_iface() that might help, but I don't think this gets run from ordinary command-line utilities.
Any idea to prevent some apps/uid (but not all), connect to dnsproxy?
Click to expand...
Click to collapse
You could try applying filesystem ACLs or SELinux rules to /dev/socket/dnsproxyd
Compiling setfacl with Bionic is a hassle, but you could boot e.g. a Debian ARM image in QEMU and build a binary that is statically linked with glibc. You might also need to build a kernel with CONFIG_TMPFS_POSIX_ACL=y; this setting is currently disabled on the CM10.2 grouper builds.
Other possibilities include:
Modify Bionic to reinstate the old nameserver list behavior, and modify /init.rc as above
Modify netd; you could try calling setresuid() to send out each request under the UID of the client instead of UID 0
Write a daemon that intercepts DNS requests intended for netd; this could use a modified version of the netd DnsProxy logic or it could pass the request through to the real netd
Sorry, I forgot to mention before, maybe the reason is, my busybox/telnet is compiled on debian use glibc with -static flags, so telnet/busybox does not use android's libc, and does not use dnsproxy too.
Anyway, is it possible to compile owner libc for android? Where can download android 4.3 libc source code? Do I need to setup ndk to compile it? or can I use gcc to compile it.
Did you do that before?
Thank you again.
Sent from my Nexus 4 using xda app-developers app
I'm using pppwidget to access the network and I think that is affected by this DNS issues. As specific way to get network, is not aware of all this new stuff and thus unable to resolv dns queries.
johnw.xda said:
Sorry, I forgot to mention before, maybe the reason is, my busybox/telnet is compiled on debian use glibc with -static flags, so telnet/busybox does not use android's libc, and does not use dnsproxy too.
Anyway, is it possible to compile owner libc for android? Where can download android 4.3 libc source code? Do I need to setup ndk to compile it? or can I use gcc to compile it.
Did you do that before?
Thank you again.
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
johnw.xda said:
Anyway, is it possible to compile owner libc for android? Where can download android 4.3 libc source code? Do I need to setup ndk to compile it? or can I use gcc to compile it.
Did you do that before?
Click to expand...
Click to collapse
I've been building my Android 4.3 ROMs from the CM10.2 sources.
You can try building from AOSP directly (instructions here). CM builds aren't difficult, but they did require a few extra steps.
I'm not aware of a way to build Bionic standalone. Trying the obvious stuff like running "ndk-build" in that directory, or using crosstool-ng, didn't work for me. Others can jump in if they know...
cernekee said:
Hmm, it looks like this change removed the logic that populates the nameserver list from the system properties. So with ANDROID_DNS_MODE=local, libc will search /system/etc/hosts but it won't actually be able to contact any nameservers:
Code:
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 localhost
;; res_setoptions("debug", "env")..
;; debug
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=1.85 ms
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.852/1.852/1.852/0.000 ms
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 google.com;; res_setoptions("debug", "env")..
;; debug
;; res_nquerydomain(google.com, <Nil>, 1, 1)
;; res_query(google.com, 1, 1)
;; res_nmkquery(QUERY, google.com, IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28372
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
;; res_nquerydomain(google.com, , 1, 1)
;; res_query(google.com., 1, 1)
;; res_nmkquery(QUERY, google.com., IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41613
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
ping: unknown host google.com
[email protected] / $
There's some code in _resolv_set_nameservers_for_iface() that might help, but I don't think this gets run from ordinary command-line utilities.
You could try applying filesystem ACLs or SELinux rules to /dev/socket/dnsproxyd
Compiling setfacl with Bionic is a hassle, but you could boot e.g. a Debian ARM image in QEMU and build a binary that is statically linked with glibc. You might also need to build a kernel with CONFIG_TMPFS_POSIX_ACL=y; this setting is currently disabled on the CM10.2 grouper builds.
Other possibilities include:
Modify Bionic to reinstate the old nameserver list behavior, and modify /init.rc as above
Modify netd; you could try calling setresuid() to send out each request under the UID of the client instead of UID 0
Write a daemon that intercepts DNS requests intended for netd; this could use a modified version of the netd DnsProxy logic or it could pass the request through to the real netd
Click to expand...
Click to collapse
Hi,
Thanks for this analysis.
It certainly does look like 4.3 is ignoring net.dns1 value as the nameserver.
I'm running my custom dns server inside Android and now I suddenly find that it's not being queried.
I may have a small step towards solving this problem.
iptables -t nat -I OUTPUT -p udp -d 192.168.1.1 --dport 53 -j DNAT --to-destination 192.168.1.5:53
iptables -t nat -I OUTPUT -p tcp -d 192.168.1.1 --dport 53 -j DNAT --to-destination 192.168.1.5:53
This works by intercepting the DNS requests meant for the remote nameserver and redirecting it to the local DNS server.
Hope this helps someone figure it out.
There may be a way to programmatically change the active interface DNS server?
Or a way to perhaps disable the DNS proxy completely (ANDROID_DNS_MODE=local doesn't work any more as mentioned)?
cernekee said:
Write a daemon that intercepts DNS requests intended for netd; this could use a modified version of the netd DnsProxy logic or it could pass the request through to the real netd
Click to expand...
Click to collapse
This is what I wound up doing: I copied the DnsProxyListener and Bionic resolver code into an experimental new program called "dnsproxy2", and then tweaked the logic a little bit. Sources are posted here and I'm attaching binaries to this message.
Currently it allows you to pass in a single DNS server address which will unconditionally override the OS-provided DNS servers, and when it proxies requests on behalf of an application it will change the thread's UID (Linux fsuid) to match the caller so that the traditional netfilter app/UID restrictions will be honored.
To see it in action, just do:
Code:
adb push libs/armeabi-v7a/dnsproxy2 /data/local/tmp
adb shell "su -c '/data/local/tmp/dnsproxy2 -v 8.8.8.8'"
The "-v" flag will show the DNS requests on the console.
This was tested with CM10.2. Note that Firefox appears to bypass the DNS proxy.
If this proves useful it may be worth writing a GUI installer/settings app. Another possible improvement would be to allow selectively overriding the DNS server based on the active connection.
cernekee said:
This is what I wound up doing: I copied the DnsProxyListener and Bionic resolver code into an experimental new program called "dnsproxy2", and then tweaked the logic a little bit. Sources are posted here and I'm attaching binaries to this message.
Currently it allows you to pass in a single DNS server address which will unconditionally override the OS-provided DNS servers, and when it proxies requests on behalf of an application it will change the thread's UID (Linux fsuid) to match the caller so that the traditional netfilter app/UID restrictions will be honored.
To see it in action, just do:
Code:
adb push libs/armeabi-v7a/dnsproxy2 /data/local/tmp
adb shell "su -c '/data/local/tmp/dnsproxy2 -v 8.8.8.8'"
The "-v" flag will show the DNS requests on the console.
This was tested with CM10.2. Note that Firefox appears to bypass the DNS proxy.
If this proves useful it may be worth writing a GUI installer/settings app. Another possible improvement would be to allow selectively overriding the DNS server based on the active connection.
Click to expand...
Click to collapse
Is this method still going strong? At this moment there is no app on the market that can change DNS (mobile data access).
hardKNOXbz said:
Is this method still going strong? At this moment there is no app on the market that can change DNS (mobile data access).
Click to expand...
Click to collapse
I'd suggest reading the last few pages of the CrossBreeder thread. I don't think dnsproxy2 is in the official release yet but a number of people have been experimenting with it and posting their results.
cernekee said:
I'd suggest reading the last few pages of the CrossBreeder thread. I don't think dnsproxy2 is in the official release yet but a number of people have been experimenting with it and posting their results.
Click to expand...
Click to collapse
Thank you, I'll do that.
I have created a bug for AOSP regarding broken ANDROID_DNS_MODE=local behavior:
https://code.google.com/p/android/issues/detail?id=75232
Plz try this to connect throo vpn.
This is not my work i just take it from cm11 and put it to stock rom and it work.
sshtunnel_support.zip
https://docs.google.com/file/d/0BzL6ekv_OuX2cE9uY3pfYzNmdWs/edit?usp=docslist_api

How can i unpack/repack this system_1.img+system_2.img+...+system_8.img

I want to modify the Saihon X6 ROM, but the system.img is different from I've ever met, they put the system.img into 8 img, now do not know how to unpack/repack, I need help, need a detailed tutorial. Thank you
ht tp://pan.baidu.com/s/1pJAvLer
I tried this,and it not working
Run sudo mount -o loop system_1.img system
displays
Mount: wrong fs type, bad option, bad superblock on / dev/loop0,
Missing codepage or helper program, or Other Error
system log may have some important information,
try using dmesg | tail like a command.
Run dmesg | tail view LOG
display
[74.005499] audit_printk_skb: 18 callbacks suppressed
[74.005518] type = 1400 Audit (1360118240.727:23): AppArmor = "DENIED" operation = "capable" parent = 1 Profile = "/ usr / lib / Telepathy / mission-control-5 "pid = 1553 COMM =" mission-control "Capability = 23 capname =" sys_nice "
[74.415356] type = 1400 Audit (1360118241.135:24): AppArmor = "DENIED" operation = "Open" parent = 1 profile = "/ usr/lib/telepathy/mission-control-5" name = "/ usr / share / gvfs / remote-volume-monitors /" pid = 1553 comm = "mission-control" requested_mask = "r" denied_mask = "r" fsuid = 0 ouid = 0
[365.116251] EXT4-fs (loop0): bad geometry: Block count 97 656 Exceeds Size of device (32767 Blocks)
[579.113993] hrtimer: interrupt took 5,682,946 ns
[630.545278] EXT4-fs ( loop0): bad geometry: Block count ninety-seven thousand six hundred and fifty-six Exceeds Size of device (32767 Blocks)
[644.026965] EXT4-fs (loop0): Unrecognized Mount option "loop1" or Missing value
[670.312507] EXT4-fs (loop0): bad geometry: Block count ninety-seven thousand six hundred fifty-six Exceeds Size of device (32767 Blocks)
[788.599457] EXT4-fs (loop0): bad geometry: 76800 Block count Exceeds Size of device (1657 Blocks)
[1008.514549] EXT4-fs (loop0): bad geometry: Block count 97,656 exceeds size of device (32767 blocks)
file system_1.img
results
system_1.img: Linux rev 1.0 ext4 filesystem data, UUID = 57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)
https://forum.xda-developers.com/an...ide-how-to-unpack-repack-system1-img-t3567741

How can i unpack/repack this system_1.img+system_2.img+...+system_8.img

I want to modify the Saihon X6 ROM, but the system.img is different from I've ever met, they put the system.img into 8 img, now do not know how to unpack/repack, I need help, need a detailed tutorial. Thank you
ht tp://pan.baidu.com/s/1pJAvLer
I tried this,and it not working
Run sudo mount -o loop system_1.img system
displays
Mount: wrong fs type, bad option, bad superblock on / dev/loop0,
Missing codepage or helper program, or Other Error
system log may have some important information,
try using dmesg | tail like a command.
Run dmesg | tail view LOG
display
[74.005499] audit_printk_skb: 18 callbacks suppressed
[74.005518] type = 1400 Audit (1360118240.727:23): AppArmor = "DENIED" operation = "capable" parent = 1 Profile = "/ usr / lib / Telepathy / mission-control-5 "pid = 1553 COMM =" mission-control "Capability = 23 capname =" sys_nice "
[74.415356] type = 1400 Audit (1360118241.135:24): AppArmor = "DENIED" operation = "Open" parent = 1 profile = "/ usr/lib/telepathy/mission-control-5" name = "/ usr / share / gvfs / remote-volume-monitors /" pid = 1553 comm = "mission-control" requested_mask = "r" denied_mask = "r" fsuid = 0 ouid = 0
[365.116251] EXT4-fs (loop0): bad geometry: Block count 97 656 Exceeds Size of device (32767 Blocks)
[579.113993] hrtimer: interrupt took 5,682,946 ns
[630.545278] EXT4-fs ( loop0): bad geometry: Block count ninety-seven thousand six hundred and fifty-six Exceeds Size of device (32767 Blocks)
[644.026965] EXT4-fs (loop0): Unrecognized Mount option "loop1" or Missing value
[670.312507] EXT4-fs (loop0): bad geometry: Block count ninety-seven thousand six hundred fifty-six Exceeds Size of device (32767 Blocks)
[788.599457] EXT4-fs (loop0): bad geometry: 76800 Block count Exceeds Size of device (1657 Blocks)
[1008.514549] EXT4-fs (loop0): bad geometry: Block count 97,656 exceeds size of device (32767 blocks)
file system_1.img
results
system_1.img: Linux rev 1.0 ext4 filesystem data, UUID = 57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)

It's that time again when somebody on x86 can't get sound

In my case, x86 Oreo rc1 on a Thomson THBK1.10 64DHKP, a cute old thing I experimented my very first dual-boot on. Like many, I'm not getting any sound, and that's after trying a whole bunch of fixes. Here's a sample of what the terminal has to say:
x86_64:/ $ alsa_ctl init
alsa_ctl: init:1744: No soundcards found...
19|x86_64:/ $ alsa_aplay -l
aplay: device_list:242: no soundcards found...
x86_64:/ $ cat proc/asound/cards
0 [bytcrrt5640 ]: bytcr-rt5640 - bytcr-rt5640
bytcr-rt5640
1 [IntelHdmiLpeAud]: IntelHdmiLpeAudiIntelHdmiLpeAudio - IntelHdmiLpeAudio
x86_64:/ $ su
x86_64:/ # alsa_aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: bytcrrt5640 [bytcr-rt5640], device 0: Baytrail Audio (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: bytcrrt5640 [bytcr-rt5640], device 1: Deep-Buffer Audio (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: IntelHdmiLpeAud [IntelHdmiLpeAudio], device 0: IntelHdmiLpeAudio [IntelHdmiLpeAudio]
Subdevices: 1/1
Subdevice #0: subdevice #0
x86_64:/ # alsa_ctl init
Found hardware: "bytcr-rt5640" "" "" "" ""
Hardware is initialized using a generic method
99|x86_64:/ # alsa_aplay sauce.wav
sauce.wav: No such file or directory
1|x86_64:/ # alsa_aplay storage/emulated/0/download/ce.mp3
Playing raw data 'storage/emulated/0/download/ce.mp3' : Unsigned 8 bit, Rate 8000 Hz, Mono
aplay: set_params:1125: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: U8
SUBFORMAT: STD
SAMPLE_BITS: 8
FRAME_BITS: 8
CHANNELS: 1
RATE: 8000
PERIOD_TIME: 125000
PERIOD_SIZE: 1000
PERIOD_BYTES: 1000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 4000
BUFFER_BYTES: 4000
TICK_TIME: 0
1|x86_64:/ #
What's strange is that my hardware does seem to be detected, but only by apps with SU privileges; trying anything alsa-related nets me no cards until I switch the terminal to SU. Yet cat and ls do detect properly. Like I said, every one of the online fixes I tried netted me nothing, and actually demanding a sound be manually played throws another error, to the point I'm not even sure Oreo is even supposed to have functional sound. What keeps me sticking to it is that the issue shows up in earlier versions, so I half-wishfully assumed the issue might be elsewhere.
Somebody help this idiot.

Categories

Resources