9228 zone_getattr(ZONE_ATTR_NETWORK) returns uninitialised value

Review Request #930 — Created March 4, 2018 and submitted

citrus
illumos-gate
master
9228, 9230
85362d4...
general
9228 zone_getattr(ZONE_ATTR_NETWORK) returns uninitialised value

I came across this while troubleshooting the allowed-address zone network attribute.
Using a freshly installed exclusive-ip zone with an allowed-address:

bloody# zonecfg -z sparse info net
net:
        address not specified
        allowed-address: 172.16.1.1/24
        defrouter: 172.16.1.254
        physical: sparse0

Before this patch:

During first zone boot, dtrace shows:

  7  24847              zone_getattr:return Returning -72887665

and once all services are started, there is no interface in the zone:

root@sparse:~# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 ---

It can be created but attempting to bring it online results in an error:

oot@sparse:~# ipadm create-if sparse0
root@sparse:~# ipadm disable-if -t sparse0
root@sparse:~# ipadm enable-if -t sparse0
ipadm: Could not enable sparse0 : Invalid argument provided
root@sparse:~# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 ---
sparse0    down     bm-------Z46 -46

and, again, dtrace shows the kernel function returning a negative number.

After patch:

Immediately following zone install, zone boot:

root@sparse:~# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 ---
sparse0    ok       bm-------Z4- -4-
root@sparse:~# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
sparse0/_a        from-gz  ok           172.16.1.1/24
lo0/v6            static   ok           ::1/128
seeemef@mac.com
  1. LGTM

  2. 
      
jlevon
  1. Ship It!
  2. 
      
citrus
tsoome
  1. Ship It!
  2. 
      
citrus
seeemef@mac.com
  1. Ship It!
  2. 
      
jlevon
  1. Ship It!
  2. 
      
tsoome
  1. Ship It!
  2. 
      
yuripv
  1. 
      
  2. usr/src/uts/common/os/zone.c (Diff revision 3)
     
     

    Wonder if the following would look cleaner: bufsize = MIN(bufsize, PIPE_BUF + sizeof (zone_net_data_t));

  3. 
      
citrus
yuripv
  1. Ship It!
  2. 
      
jlevon
  1. Ship It!
  2. 
      
hadfl
  1. Ship It!
  2. 
      
tsoome
  1. Ship It!
  2. 
      
citrus
Review request changed

Status: Closed (submitted)

Loading...