Opened 7 years ago

Last modified 22 months ago

#9657 reopened defect

Kernel timezone is unaffected by UCI /etc/system timezone option

Reported by: anonymous Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:


OpenWrt kernel: xt_time: kernel timezone is -0000

Openwrt kernel timezone is left to UTC despite UCI /etc/system timezone option

This affects iptables time matches thus requiring time argument specified in UTC

#Epoch 'now' and '1 minute next'
ENOW=$(date +%s)
ELATER=$(($ENOW + 60))

#Epoch to UTC conversion
NOW=$(date -d @$ENOW -u +%H:%M)
LATER=$(date -d @$ELATER -u +%H:%M)

#Block for the next minute
echo Block Start $NOW Block end $LATER

iptables -A input_rule -p all -m time --timestart $NOW --timestop  $LATER  -j LOG --log-level 6 --log-prefix " Test time range "

I don't really know if existing openwrt components will break if kernel timezone is not UTC but Gargoyle (openwrt based distribution ) provides a package to fix kernel time set-kernel-timezone package

Attachments (0)

Change History (11)

comment:1 Changed 7 years ago by adam900710@…

Confirmed the bug in OpenWRT trunk ,verion r27340
after reboot:

root@OpenWrt:~# cat /etc/config/system 
config system
        option hostname OpenWrt
        option timezone 'CST-8'

config rdate
        option interface        wan

root@OpenWrt:~# logread | grep xt_time
Jan  1 08:00:17 OpenWrt kernel: xt_time: kernel timezone is -0000

comment:2 Changed 6 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with r29203, r29204. Note that it will still display "-0000" on boot because the kernel tz is adjusted only after the modules are loaded (yet) but if you do "rmmod xt_time; insmod xt_time" you'll see it printing the updated time in dmesg.

comment:3 Changed 4 years ago by anonymous

This is back?

comment:4 Changed 4 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 4 years ago by anonymous

Same behaviour in trunk r41051: iptables-mod-ipopt uses UTC instead of local time.

comment:6 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

comment:7 Changed 3 years ago by rseiler

Is it a bug or a feature? If it's a bug, why is there a switch (one that's not recommended, incidentally) in order to use local time instead of UTC?

comment:8 Changed 2 years ago by anonymous

Any update on this one ? Still in r47532.

comment:9 Changed 2 years ago by…

Still in r47745

comment:10 Changed 22 months ago by th0ma7

This may well be my issue using:

CHAOS CALMER (15.05.1, r48532)

comment:11 Changed 22 months ago by anonymous

On CC 15.05.1...

Since daylight saving just started I modified my rules in firewall.user to use --kerneltz. Status->Firewall... indicated that the rules weren't matching at all.

I found that executing a 'date -k' to get BusyBox to set the kernel TZ made them work again.

That saome command appears in /etc/init.d/system, but presumably is either failing or its effects are being undone by something else afterwards.

Add Comment

Modify Ticket

as reopened .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.