Skip to content

Commit

Permalink
rpcbind: skip IPv6 netids when using protocol version 2
Browse files Browse the repository at this point in the history
Motivation:
the rfc 1833 specifies only TCP (6) and UDP (17) transports. Any other transport
will be mapped to '-1'. Nevertheless, missing mapping was ignored and
sent to rpcbind.

Modification:
du not sent mapping request to rpcbind if transport is not supported.

Result:
no weird entries in portmap v2;

Fixes: dCache#44
Acked-by: 
Target: master, 2.5
  • Loading branch information
kofemann committed Jun 5, 2016
1 parent cc24188 commit 282971e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 - 2012 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2016 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -44,7 +44,7 @@ public class PortmapV2Client implements OncPortmapClient {
public PortmapV2Client(RpcCall call) {
_call = call;
}

public List<rpcb> dump() throws OncRpcException, IOException, TimeoutException {
_log.debug("portmap dump");
pmaplist list_reply = new pmaplist();
Expand Down Expand Up @@ -77,8 +77,12 @@ public boolean setPort(int program, int version, String netids, String addr, Str
_log.debug("portmap set port: prog: {} vers: {}, netid: {} addr: {}, owner: {}",
new Object[]{program, version, netids, addr, owner});

int protocol = netid.idOf(netids);
if (protocol == -1) {
return false;
}
InetSocketAddress address = org.dcache.xdr.netid.toInetSocketAddress(addr);
mapping m1 = new mapping(program, version, netid.idOf(netids), address.getPort());
mapping m1 = new mapping(program, version, protocol, address.getPort());

XdrBoolean isSet = new XdrBoolean();
_call.call(OncRpcPortmap.PMAPPROC_SET, m1, isSet);
Expand Down

0 comments on commit 282971e

Please sign in to comment.