Browse code

Adding dhclient support in NetworkManager

dthaluru authored on 2015/07/24 03:03:37
Showing 5 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	NetworkManager
2 2
 Name:		NetworkManager
3 3
 Version:	1.0.2
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	LGPLv2+
6 6
 URL:		https://download.gnome.org/sources/NetworkManager/1.0/NetworkManager-1.0.2.tar.xz
7 7
 Source0:	https://download.gnome.org/sources/NetworkManager/1.0/%{name}-%{version}.tar.xz
... ...
@@ -20,6 +20,8 @@ BuildRequires:	nss-devel
20 20
 BuildRequires:	libndp-devel
21 21
 BuildRequires:	python2
22 22
 BuildRequires:	python2-libs
23
+BuildRequires:	dhcp-client
24
+BuildRequires:	libsoup-devel
23 25
 
24 26
 %package devel
25 27
 Summary:	Libraries and header files for NetworkManager
... ...
@@ -38,14 +40,18 @@ NetworkManager is a set of co-operative tools that make networking simple and st
38 38
 	--prefix=%{_prefix} \
39 39
 	--disable-ppp \
40 40
 	--disable-gtk-doc \
41
-	--sysconfdir=%{_sysconfdir}
41
+	--sysconfdir=%{_sysconfdir} \
42
+        --with-dhclient=yes \
43
+	--enable-ifcfg-rh=yes \
44
+	--with-setting-plugins-default='ifcfg-rh,ibft'
45
+
42 46
  
43 47
 make %{?_smp_mflags}
44 48
 %install
45 49
 make DESTDIR=%{buildroot} install
46 50
 cat >> %{buildroot}/etc/NetworkManager/NetworkManager.conf << "EOF"
47 51
 [main]
48
-plugins=keyfile
52
+plugins=ifcfg-rh,ibft
49 53
 EOF
50 54
 
51 55
 %post	-p /sbin/ldconfig
