Fix vlan creation.
doc/guile-netlink.texi
580 | 580 | list containing additional values for the given type. | |
581 | 581 | ||
582 | 582 | When @var{type} is @code{"vlan"}, @var{type-args} can contain a number associated | |
583 | - | with @code{'id}: the VLAN id to be created. | |
583 | + | with @code{'id}: the VLAN id to be created and a link name associated with | |
584 | + | @code{"link"}: the name of the link on which the vlan is created. | |
585 | + | ||
586 | + | The following is an example in which we create a new vlan link: | |
587 | + | @example | |
588 | + | ;; same as "ip l add link eth0 name eth0.7 type vlan id 7" | |
589 | + | (link-add "eth0.7" "vlan" #:type-args '((id . 7) (link . "eth0"))) | |
590 | + | @end example | |
584 | 591 | ||
585 | 592 | When @var{type} is @code{"veth"}, @var{type-args} can contain a string associated | |
586 | 593 | with @code{'peer}: the name of the peer. |
ip/link.scm
276 | 276 | 0 | |
277 | 277 | 0 | |
278 | 278 | 0 | |
279 | - | (list | |
280 | - | (make-route-attr IFLA_IFNAME | |
279 | + | `(,(make-route-attr IFLA_IFNAME | |
281 | 280 | (make-string-route-attr name)) | |
282 | - | (make-route-attr IFLA_LINKINFO | |
281 | + | ,(make-route-attr IFLA_LINKINFO | |
283 | 282 | (make-nested-route-attr | |
284 | 283 | (list | |
285 | 284 | (make-route-attr IFLA_INFO_KIND | |
286 | 285 | (make-string-route-attr type)) | |
287 | 286 | (make-route-attr IFLA_INFO_DATA | |
288 | - | (make-nested-route-attr type-data))))))))) | |
287 | + | (make-nested-route-attr type-data))))) | |
288 | + | ,@(if (assoc-ref type-args 'link) | |
289 | + | `(,(make-route-attr IFLA_LINK | |
290 | + | (make-u32-route-attr (link-name->index (assoc-ref type-args 'link))))) | |
291 | + | '()))))) | |
289 | 292 | (let ((sock (connect-route))) | |
290 | 293 | (send-msg message sock) | |
291 | 294 | (let ((answer (receive-and-decode-msg sock %default-route-decoder))) |