... ...
@@ -79,5 +85,7 @@ EOF
79 79
 %{_libdir}/*.so
80 80
 %{_libdir}/pkgconfig/*.pc
81 81
 %changelog
82
+*	Thu Jul 23 2015 Divya Thaluru <dthaluru@vmware.com> 1.0.2-2
83
+-	Building with dhclient.
82 84
 *	Tue Jun 23 2015 Divya Thaluru <dthaluru@vmware.com> 1.0.2-1
83 85
 -	Initial build.
84 86
new file mode 100644
... ...
@@ -0,0 +1,645 @@
0
+Submitted By:            Armin K. <krejzi at email dot com>
1
+Date:                    2012-08-14
2
+Initial Package Version: 4.2.4-P1
3
+Upstream Status:         Rejected by upstream.
4
+Origin:                  Based on Debian's dhclient-script, but modified for BLFS
5
+Description:             This patch replaces original linux script for dhcp client with
6
+                         better one which is based on Debian's dhclient-script, but modified
7
+                         to be used on LFS/BLFS. It also removes net-tools dependency.
8
+
9
+--- a/client/scripts/linux	2014-07-09 20:26:40.000000000 +0200
10
+@@ -1,316 +1,346 @@
11
+ #!/bin/bash
12
++
13
+ # dhclient-script for Linux. Dan Halbert, March, 1997.
14
+ # Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
15
+-# No guarantees about this. I'm a novice at the details of Linux
16
+-# networking.
17
+-
18
+-# Notes:
19
+-
20
+-# 0. This script is based on the netbsd script supplied with dhcp-970306.
21
+-
22
+-# 1. ifconfig down apparently deletes all relevant routes and flushes
23
+-# the arp cache, so this doesn't need to be done explicitly.
24
+-
25
+-# 2. The alias address handling here has not been tested AT ALL.
26
+-# I'm just going by the doc of modern Linux ip aliasing, which uses
27
+-# notations like eth0:0, eth0:1, for each alias.
28
++# Modified for Debian.  Matt Zimmerman and Eloy Paris, December 2003
29
++# Modified to remove useless tests for antiquated kernel versions that
30
++# this doesn't even work with anyway, and introduces a dependency on /usr
31
++# being mounted, which causes cosmetic errors on hosts that NFS mount /usr
32
++# Andrew Pollock, February 2005
33
++# Modified to work on point-to-point links. Andrew Pollock, June 2005
34
++# Modified to support passing the parameters called with to the hooks. Andrew Pollock, November 2005
35
++# Modified to use the script with Linux From Scratch by Armin K., May 2012
36
+ 
37
+-# 3. I have to calculate the network address, and calculate the broadcast
38
+-# address if it is not supplied. This might be much more easily done
39
+-# by the dhclient C code, and passed on.
40
+-
41
+-# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
42
+-# of the $1 in its args.
43
+-
44
+-# 'ip' just looks too weird.  /sbin/ip looks less weird.
45
+-ip=/sbin/ip
46
++# The alias handling in here probably still sucks. -mdz
47
+ 
48
++# update /etc/resolv.conf based on received values
49
+ make_resolv_conf() {
50
+-  if [ x"$new_domain_name_servers" != x ]; then
51
+-    cat /dev/null > /etc/resolv.conf.dhclient
52
+-    chmod 644 /etc/resolv.conf.dhclient
53
+-    if [ x"$new_domain_search" != x ]; then
54
+-      echo search $new_domain_search >> /etc/resolv.conf.dhclient
55
+-    elif [ x"$new_domain_name" != x ]; then
56
+-      # Note that the DHCP 'Domain Name Option' is really just a domain
57
+-      # name, and that this practice of using the domain name option as
58
+-      # a search path is both nonstandard and deprecated.
59
+-      echo search $new_domain_name >> /etc/resolv.conf.dhclient
60
+-    fi
61
+-    for nameserver in $new_domain_name_servers; do
62
+-      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
63
+-    done
64
+-
65
+-    mv /etc/resolv.conf.dhclient /etc/resolv.conf
66
+-  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
67
+-    cat /dev/null > /etc/resolv.conf.dhclient6
68
+-    chmod 644 /etc/resolv.conf.dhclient6
69
++    local new_resolv_conf
70
+ 
71
+-    if [ "x${new_dhcp6_domain_search}" != x ] ; then
72
+-      echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
73
++    # DHCPv4
74
++    if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
75
++       [ -n "$new_domain_name_servers" ]; then
76
++        new_resolv_conf=/etc/resolv.conf.dhclient-new
77
++        rm -f $new_resolv_conf
78
++
79
++        if [ -n "$new_domain_name" ]; then
80
++            echo domain ${new_domain_name%% *} >>$new_resolv_conf
81
++        fi
82
++
83
++        if [ -n "$new_domain_search" ]; then
84
++            if [ -n "$new_domain_name" ]; then
85
++                domain_in_search_list=""
86
++                for domain in $new_domain_search; do
87
++                    if [ "$domain" = "${new_domain_name}" ] ||
88
++                       [ "$domain" = "${new_domain_name}." ]; then
89
++                        domain_in_search_list="Yes"
90
++                    fi
91
++                done
92
++                if [ -z "$domain_in_search_list" ]; then
93
++                    new_domain_search="$new_domain_name $new_domain_search"
94
++                fi
95
++            fi
96
++            echo "search ${new_domain_search}" >> $new_resolv_conf
97
++        elif [ -n "$new_domain_name" ]; then
98
++            echo "search ${new_domain_name}" >> $new_resolv_conf
99
++        fi
100
++
101
++        if [ -n "$new_domain_name_servers" ]; then
102
++            for nameserver in $new_domain_name_servers; do
103
++                echo nameserver $nameserver >>$new_resolv_conf
104
++            done
105
++        else # keep 'old' nameservers
106
++            sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
107
++        fi
108
++
109
++        chown --reference=/etc/resolv.conf $new_resolv_conf
110
++        chmod --reference=/etc/resolv.conf $new_resolv_conf
111
++        mv -f $new_resolv_conf /etc/resolv.conf
112
++    # DHCPv6
113
++    elif [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
114
++        new_resolv_conf=/etc/resolv.conf.dhclient-new
115
++        rm -f $new_resolv_conf
116
++
117
++        if [ -n "$new_dhcp6_domain_search" ]; then
118
++            echo "search ${new_dhcp6_domain_search}" >> $new_resolv_conf
119
++        fi
120
++
121
++        if [ -n "$new_dhcp6_name_servers" ]; then
122
++            for nameserver in $new_dhcp6_name_servers; do
123
++                # append %interface to link-local-address nameservers
124
++                if [ "${nameserver##fe80::}" != "$nameserver" ] ||
125
++                   [ "${nameserver##FE80::}" != "$nameserver" ]; then
126
++                    nameserver="${nameserver}%${interface}"
127
++                fi
128
++                echo nameserver $nameserver >>$new_resolv_conf
129
++            done
130
++        else # keep 'old' nameservers
131
++            sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
132
++        fi
133
++
134
++        chown --reference=/etc/resolv.conf $new_resolv_conf
135
++        chmod --reference=/etc/resolv.conf $new_resolv_conf
136
++        mv -f $new_resolv_conf /etc/resolv.conf
137
+     fi
138
+-    shopt -s nocasematch 
139
+-    for nameserver in ${new_dhcp6_name_servers} ; do
140
+-      # If the nameserver has a link-local address
141
+-      # add a <zone_id> (interface name) to it.
142
+-      if  [[ "$nameserver" =~ ^fe80:: ]]
143
+-      then
144
+-	zone_id="%$interface"
145
+-      else
146
+-	zone_id=
147
+-      fi
148
+-      echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
149
+-    done
150
+-    shopt -u nocasematch 
151
++}
152
+ 
153
+-    mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
154
+-  fi
155
++# set host name
156
++set_hostname() {
157
++    local current_hostname
158
++
159
++    if [ -n "$new_host_name" ]; then
160
++        current_hostname=$(hostname)
161
++
162
++        # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP
163
++        if [ -z "$current_hostname" ] ||
164
++           [ "$current_hostname" = '(none)' ] ||
165
++           [ "$current_hostname" = 'localhost' ] ||
166
++           [ "$current_hostname" = "$old_host_name" ]; then
167
++           if [ "$new_host_name" != "$old_host_name" ]; then
168
++               hostname "$new_host_name"
169
++           fi
170
++        fi
171
++    fi
172
+ }
173
+ 
174
+-# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
175
++# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
176
+ exit_with_hooks() {
177
+   exit_status=$1
178
+-  if [ -f /etc/dhclient-exit-hooks ]; then
179
+-    . /etc/dhclient-exit-hooks
180
++  if [ -f /etc/dhcp/dhclient-exit-hooks ]; then
181
++    . /etc/dhcp/dhclient-exit-hooks
182
+   fi
183
+-# probably should do something with exit status of the local script
184
+   exit $exit_status
185
+ }
186
+ 
187
++# The 576 MTU is only used for X.25 and dialup connections
188
++# where the admin wants low latency.  Such a low MTU can cause
189
++# problems with UDP traffic, among other things.  As such,
190
++# disallow MTUs from 576 and below by default, so that broken
191
++# MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
192
++if [ -z "$new_interface_mtu" ] || [ "$new_interface_mtu" -le 576 ]; then
193
++    new_interface_mtu=''
194
++fi
195
++
196
++# The action starts here
197
++
198
+ # Invoke the local dhcp client enter hooks, if they exist.
199
+-if [ -f /etc/dhclient-enter-hooks ]; then
200
++if [ -f /etc/dhcp/dhclient-enter-hooks ]; then
201
+   exit_status=0
202
+-  . /etc/dhclient-enter-hooks
203
+-  # allow the local script to abort processing of this state
204
+-  # local script must set exit_status variable to nonzero.
205
++  . /etc/dhcp/dhclient-enter-hooks
206
+   if [ $exit_status -ne 0 ]; then
207
+     exit $exit_status
208
+   fi
209
+ fi
210
+ 
211
+-###
212
+-### DHCPv4 Handlers
213
+-###
214
+-
215
+-if [ x$new_broadcast_address != x ]; then
216
+-  new_broadcast_arg="broadcast $new_broadcast_address"
217
+-fi
218
+-if [ x$old_broadcast_address != x ]; then
219
+-  old_broadcast_arg="broadcast $old_broadcast_address"
220
+-fi
221
+-if [ x$new_subnet_mask != x ]; then
222
+-  new_subnet_arg="netmask $new_subnet_mask"
223
+-fi
224
+-if [ x$old_subnet_mask != x ]; then
225
+-  old_subnet_arg="netmask $old_subnet_mask"
226
+-fi
227
+-if [ x$alias_subnet_mask != x ]; then
228
+-  alias_subnet_arg="netmask $alias_subnet_mask"
229
+-fi
230
+-if [ x$new_interface_mtu != x ]; then
231
+-  mtu_arg="mtu $new_interface_mtu"
232
+-fi
233
+-if [ x$IF_METRIC != x ]; then
234
+-  metric_arg="metric $IF_METRIC"
235
+-fi
236
+-
237
+-if [ x$reason = xMEDIUM ]; then
238
+-  # Linux doesn't do mediums (ok, ok, media).
239
+-  exit_with_hooks 0
240
+-fi
241
+-
242
+-if [ x$reason = xPREINIT ]; then
243
+-  if [ x$alias_ip_address != x ]; then
244
+-    # Bring down alias interface. Its routes will disappear too.
245
+-    ifconfig $interface:0- inet 0
246
+-  fi
247
+-  ifconfig $interface 0 up
248
+-
249
+-  # We need to give the kernel some time to get the interface up.
250
+-  sleep 1
251
+-
252
+-  exit_with_hooks 0
253
+-fi
254
+-
255
+-if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
256
+-  exit_with_hooks 0
257
+-fi
258
+-  
259
+-if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
260
+-   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
261
+-  current_hostname=`hostname`
262
+-  if [ x$current_hostname = x ] || \
263
+-     [ x$current_hostname = "x(none)" ] || \
264
+-     [ x$current_hostname = xlocalhost ] || \
265
+-     [ x$current_hostname = x$old_host_name ]; then
266
+-    if [ x$new_host_name != x$old_host_name ]; then
267
+-      hostname "$new_host_name"
268
+-    fi
269
+-  fi
270
+-    
271
+-  if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
272
+-		[ x$alias_ip_address != x$old_ip_address ]; then
273
+-    # Possible new alias. Remove old alias.
274
+-    ifconfig $interface:0- inet 0
275
+-  fi
276
+-  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
277
+-    # IP address changed. Bringing down the interface will delete all routes,
278
+-    # and clear the ARP cache.
279
+-    ifconfig $interface inet 0 down
280
+-
281
+-  fi
282
+-  if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
283
+-     [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
284
+-
285
+-    ifconfig $interface inet $new_ip_address $new_subnet_arg \
286
+-					$new_broadcast_arg $mtu_arg
287
+-    # Add a network route to the computed network address.
288
+-    for router in $new_routers; do
289
+-      if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
290
+-	route add -host $router dev $interface
291
+-      fi
292
+-      route add default gw $router $metric_arg dev $interface
293
+-    done
294
+-  else
295
+-    # we haven't changed the address, have we changed other options           
296
+-    # that we wish to update?
297
+-    if [ x$new_routers != x ] && [ x$new_routers != x$old_routers ] ; then
298
+-      # if we've changed routers delete the old and add the new.
299
+-      for router in $old_routers; do
300
+-        route del default gw $router
301
+-      done
302
+-      for router in $new_routers; do
303
+-        if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
304
+-	  route add -host $router dev $interface
305
+-	fi
306
+-	route add default gw $router $metric_arg dev $interface
307
+-      done
308
+-    fi
309
+-  fi
310
+-  if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
311
+-   then
312
+-    ifconfig $interface:0- inet 0
313
+-    ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
314
+-    route add -host $alias_ip_address $interface:0
315
+-  fi
316
+-  make_resolv_conf
317
+-  exit_with_hooks 0
318
+-fi
319
+-
320
+-if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
321
+-   || [ x$reason = xSTOP ]; then
322
+-  if [ x$alias_ip_address != x ]; then
323
+-    # Turn off alias interface.
324
+-    ifconfig $interface:0- inet 0
325
+-  fi
326
+-  if [ x$old_ip_address != x ]; then
327
+-    # Shut down interface, which will delete routes and clear arp cache.
328
+-    ifconfig $interface inet 0 down
329
+-  fi
330
+-  if [ x$alias_ip_address != x ]; then
331
+-    ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
332
+-    route add -host $alias_ip_address $interface:0
333
+-  fi
334
+-  exit_with_hooks 0
335
+-fi
336
+-
337
+-if [ x$reason = xTIMEOUT ]; then
338
+-  if [ x$alias_ip_address != x ]; then
339
+-    ifconfig $interface:0- inet 0
340
+-  fi
341
+-  ifconfig $interface inet $new_ip_address $new_subnet_arg \
342
+-					$new_broadcast_arg $mtu_arg
343
+-  set $new_routers
344
+-  if ping -q -c 1 $1; then
345
+-    if [ x$new_ip_address != x$alias_ip_address ] && \
346
+-			[ x$alias_ip_address != x ]; then
347
+-      ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
348
+-      route add -host $alias_ip_address dev $interface:0
349
+-    fi
350
+-    for router in $new_routers; do
351
+-      if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
352
+-	route add -host $router dev $interface
353
+-      fi
354
+-      route add default gw $router $metric_arg dev $interface
355
+-    done
356
+-    make_resolv_conf
357
+-    exit_with_hooks 0
358
+-  fi
359
+-  ifconfig $interface inet 0 down
360
+-  exit_with_hooks 1
361
+-fi
362
+-
363
+-###
364
+-### DHCPv6 Handlers
365
+-###
366
+-
367
+-if [ x$reason = xPREINIT6 ] ; then
368
+-  # Ensure interface is up.
369
+-  ${ip} link set ${interface} up
370
+-
371
+-  # Remove any stale addresses from aborted clients.
372
+-  ${ip} -f inet6 addr flush dev ${interface} scope global permanent
373
+-
374
+-  exit_with_hooks 0
375
+-fi
376
+-
377
+-if [ x${old_ip6_prefix} != x ] || [ x${new_ip6_prefix} != x ] ; then
378
+-    echo Prefix ${reason} old=${old_ip6_prefix} new=${new_ip6_prefix}
379
++# Execute the operation
380
++case "$reason" in
381
+ 
382
+-    exit_with_hooks 0
383
+-fi
384
+-
385
+-if [ x$reason = xBOUND6 ] ; then
386
+-  if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
387
+-    exit_with_hooks 2;
388
+-  fi
389
++    ### DHCPv4 Handlers
390
+ 
391
+-  ${ip} -f inet6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
392
+-	dev ${interface} scope global
393
++    MEDIUM|ARPCHECK|ARPSEND)
394
++        # Do nothing
395
++        ;;
396
++    PREINIT)
397
++        # The DHCP client is requesting that an interface be
398
++        # configured as required in order to send packets prior to
399
++        # receiving an actual address. - dhclient-script(8)
400
++
401
++        # ensure interface is up
402
++        ip link set dev ${interface} up
403
++
404
++        if [ -n "$alias_ip_address" ]; then
405
++            # flush alias IP from interface
406
++            ip -4 addr flush dev ${interface} label ${interface}:0
407
++        fi
408
++
409
++        ;;
410
++
411
++    BOUND|RENEW|REBIND|REBOOT)
412
++        set_hostname
413
++
414
++        if [ -n "$old_ip_address" ] && [ -n "$alias_ip_address" ] &&
415
++           [ "$alias_ip_address" != "$old_ip_address" ]; then
416
++            # alias IP may have changed => flush it
417
++            ip -4 addr flush dev ${interface} label ${interface}:0
418
++        fi
419
++
420
++        if [ -n "$old_ip_address" ] &&
421
++           [ "$old_ip_address" != "$new_ip_address" ]; then
422
++            # leased IP has changed => flush it
423
++            ip -4 addr flush dev ${interface} label ${interface}
424
++        fi
425
++
426
++        if [ -z "$old_ip_address" ] ||
427
++           [ "$old_ip_address" != "$new_ip_address" ] ||
428
++           [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
429
++            # new IP has been leased or leased IP changed => set it
430
++            ip -4 addr add ${new_ip_address}${new_subnet_mask:+/$new_subnet_mask} \
431
++                ${new_broadcast_address:+broadcast $new_broadcast_address} \
432
++                dev ${interface} label ${interface}
433
++
434
++            if [ -n "$new_interface_mtu" ]; then
435
++                # set MTU
436
++                ip link set dev ${interface} mtu ${new_interface_mtu}
437
++            fi
438
++
439
++            # set if_metric if IF_METRIC is set or there's more than one router
440
++            if_metric="$IF_METRIC"
441
++            if [ "${new_routers%% *}" != "${new_routers}" ]; then
442
++                if_metric=${if_metric:-1}
443
++            fi
444
++
445
++            for router in $new_routers; do
446
++                if [ "$new_subnet_mask" = "255.255.255.255" ]; then
447
++                    # point-to-point connection => set explicit route
448
++                    ip -4 route add ${router} dev $interface >/dev/null 2>&1
449
++                fi
450
++
451
++                # set default route
452
++                ip -4 route add default via ${router} dev ${interface} \
453
++                    ${if_metric:+metric $if_metric} >/dev/null 2>&1
454
++
455
++                if [ -n "$if_metric" ]; then
456
++                    if_metric=$((if_metric+1))
457
++                fi
458
++            done
459
++        fi
460
++
461
++        if [ -n "$alias_ip_address" ] &&
462
++           [ "$new_ip_address" != "$alias_ip_address" ]; then
463
++            # separate alias IP given, which may have changed
464
++            # => flush it, set it & add host route to it
465
++            ip -4 addr flush dev ${interface} label ${interface}:0
466
++            ip -4 addr add ${alias_ip_address}${alias_subnet_mask:+/$alias_subnet_mask} \
467
++                dev ${interface} label ${interface}:0
468
++            ip -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
469
++        fi
470
++
471
++        # update /etc/resolv.conf
472
++        make_resolv_conf
473
++
474
++        ;;
475
++
476
++    EXPIRE|FAIL|RELEASE|STOP)
477
++        if [ -n "$alias_ip_address" ]; then
478
++            # flush alias IP
479
++            ip -4 addr flush dev ${interface} label ${interface}:0
480
++        fi
481
++
482
++        if [ -n "$old_ip_address" ]; then
483
++            # flush leased IP
484
++            ip -4 addr flush dev ${interface} label ${interface}
485
++        fi
486
++
487
++        if [ -n "$alias_ip_address" ]; then
488
++            # alias IP given => set it & add host route to it
489
++            ip -4 addr add ${alias_ip_address}${alias_network_arg} \
490
++                dev ${interface} label ${interface}:0
491
++            ip -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
492
++        fi
493
++
494
++        ;;
495
++
496
++    TIMEOUT)
497
++        if [ -n "$alias_ip_address" ]; then
498
++            # flush alias IP
499
++            ip -4 addr flush dev ${interface} label ${interface}:0
500
++        fi
501
++
502
++        # set IP from recorded lease
503
++        ip -4 addr add ${new_ip_address}${new_subnet_mask:+/$new_subnet_mask} \
504
++            ${new_broadcast_address:+broadcast $new_broadcast_address} \
505
++            dev ${interface} label ${interface}
506
++
507
++        if [ -n "$new_interface_mtu" ]; then
508
++            # set MTU
509
++            ip link set dev ${interface} mtu ${new_interface_mtu}
510
++        fi
511
++
512
++        # if there is no router recorded in the lease or the 1st router answers pings
513
++        if [ -z "$new_routers" ] || ping -q -c 1 "${new_routers%% *}"; then
514
++            if [ -n "$alias_ip_address" ] &&
515
++               [ "$new_ip_address" != "$alias_ip_address" ]; then
516
++                # separate alias IP given => set up the alias IP & add host route to it
517
++                ip -4 addr add ${alias_ip_address}${alias_subnet_mask:+/$alias_subnet_mask} \
518
++                    dev ${interface} label ${interface}:0
519
++                ip -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
520
++            fi
521
++
522
++            # set if_metric if IF_METRIC is set or there's more than one router
523
++            if_metric="$IF_METRIC"
524
++            if [ "${new_routers%% *}" != "${new_routers}" ]; then
525
++                if_metric=${if_metric:-1}
526
++            fi
527
++
528
++            # set default route
529
++            for router in $new_routers; do
530
++                ip -4 route add default via ${router} dev ${interface} \
531
++                    ${if_metric:+metric $if_metric} >/dev/null 2>&1
532
++
533
++                if [ -n "$if_metric" ]; then
534
++                    if_metric=$((if_metric+1))
535
++                fi
536
++            done
537
++
538
++            # update /etc/resolv.conf
539
++            make_resolv_conf
540
++        else
541
++            # flush all IPs from interface
542
++            ip -4 addr flush dev ${interface}
543
++            exit_with_hooks 1
544
++        fi
545
++
546
++        ;;
547
++
548
++    ### DHCPv6 Handlers
549
++    # TODO handle prefix change: ?based on ${old_ip6_prefix} and ${new_ip6_prefix}?
550
++
551
++    PREINIT6)
552
++        # ensure interface is up
553
++        ip link set ${interface} up
554
++
555
++        # flush any stale global permanent IPs from interface
556
++        ip -6 addr flush dev ${interface} scope global permanent
557
++
558
++        ;;
559
++
560
++    BOUND6|RENEW6|REBIND6)
561
++        if [ "${new_ip6_address}" ] && [ "${new_ip6_prefixlen}" ]; then
562
++            # set leased IP
563
++            ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
564
++                dev ${interface} scope global
565
++        fi
566
++
567
++        # update /etc/resolv.conf
568
++        if [ "${reason}" = BOUND6 ] ||
569
++           [ "${new_dhcp6_name_servers}" != "${old_dhcp6_name_servers}" ] ||
570
++           [ "${new_dhcp6_domain_search}" != "${old_dhcp6_domain_search}" ]; then
571
++            make_resolv_conf
572
++        fi
573
++
574
++        ;;
575
++
576
++    DEPREF6)
577
++        if [ -z "${cur_ip6_prefixlen}" ]; then
578
++            exit_with_hooks 1
579
++        fi
580
++
581
++        # set preferred lifetime of leased IP to 0
582
++        ip -6 addr change ${cur_ip6_address}/${cur_ip6_prefixlen} \
583
++            dev ${interface} scope global preferred_lft 0
584
++
585
++        ;;
586
++
587
++    EXPIRE6|RELEASE6|STOP6)
588
++        if [ -z "${old_ip6_address}" ] || [ -z "${old_ip6_prefixlen}" ]; then
589
++            exit_with_hooks 1
590
++        fi
591
++
592
++        # delete leased IP
593
++        ip -6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
594
++            dev ${interface}
595
+ 
596
+-  # Check for nameserver options.
597
+-  make_resolv_conf
598
+-
599
+-  exit_with_hooks 0
600
+-fi
601
+-
602
+-if [ x$reason = xRENEW6 ] || [ x$reason = xREBIND6 ] ; then
603
+-  if [ x${new_ip6_address} != x ] && [ x${new_ip6_prefixlen} != x ] ; then
604
+-    ${ip} -f inet6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
605
+-	dev ${interface} scope global
606
+-  fi
607
+-
608
+-  # Make sure nothing has moved around on us.
609
+-
610
+-  # Nameservers/domains/etc.
611
+-  if [ "x${new_dhcp6_name_servers}" != "x${old_dhcp6_name_servers}" ] ||
612
+-     [ "x${new_dhcp6_domain_search}" != "x${old_dhcp6_domain_search}" ] ; then
613
+-    make_resolv_conf
614
+-  fi
615
+-
616
+-  exit_with_hooks 0
617
+-fi
618
+-
619
+-if [ x$reason = xDEPREF6 ] ; then
620
+-  if [ x${new_ip6_prefixlen} = x ] ; then
621
+-    exit_with_hooks 2;
622
+-  fi
623
+-
624
+-  ${ip} -f inet6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \
625
+-       dev ${interface} scope global preferred_lft 0
626
+-
627
+-  exit_with_hooks 0
628
+-fi
629
+-
630
+-if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then
631
+-  if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
632
+-    exit_with_hooks 2;
633
+-  fi
634
+-
635
+-  ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
636
+-	dev ${interface}
637
+-
638
+-  exit_with_hooks 0
639
+-fi
640
++        ;;
641
++esac
642
+ 
643
+ exit_with_hooks 0
0 644
new file mode 100644
... ...
@@ -0,0 +1,150 @@
0
+Summary:	Dynamic host configuration protocol
1
+Name:		dhcp
2
+Version:	4.3.2
3
+Release:	1%{?dist}
4
+License:	ISC
5
+Url:      	http://isc.org/products/DHCP/
6
+Source0:  	ftp://ftp.isc.org/isc/%{name}/%{version}/%{name}-%{version}.tar.gz
7
+%define sha1 dhcp=c7fcc4fa2bd135700b410f47eca238dd67419654
8
+Group:		System Environment/Base
9
+Vendor:		VMware, Inc.
10
+Distribution:	Photon
11
+Patch0:		http://www.linuxfromscratch.org/patches/blfs/svn/dhcp-4.3.2-client_script-1.patch
12
+BuildRequires:	systemd
13
+%description
14
+The ISC DHCP package contains both the client and server programs for DHCP. dhclient (the client) is used for connecting to a network which uses DHCP to assign network addresses. dhcpd (the server) is used for assigning network addresses on private networks
15
+
16
+%package libs
17
+Summary:	Libraries for dhcp
18
+%description libs
19
+Libraries for the dhcp.
20
+
21
+%package devel
22
+Summary:	Development Libraries and header files for dhcp
23
+Requires:	dhcp-libs
24
+%description devel
25
+Headers and libraries for the dhcp.
26
+
27
+%package server
28
+Summary:	Provides the ISC DHCP server
29
+Requires:	dhcp-libs
30
+%description server
31
+dhcpd is the name of a program that operates as a daemon on a server to provide Dynamic Host Configuration Protocol (DHCP) service to a network. Clients may solicit an IP address (IP) from a DHCP server when they need one
32
+
33
+%package client
34
+Summary:	Provides the ISC DHCP client daemon and dhclient-script
35
+Requires:	dhcp-libs
36
+%description client
37
+The ISC DHCP Client, dhclient, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol, BOOTP protocol, or if these protocols fail, by statically assigning an address.
38
+
39
+
40
+%prep
41
+%setup -q
42
+%patch0 -p1
43
+%build
44
+CFLAGS="-D_PATH_DHCLIENT_SCRIPT='\"/sbin/dhclient-script\"'         \
45
+        -D_PATH_DHCPD_CONF='\"/etc/dhcp/dhcpd.conf\"'               \
46
+        -D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"'"        \
47
+./configure \
48
+	--prefix=%{_prefix} \
49
+	--sysconfdir=/etc/dhcp                                  \
50
+        --localstatedir=/var                                    \
51
+        --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases       \
52
+        --with-srv6-lease-file=/var/lib/dhcpd/dhcpd6.leases     \
53
+        --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
54
+        --with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases \
55
+	--with-srv-pid-file=%{_localstatedir}/run/dhcpd.pid \
56
+	--with-srv6-pid-file=%{_localstatedir}/run/dhcpd6.pid \
57
+    	--with-cli-pid-file=%{_localstatedir}/run/dhclient.pid \
58
+    	--with-cli6-pid-file=%{_localstatedir}/run/dhclient6.pid \
59
+    	--with-relay-pid-file=%{_localstatedir}/run/dhcrelay.pid \
60
+    	--enable-log-pid \
61
+	--enable-paranoia --enable-early-chroot
62
+    	 
63
+make %{?_smp_mflags}
64
+%install
65
+make DESTDIR=%{buildroot} install
66
+install -v -m755 client/scripts/linux %{buildroot}/usr/sbin/dhclient-script
67
+
68
+cat > %{buildroot}/etc/dhcp/dhclient.conf << "EOF"
69
+# Begin /etc/dhcp/dhclient.conf
70
+#
71
+# Basic dhclient.conf(5)
72
+
73
+#prepend domain-name-servers 127.0.0.1;
74
+request subnet-mask, broadcast-address, time-offset, routers,
75
+        domain-name, domain-name-servers, domain-search, host-name,
76
+        netbios-name-servers, netbios-scope, interface-mtu,
77
+        ntp-servers;
78
+require subnet-mask, domain-name-servers;
79
+#timeout 60;
80
+#retry 60;
81
+#reboot 10;
82
+#select-timeout 5;
83
+#initial-interval 2;
84
+
85
+# End /etc/dhcp/dhclient.conf
86
+EOF
87
+install -v -dm 755 %{buildroot}/usr/lib/systemd/system
88
+cat > %{buildroot}/usr/lib/systemd/system/dhcp.service << "EOF"
89
+[Unit]
90
+Description=ISC DHCP Server
91
+Documentation=man:dhcpd(8) man:dhcpd.conf(5)
92
+After=network.target
93
+
94
+[Service]
95
+EnvironmentFile=/etc/default/dhcpd
96
+ExecStart=/usr/sbin/dhcpd -f --no-pid $DHCPD_OPTS
97
+
98
+[Install]
99
+WantedBy=multi-user.target
100
+EOF
101
+
102
+install -v -dm 755 %{buildroot}/var/lib/dhclient
103
+
104
+%post	libs -p /sbin/ldconfig
105
+%postun	libs -p /sbin/ldconfig
106
+
107
+%files libs
108
+%defattr(-,root,root)
109
+%{_libdir}/libdhcpctl.a
110
+%{_libdir}/libdst.a
111
+%{_libdir}/libomapi.a
112
+
113
+%files devel
114
+%defattr(-,root,root)
115
+%{_includedir}/dhcpctl/dhcpctl.h
116
+%{_includedir}/isc-dhcp/dst.h
117
+%{_includedir}/omapip/*.h
118
+
119
+%files server
120
+%defattr(-,root,root)
121
+/etc/dhcp/dhcpd.conf.example
122
+%{_bindir}/omshell
123
+%{_sbindir}/dhcpd
124
+%{_sbindir}/dhcrelay
125
+%{_mandir}/man1/*
126
+%{_mandir}/man3/*
127
+%{_mandir}/man5/dhcp-eval.5.gz
128
+%{_mandir}/man5/dhcp-options.5.gz
129
+%{_mandir}/man5/dhcpd.conf.5.gz
130
+%{_mandir}/man5/dhcpd.leases.5.gz
131
+%{_mandir}/man8/dhcpd.8.gz
132
+%{_mandir}/man8/dhcrelay.8.gz
133
+/usr/lib/systemd/system/dhcp.service
134
+
135
+%files client
136
+%defattr(-,root,root)
137
+/etc/dhcp/dhclient.conf.example
138
+/etc/dhcp/dhclient.conf
139
+%{_sbindir}/dhclient
140
+%{_sbindir}/dhclient-script
141
+%dir /var/lib/dhclient
142
+%{_mandir}/man5/dhclient.conf.5.gz
143
+%{_mandir}/man5/dhclient.leases.5.gz
144
+%{_mandir}/man8/dhclient-script.8.gz
145
+%{_mandir}/man8/dhclient.8.gz
146
+
147
+%changelog
148
+*	Wed Jul 15 2015 Divya Thaluru <dthaluru@vmware.com> 4.3.2-1
149
+-	Initial build./
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:    libsoup HTTP client/server library
2 2
 Name:       libsoup
3 3
 Version:    2.50.0
4
-Release:    2%{?dist}
4
+Release:    3%{?dist}
5 5
 License:    GPLv2
6 6
 URL:        http://wiki.gnome.org/LibSoup
7 7
 Group:      System Environment/Development
... ...
@@ -18,6 +18,7 @@ BuildRequires:   python2
18 18
 BuildRequires:   python2-libs
19 19
 BuildRequires:   python2-devel
20 20
 BuildRequires:   python2-tools
21
+Requires:	libxml2
21 22
 
22 23
 %description
23 24
 libsoup is HTTP client/server library for GNOME
... ...
@@ -26,6 +27,7 @@ libsoup is HTTP client/server library for GNOME
26 26
 Summary: Header files for libsoup
27 27
 Group: System Environment/Development
28 28
 Requires: libsoup
29
+Requires: libxml2-devel
29 30
 %description devel
30 31
 Header files for libsoup.
31 32
 
... ...
@@ -76,6 +78,8 @@ make DESTDIR=%{buildroot} install
76 76
 %defattr(-,root,root)
77 77
 
78 78
 %changelog
79
+*   Mon Jul 20 2015 Divya Thaluru <dthaluru@vmware.com> 2.50.0-3
80
+-   Addinf libxml2 to Requires 
79 81
 *   Mon Jul 13 2015 Alexey Makhalov <amakhalov@vmware.com> 2.50.0-2
80 82
 -   Exclude /usr/lib/debug
81 83
 *   Fri Jun 5 2015 Touseef Liaqat <tliaqat@vmware.com> 2.50.0-1
... ...
@@ -5,6 +5,7 @@
5 5
 		"dbus-glib-devel","libndp-devel","libnl-devel","logrotate","kpartx","autogen-devel","gc-devel",
6 6
 		"gnutls-devel","guile-devel","json-c-devel","libestr-devel","libgcrypt-devel","liblogging-devel",
7 7
 		"librelp-devel","libtasn1-devel","libunistring-devel","nettle-devel",
8
-        "apache-ant","ant-contrib","apache-maven","apache-tomcat","jna",
9
-        "jaxws-ri","commons-daemon"]
8
+	        "apache-ant","ant-contrib","apache-maven","apache-tomcat","jna",
9
+		"dhcp-client","dhcp-server","dhcp-libs","dhcp-devel","initscripts","net-tools",
10
+	        "jaxws-ri","commons-daemon"]
10 11
 }